diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-08 17:16:23 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-11 12:34:48 +0100 |
| commit | 498a2e416e693fa22042d3ae81c5c969fc87fe5c (patch) | |
| tree | 89ea2ea8bf0331d47b38059501df2cede6cdd5bd | |
| parent | 69072c4f5d18d7a1762fbfb007b0ba3d6b59ad33 (diff) | |
| download | rust-498a2e416e693fa22042d3ae81c5c969fc87fe5c.tar.gz rust-498a2e416e693fa22042d3ae81c5c969fc87fe5c.zip | |
[breaking-change] don't pub export ast::IntLitType variants
| -rw-r--r-- | src/librustc/middle/const_eval.rs | 6 | ||||
| -rw-r--r-- | src/librustc_lint/types.rs | 12 | ||||
| -rw-r--r-- | src/librustc_trans/trans/consts.rs | 6 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax_ext/concat.rs | 6 |
11 files changed, 42 insertions, 43 deletions
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 80adc3e6fc6..6650a06229a 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -1328,14 +1328,14 @@ fn lit_to_const(sess: &Session, span: Span, lit: &ast::Lit, ty_hint: Option<Ty>) } ast::LitKind::Byte(n) => Uint(n as u64), ast::LitKind::Char(n) => Uint(n as u64), - ast::LitKind::Int(n, ast::SignedIntLit(_)) => Int(n as i64), - ast::LitKind::Int(n, ast::UnsuffixedIntLit) => { + ast::LitKind::Int(n, ast::LitIntType::Signed(_)) => Int(n as i64), + ast::LitKind::Int(n, ast::LitIntType::Unsuffixed) => { match ty_hint.map(|ty| &ty.sty) { Some(&ty::TyUint(_)) => Uint(n), _ => Int(n as i64) } } - ast::LitKind::Int(n, ast::UnsignedIntLit(_)) => Uint(n), + ast::LitKind::Int(n, ast::LitIntType::Unsigned(_)) => Uint(n), ast::LitKind::Float(ref n, _) | ast::LitKind::FloatUnsuffixed(ref n) => { if let Ok(x) = n.parse::<f64>() { diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 11469f43140..9fe1aa15f4a 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -103,10 +103,10 @@ impl LateLintPass for TypeLimits { hir::ExprUnary(hir::UnNeg, ref expr) => { if let hir::ExprLit(ref lit) = expr.node { match lit.node { - ast::LitKind::Int(_, ast::UnsignedIntLit(_)) => { + ast::LitKind::Int(_, ast::LitIntType::Unsigned(_)) => { forbid_unsigned_negation(cx, e.span); }, - ast::LitKind::Int(_, ast::UnsuffixedIntLit) => { + ast::LitKind::Int(_, ast::LitIntType::Unsuffixed) => { if let ty::TyUint(_) = cx.tcx.node_id_to_type(e.id).sty { forbid_unsigned_negation(cx, e.span); } @@ -159,8 +159,8 @@ impl LateLintPass for TypeLimits { match cx.tcx.node_id_to_type(e.id).sty { ty::TyInt(t) => { match lit.node { - ast::LitKind::Int(v, ast::SignedIntLit(_)) | - ast::LitKind::Int(v, ast::UnsuffixedIntLit) => { + ast::LitKind::Int(v, ast::LitIntType::Signed(_)) | + ast::LitKind::Int(v, ast::LitIntType::Unsuffixed) => { let int_type = if let ast::IntTy::Is = t { cx.sess().target.int_type } else { @@ -312,8 +312,8 @@ impl LateLintPass for TypeLimits { let (min, max) = int_ty_range(int_ty); let lit_val: i64 = match lit.node { hir::ExprLit(ref li) => match li.node { - ast::LitKind::Int(v, ast::SignedIntLit(_)) | - ast::LitKind::Int(v, ast::UnsuffixedIntLit) => v as i64, + ast::LitKind::Int(v, ast::LitIntType::Signed(_)) | + ast::LitKind::Int(v, ast::LitIntType::Unsuffixed) => v as i64, _ => return true }, _ => panic!() diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs index f6bee7c2696..e1cff76cb0f 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/trans/consts.rs @@ -66,13 +66,13 @@ pub fn const_lit(cx: &CrateContext, e: &hir::Expr, lit: &ast::Lit) match lit.node { LitKind::Byte(b) => C_integral(Type::uint_from_ty(cx, ast::UintTy::U8), b as u64, false), LitKind::Char(i) => C_integral(Type::char(cx), i as u64, false), - LitKind::Int(i, ast::SignedIntLit(t)) => { + LitKind::Int(i, ast::LitIntType::Signed(t)) => { C_integral(Type::int_from_ty(cx, t), i, true) } - LitKind::Int(u, ast::UnsignedIntLit(t)) => { + LitKind::Int(u, ast::LitIntType::Unsigned(t)) => { C_integral(Type::uint_from_ty(cx, t), u, false) } - LitKind::Int(i, ast::UnsuffixedIntLit) => { + LitKind::Int(i, ast::LitIntType::Unsuffixed) => { let lit_int_ty = cx.tcx().node_id_to_type(e.id); match lit_int_ty.sty { ty::TyInt(t) => { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index e348f7a9e06..f61316f1dfe 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2613,9 +2613,9 @@ fn check_lit<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, } ast::LitKind::Byte(_) => tcx.types.u8, ast::LitKind::Char(_) => tcx.types.char, - ast::LitKind::Int(_, ast::SignedIntLit(t)) => tcx.mk_mach_int(t), - ast::LitKind::Int(_, ast::UnsignedIntLit(t)) => tcx.mk_mach_uint(t), - ast::LitKind::Int(_, ast::UnsuffixedIntLit) => { + ast::LitKind::Int(_, ast::LitIntType::Signed(t)) => tcx.mk_mach_int(t), + ast::LitKind::Int(_, ast::LitIntType::Unsigned(t)) => tcx.mk_mach_uint(t), + ast::LitKind::Int(_, ast::LitIntType::Unsuffixed) => { let opt_ty = expected.to_option(fcx).and_then(|ty| { match ty.sty { ty::TyInt(_) | ty::TyUint(_) => Some(ty), diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 41414ef5be1..6ece7ed56cf 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -13,7 +13,6 @@ pub use self::ForeignItem_::*; pub use self::Item_::*; pub use self::KleeneOp::*; -pub use self::LitIntType::*; pub use self::MacStmtStyle::*; pub use self::MetaItem_::*; pub use self::Mutability::*; @@ -1267,9 +1266,9 @@ pub type Lit = Spanned<LitKind>; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum LitIntType { - SignedIntLit(IntTy), - UnsignedIntLit(UintTy), - UnsuffixedIntLit, + Signed(IntTy), + Unsigned(UintTy), + Unsuffixed, } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 9302cabe8d8..7dfea4f798c 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -680,7 +680,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.expr(sp, ast::ExprKind::Lit(P(respan(sp, lit)))) } fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> { - self.expr_lit(span, ast::LitKind::Int(i as u64, ast::UnsignedIntLit(ast::UintTy::Us))) + self.expr_lit(span, ast::LitKind::Int(i as u64, ast::LitIntType::Unsigned(ast::UintTy::Us))) } fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> { if i < 0 { @@ -689,14 +689,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let lit = self.expr_lit(sp, ast::LitKind::Int(i, lit_ty)); self.expr_unary(sp, ast::UnOp::Neg, lit) } else { - self.expr_lit(sp, ast::LitKind::Int(i as u64, ast::SignedIntLit(ast::IntTy::Is))) + self.expr_lit(sp, ast::LitKind::Int(i as u64, ast::LitIntType::Signed(ast::IntTy::Is))) } } fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> { - self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U32))) + self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::LitIntType::Unsigned(ast::UintTy::U32))) } fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> { - self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U8))) + self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::LitIntType::Unsigned(ast::UintTy::U8))) } fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> { self.expr_lit(sp, ast::LitKind::Bool(value)) diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 18342fa775b..44ef74fcc0c 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -268,7 +268,7 @@ pub mod rt { } else { *self }; - let lit = ast::LitKind::Int(val as u64, ast::SignedIntLit($tag)); + let lit = ast::LitKind::Int(val as u64, ast::LitIntType::Signed($tag)); let lit = P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::Lit(P(dummy_spanned(lit))), @@ -290,7 +290,7 @@ pub mod rt { (unsigned, $t:ty, $tag:expr) => ( impl ToTokens for $t { fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> { - let lit = ast::LitKind::Int(*self as u64, ast::UnsignedIntLit($tag)); + let lit = ast::LitKind::Int(*self as u64, ast::LitIntType::Unsigned($tag)); dummy_spanned(lit).to_tokens(cx) } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index bfd3dea38ce..3d68dcdc6b7 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -586,7 +586,7 @@ pub fn integer_lit(s: &str, let mut base = 10; let orig = s; - let mut ty = ast::UnsuffixedIntLit; + let mut ty = ast::LitIntType::Unsuffixed; if char_at(s, 0) == '0' && s.len() > 1 { match char_at(s, 1) { @@ -618,16 +618,16 @@ pub fn integer_lit(s: &str, if let Some(ref suf) = suffix { if suf.is_empty() { sd.span_bug(sp, "found empty literal suffix in Some")} ty = match &**suf { - "isize" => ast::SignedIntLit(ast::IntTy::Is), - "i8" => ast::SignedIntLit(ast::IntTy::I8), - "i16" => ast::SignedIntLit(ast::IntTy::I16), - "i32" => ast::SignedIntLit(ast::IntTy::I32), - "i64" => ast::SignedIntLit(ast::IntTy::I64), - "usize" => ast::UnsignedIntLit(ast::UintTy::Us), - "u8" => ast::UnsignedIntLit(ast::UintTy::U8), - "u16" => ast::UnsignedIntLit(ast::UintTy::U16), - "u32" => ast::UnsignedIntLit(ast::UintTy::U32), - "u64" => ast::UnsignedIntLit(ast::UintTy::U64), + "isize" => ast::LitIntType::Signed(ast::IntTy::Is), + "i8" => ast::LitIntType::Signed(ast::IntTy::I8), + "i16" => ast::LitIntType::Signed(ast::IntTy::I16), + "i32" => ast::LitIntType::Signed(ast::IntTy::I32), + "i64" => ast::LitIntType::Signed(ast::IntTy::I64), + "usize" => ast::LitIntType::Unsigned(ast::UintTy::Us), + "u8" => ast::LitIntType::Unsigned(ast::UintTy::U8), + "u16" => ast::LitIntType::Unsigned(ast::UintTy::U16), + "u32" => ast::LitIntType::Unsigned(ast::UintTy::U32), + "u64" => ast::LitIntType::Unsigned(ast::UintTy::U64), _ => { // i<digits> and u<digits> look like widths, so lets // give an error message along those lines diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d3b92ac0c0c..85a5b5b3068 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2014,7 +2014,7 @@ impl<'a> Parser<'a> { pub fn mk_lit_u32(&mut self, i: u32, attrs: ThinAttributes) -> P<Expr> { let span = &self.span; let lv_lit = P(codemap::Spanned { - node: LitKind::Int(i as u64, ast::UnsignedIntLit(UintTy::U32)), + node: LitKind::Int(i as u64, ast::LitIntType::Unsigned(UintTy::U32)), span: *span }); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 96c5d116629..8d29cb39d3a 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -645,14 +645,14 @@ pub trait PrintState<'a> { } ast::LitKind::Int(i, t) => { match t { - ast::SignedIntLit(st) => { + ast::LitIntType::Signed(st) => { word(self.writer(), &st.val_to_string(i as i64)) } - ast::UnsignedIntLit(ut) => { + ast::LitIntType::Unsigned(ut) => { word(self.writer(), &ut.val_to_string(i)) } - ast::UnsuffixedIntLit => { + ast::LitIntType::Unsuffixed => { word(self.writer(), &format!("{}", i)) } } diff --git a/src/libsyntax_ext/concat.rs b/src/libsyntax_ext/concat.rs index 8ea0580d4c8..db731adf794 100644 --- a/src/libsyntax_ext/concat.rs +++ b/src/libsyntax_ext/concat.rs @@ -37,9 +37,9 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt, ast::LitKind::Char(c) => { accumulator.push(c); } - ast::LitKind::Int(i, ast::UnsignedIntLit(_)) | - ast::LitKind::Int(i, ast::SignedIntLit(_)) | - ast::LitKind::Int(i, ast::UnsuffixedIntLit) => { + ast::LitKind::Int(i, ast::LitIntType::Unsigned(_)) | + ast::LitKind::Int(i, ast::LitIntType::Signed(_)) | + ast::LitKind::Int(i, ast::LitIntType::Unsuffixed) => { accumulator.push_str(&format!("{}", i)); } ast::LitKind::Bool(b) => { |
