about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2013-01-24 21:47:57 +0100
committerBrian Anderson <banderson@mozilla.com>2013-02-03 15:37:24 -0800
commiteb194621044253fae32649511d76515a64009a53 (patch)
treea23632e8039ccea8f82d6e1ca2c09f8b82193494 /src/libsyntax
parent26e72bf92bb0f9cf4d10a5edb07dbbd5c09f0e24 (diff)
downloadrust-eb194621044253fae32649511d76515a64009a53.tar.gz
rust-eb194621044253fae32649511d76515a64009a53.zip
Converted libcore/uint-template.rs to the new string functions.
- Moved ToStr implementation of unsigned integers to uint-template.rs.
- Marked the `str()` function as deprecated.
- Forwarded all conversion functions to `core::num::to_str_common()`
  and `core::num::from_str_common()`.
- Fixed most places in the codebase where `to_str()` is being used.
- Added uint-template to_str and from_str overflow tests.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/lexer.rs4
-rw-r--r--src/libsyntax/print/pprust.rs10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index 71e96699c3d..381183e736c 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -417,7 +417,7 @@ fn scan_number(c: char, rdr: string_reader) -> token::Token {
         if str::len(num_str) == 0u {
             rdr.fatal(~"no valid digits found for number");
         }
-        let parsed = u64::from_str_radix(num_str, base as u64).get();
+        let parsed = u64::from_str_radix(num_str, base as uint).get();
         match tp {
           either::Left(t) => return token::LIT_INT(parsed as i64, t),
           either::Right(t) => return token::LIT_UINT(parsed, t)
@@ -471,7 +471,7 @@ fn scan_number(c: char, rdr: string_reader) -> token::Token {
         if str::len(num_str) == 0u {
             rdr.fatal(~"no valid digits found for number");
         }
-        let parsed = u64::from_str_radix(num_str, base as u64).get();
+        let parsed = u64::from_str_radix(num_str, base as uint).get();
 
         debug!("lexing %s as an unsuffixed integer literal",
                num_str);
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 527b036a46c..5079766239b 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2006,24 +2006,24 @@ pub fn print_literal(s: ps, &&lit: @ast::lit) {
       ast::lit_int(i, t) => {
         if i < 0_i64 {
             word(s.s,
-                 ~"-" + u64::to_str(-i as u64, 10u)
+                 ~"-" + u64::to_str_radix(-i as u64, 10u)
                  + ast_util::int_ty_to_str(t));
         } else {
             word(s.s,
-                 u64::to_str(i as u64, 10u)
+                 u64::to_str_radix(i as u64, 10u)
                  + ast_util::int_ty_to_str(t));
         }
       }
       ast::lit_uint(u, t) => {
         word(s.s,
-             u64::to_str(u, 10u)
+             u64::to_str_radix(u, 10u)
              + ast_util::uint_ty_to_str(t));
       }
       ast::lit_int_unsuffixed(i) => {
         if i < 0_i64 {
-            word(s.s, ~"-" + u64::to_str(-i as u64, 10u));
+            word(s.s, ~"-" + u64::to_str_radix(-i as u64, 10u));
         } else {
-            word(s.s, u64::to_str(i as u64, 10u));
+            word(s.s, u64::to_str_radix(i as u64, 10u));
         }
       }
       ast::lit_float(f, t) => {