Skip to content

Commit 399f108

Browse files
committed
---
yaml --- r: 16251 b: refs/heads/try c: 5f904d2 h: refs/heads/master i: 16249: 5938ee8 16247: 5fe64e3 v: v3
1 parent 23cd92a commit 399f108

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
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: a542258277aac84889ed7eb3c2f14273d6d5e3f7
5+
refs/heads/try: 5f904d278fa3cc8993bd961dea93d99a34e2f3c2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/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)