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 | |
| 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')
| -rw-r--r-- | src/libsyntax/ast.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 |
3 files changed, 20 insertions, 13 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 26463df1871..399810cb7f5 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -66,8 +66,6 @@ use parse::lexer; use ptr::P; use std::fmt; -#[allow(deprecated)] -use std::num::Int; use std::rc::Rc; use serialize::{Encodable, Decodable, Encoder, Decoder}; @@ -1142,16 +1140,24 @@ pub enum Sign { } impl Sign { - #[allow(deprecated)] // Int - pub fn new<T:Int>(n: T) -> Sign { - if n < Int::zero() { - Minus - } else { - Plus - } + pub fn new<T: IntSign>(n: T) -> Sign { + n.sign() } } +pub trait IntSign { + fn sign(&self) -> Sign; +} +macro_rules! doit { + ($($t:ident)*) => ($(impl IntSign for $t { + #[allow(unused_comparisons)] + fn sign(&self) -> Sign { + if *self < 0 {Minus} else {Plus} + } + })*) +} +doit! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize } + #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum LitIntType { SignedIntLit(IntTy, Sign), 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 diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 1333e27058f..1a1713a8ba6 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -22,8 +22,6 @@ use std::cell::{Cell, RefCell}; use std::fs::File; use std::io::Read; use std::iter; -#[allow(deprecated)] // Int -use std::num::Int; use std::path::{Path, PathBuf}; use std::rc::Rc; use std::str; |
