diff options
| author | Aaron Turon <aturon@mozilla.com> | 2015-03-19 23:42:18 -0700 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2015-03-31 07:50:25 -0700 |
| commit | 232424d9952700682373ccf2d578109f401ff023 (patch) | |
| tree | 1818492e1eca9d76f4090160fe2c04ea4d28a711 /src/libsyntax/parse/lexer | |
| parent | 14192d6df5cc714e5c9a3ca70b08f2514d977be2 (diff) | |
| download | rust-232424d9952700682373ccf2d578109f401ff023.tar.gz rust-232424d9952700682373ccf2d578109f401ff023.zip | |
Stabilize std::num
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
Diffstat (limited to 'src/libsyntax/parse/lexer')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 532b632fac8..bcb265af926 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -20,7 +20,6 @@ use std::borrow::{IntoCow, Cow}; use std::char; use std::fmt; use std::mem::replace; -use std::num; use std::rc::Rc; pub use ext::tt::transcribe::{TtReader, new_tt_reader, new_tt_reader_with_doc_flag}; @@ -622,8 +621,8 @@ impl<'a> StringReader<'a> { // find the integer representing the name self.scan_digits(base); - let encoded_name : u32 = self.with_str_from(start_bpos, |s| { - num::from_str_radix(s, 10).unwrap_or_else(|_| { + let encoded_name: u32 = self.with_str_from(start_bpos, |s| { + u32::from_str_radix(s, 10).unwrap_or_else(|_| { panic!("expected digits representing a name, got {:?}, {}, range [{:?},{:?}]", s, whence, start_bpos, self.last_pos); }) @@ -641,7 +640,7 @@ impl<'a> StringReader<'a> { let start_bpos = self.last_pos; self.scan_digits(base); let encoded_ctxt : ast::SyntaxContext = self.with_str_from(start_bpos, |s| { - num::from_str_radix(s, 10).unwrap_or_else(|_| { + u32::from_str_radix(s, 10).unwrap_or_else(|_| { panic!("expected digits representing a ctxt, got {:?}, {}", s, whence); }) }); |
