summary refs log tree commit diff
path: root/src/libsyntax/codemap.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-17 15:32:42 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-21 11:37:43 -0700
commiteeb94886adccb3f13003f92f117115d17846ce1f (patch)
tree2d729b8e48c5022941e2c06e412a2b2a1744ca1c /src/libsyntax/codemap.rs
parente091ba3f3e8b2b00827ab4934314829b33ffb966 (diff)
downloadrust-eeb94886adccb3f13003f92f117115d17846ce1f.tar.gz
rust-eeb94886adccb3f13003f92f117115d17846ce1f.zip
std: Remove deprecated/unstable num functionality
This commit removes all the old casting/generic traits from `std::num` that are
no longer in use by the standard library. This additionally removes the old
`strconv` module which has not seen much use in quite a long time. All generic
functionality has been supplanted with traits in the `num` crate and the
`strconv` module is supplanted with the [rust-strconv crate][rust-strconv].

[rust-strconv]: https://github.com/lifthrasiir/rust-strconv

This is a breaking change due to the removal of these deprecated crates, and the
alternative crates are listed above.

[breaking-change]
Diffstat (limited to 'src/libsyntax/codemap.rs')
-rw-r--r--src/libsyntax/codemap.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index dfdaa47d8b9..835d0395199 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -20,7 +20,6 @@
 pub use self::MacroFormat::*;
 
 use std::cell::RefCell;
-use std::num::ToPrimitive;
 use std::ops::{Add, Sub};
 use std::rc::Rc;
 
@@ -862,7 +861,11 @@ impl CodeMap {
     pub fn record_expansion(&self, expn_info: ExpnInfo) -> ExpnId {
         let mut expansions = self.expansions.borrow_mut();
         expansions.push(expn_info);
-        ExpnId(expansions.len().to_u32().expect("too many ExpnInfo's!") - 1)
+        let len = expansions.len();
+        if len > u32::max_value() as usize {
+            panic!("too many ExpnInfo's!");
+        }
+        ExpnId(len as u32 - 1)
     }
 
     pub fn with_expn_info<T, F>(&self, id: ExpnId, f: F) -> T where