Skip to content

Commit 5a06219

Browse files
committed
---
yaml --- r: 13245 b: refs/heads/master c: 5f904d2 h: refs/heads/master i: 13243: 1a2467e v: v3
1 parent d68766e commit 5a06219

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a542258277aac84889ed7eb3c2f14273d6d5e3f7
2+
refs/heads/master: 5f904d278fa3cc8993bd961dea93d99a34e2f3c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/int-template.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ fn parse_buf(buf: [u8], radix: uint) -> option<T> {
8989
fn from_str(s: str) -> option<T> { parse_buf(str::bytes(s), 10u) }
9090

9191
#[doc = "Convert to a string in a given base"]
92-
fn to_str(n: T, radix: uint) -> str {
93-
assert (0u < radix && radix <= 16u);
94-
ret if n < 0 as T {
95-
"-" + uint::to_str(-n as uint, radix)
96-
} else { uint::to_str(n as uint, radix) };
92+
fn to_str(n: T, radix: uint) -> str unsafe {
93+
to_str_bytes(n, radix) {|slice|
94+
vec::unpack_slice(slice) {|p, len|
95+
str::unsafe::from_buf_len(p, len)
96+
}
97+
}
9798
}
9899

99100
fn to_str_bytes<U>(n: T, radix: uint, f: fn([u8]/&) -> U) -> U {

0 commit comments

Comments
 (0)