diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 15:28:53 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 15:28:53 -0700 |
| commit | a1dd5ac78745a9f266573d539ba34bbd75b50277 (patch) | |
| tree | 584e29815ca61d4045fa6bfa048d3804c7ce529a /src/libsyntax/codemap.rs | |
| parent | 98e9765d973d46faa5c80fb37a48040ca9e87b28 (diff) | |
| parent | a568a7f9f2eb3fa3f3e049df288ef0ad32cc7881 (diff) | |
| download | rust-a1dd5ac78745a9f266573d539ba34bbd75b50277.tar.gz rust-a1dd5ac78745a9f266573d539ba34bbd75b50277.zip | |
rollup merge of #24636: alexcrichton/remove-deprecated
Conflicts: src/libcore/result.rs
Diffstat (limited to 'src/libsyntax/codemap.rs')
| -rw-r--r-- | src/libsyntax/codemap.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index a0c29a2371b..34ad192845c 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 |
