diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 425e34cd9f04..64ca49d76f3c 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -46,7 +46,7 @@ use syntax::ast_util::is_shift_binop; use syntax::attr::{self, AttrMetaMethods}; use syntax::codemap::{Span, DUMMY_SP}; use syntax::parse::token; -use syntax::ast::{TyI, TyU, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64}; +use syntax::ast::{TyIs, TyUs, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64}; use syntax::ast_util; use syntax::ptr::P; use syntax::visit::{self, Visitor}; @@ -216,7 +216,7 @@ impl LintPass for TypeLimits { match lit.node { ast::LitInt(v, ast::SignedIntLit(_, ast::Plus)) | ast::LitInt(v, ast::UnsuffixedIntLit(ast::Plus)) => { - let int_type = if t == ast::TyI { + let int_type = if t == ast::TyIs { cx.sess().target.int_type } else { t }; let (min, max) = int_ty_range(int_type); @@ -233,7 +233,7 @@ impl LintPass for TypeLimits { }; }, ty::ty_uint(t) => { - let uint_type = if t == ast::TyU { + let uint_type = if t == ast::TyUs { cx.sess().target.uint_type } else { t }; let (min, max) = uint_ty_range(uint_type); @@ -296,7 +296,7 @@ impl LintPass for TypeLimits { // warnings are consistent between 32- and 64-bit platforms fn int_ty_range(int_ty: ast::IntTy) -> (i64, i64) { match int_ty { - ast::TyI => (i64::MIN, i64::MAX), + ast::TyIs=> (i64::MIN, i64::MAX), ast::TyI8 => (i8::MIN as i64, i8::MAX as i64), ast::TyI16 => (i16::MIN as i64, i16::MAX as i64), ast::TyI32 => (i32::MIN as i64, i32::MAX as i64), @@ -306,7 +306,7 @@ impl LintPass for TypeLimits { fn uint_ty_range(uint_ty: ast::UintTy) -> (u64, u64) { match uint_ty { - ast::TyU => (u64::MIN, u64::MAX), + ast::TyUs=> (u64::MIN, u64::MAX), ast::TyU8 => (u8::MIN as u64, u8::MAX as u64), ast::TyU16 => (u16::MIN as u64, u16::MAX as u64), ast::TyU32 => (u32::MIN as u64, u32::MAX as u64), @@ -323,7 +323,7 @@ impl LintPass for TypeLimits { fn int_ty_bits(int_ty: ast::IntTy, target_int_ty: ast::IntTy) -> u64 { match int_ty { - ast::TyI => int_ty_bits(target_int_ty, target_int_ty), + ast::TyIs=> int_ty_bits(target_int_ty, target_int_ty), ast::TyI8 => i8::BITS as u64, ast::TyI16 => i16::BITS as u64, ast::TyI32 => i32::BITS as u64, @@ -333,7 +333,7 @@ impl LintPass for TypeLimits { fn uint_ty_bits(uint_ty: ast::UintTy, target_uint_ty: ast::UintTy) -> u64 { match uint_ty { - ast::TyU => uint_ty_bits(target_uint_ty, target_uint_ty), + ast::TyUs=> uint_ty_bits(target_uint_ty, target_uint_ty), ast::TyU8 => u8::BITS as u64, ast::TyU16 => u16::BITS as u64, ast::TyU32 => u32::BITS as u64, @@ -404,14 +404,14 @@ struct ImproperCTypesVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) { match self.cx.tcx.def_map.borrow()[path_id].clone() { - def::DefPrimTy(ast::TyInt(ast::TyI)) => { + def::DefPrimTy(ast::TyInt(ast::TyIs)) => { self.cx.span_lint(IMPROPER_CTYPES, sp, - "found rust type `int` in foreign module, while \ + "found rust type `isize` in foreign module, while \ libc::c_int or libc::c_long should be used"); } - def::DefPrimTy(ast::TyUint(ast::TyU)) => { + def::DefPrimTy(ast::TyUint(ast::TyUs)) => { self.cx.span_lint(IMPROPER_CTYPES, sp, - "found rust type `uint` in foreign module, while \ + "found rust type `usize` in foreign module, while \ libc::c_uint or libc::c_ulong should be used"); } def::DefTy(..) => { diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 07dc13ff0d48..a39126f08516 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -443,8 +443,8 @@ fn parse_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> Ty<'tcx> w let tcx = st.tcx; match next(st) { 'b' => return tcx.types.bool, - 'i' => return tcx.types.int, - 'u' => return tcx.types.uint, + 'i' => { /* eat the s of is */ next(st); return tcx.types.int }, + 'u' => { /* eat the s of us */ next(st); return tcx.types.uint }, 'M' => { match next(st) { 'b' => return tcx.types.u8, diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 0042209aced6..c019d129218b 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -61,7 +61,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t ty::ty_char => mywrite!(w, "c"), ty::ty_int(t) => { match t { - ast::TyI => mywrite!(w, "i"), + ast::TyIs => mywrite!(w, "is"), ast::TyI8 => mywrite!(w, "MB"), ast::TyI16 => mywrite!(w, "MW"), ast::TyI32 => mywrite!(w, "ML"), @@ -70,7 +70,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t } ty::ty_uint(t) => { match t { - ast::TyU => mywrite!(w, "u"), + ast::TyUs => mywrite!(w, "us"), ast::TyU8 => mywrite!(w, "Mb"), ast::TyU16 => mywrite!(w, "Mw"), ast::TyU32 => mywrite!(w, "Ml"), diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 32482fce4daa..1aec7252a3c1 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -528,12 +528,12 @@ pub fn eval_const_expr_partial(tcx: &ty::ctxt, e: &Expr) -> Result (int, const_int, i64), + ty::ty_int(ast::TyIs) => (int, const_int, i64), ty::ty_int(ast::TyI8) => (i8, const_int, i64), ty::ty_int(ast::TyI16) => (i16, const_int, i64), ty::ty_int(ast::TyI32) => (i32, const_int, i64), ty::ty_int(ast::TyI64) => (i64, const_int, i64), - ty::ty_uint(ast::TyU) => (uint, const_uint, u64), + ty::ty_uint(ast::TyUs) => (uint, const_uint, u64), ty::ty_uint(ast::TyU8) => (u8, const_uint, u64), ty::ty_uint(ast::TyU16) => (u16, const_uint, u64), ty::ty_uint(ast::TyU32) => (u32, const_uint, u64), diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index c359233eca17..62f1a2b49d44 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2302,12 +2302,12 @@ impl<'tcx> CommonTypes<'tcx> { bool: intern_ty(arena, interner, ty_bool), char: intern_ty(arena, interner, ty_char), err: intern_ty(arena, interner, ty_err), - int: intern_ty(arena, interner, ty_int(ast::TyI)), + int: intern_ty(arena, interner, ty_int(ast::TyIs)), i8: intern_ty(arena, interner, ty_int(ast::TyI8)), i16: intern_ty(arena, interner, ty_int(ast::TyI16)), i32: intern_ty(arena, interner, ty_int(ast::TyI32)), i64: intern_ty(arena, interner, ty_int(ast::TyI64)), - uint: intern_ty(arena, interner, ty_uint(ast::TyU)), + uint: intern_ty(arena, interner, ty_uint(ast::TyUs)), u8: intern_ty(arena, interner, ty_uint(ast::TyU8)), u16: intern_ty(arena, interner, ty_uint(ast::TyU16)), u32: intern_ty(arena, interner, ty_uint(ast::TyU32)), @@ -2653,7 +2653,7 @@ impl FlagComputation { pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> { match tm { - ast::TyI => tcx.types.int, + ast::TyIs => tcx.types.int, ast::TyI8 => tcx.types.i8, ast::TyI16 => tcx.types.i16, ast::TyI32 => tcx.types.i32, @@ -2663,7 +2663,7 @@ pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> { pub fn mk_mach_uint<'tcx>(tcx: &ctxt<'tcx>, tm: ast::UintTy) -> Ty<'tcx> { match tm { - ast::TyU => tcx.types.uint, + ast::TyUs => tcx.types.uint, ast::TyU8 => tcx.types.u8, ast::TyU16 => tcx.types.u16, ast::TyU32 => tcx.types.u32, @@ -3324,7 +3324,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents { let result = match ty.sty { // uint and int are ffi-unsafe - ty_uint(ast::TyU) | ty_int(ast::TyI) => { + ty_uint(ast::TyUs) | ty_int(ast::TyIs) => { TC::ReachesFfiUnsafe } @@ -3896,7 +3896,7 @@ pub fn type_is_fresh(ty: Ty) -> bool { pub fn type_is_uint(ty: Ty) -> bool { match ty.sty { - ty_infer(IntVar(_)) | ty_uint(ast::TyU) => true, + ty_infer(IntVar(_)) | ty_uint(ast::TyUs) => true, _ => false } } @@ -3942,7 +3942,7 @@ pub fn type_is_signed(ty: Ty) -> bool { pub fn type_is_machine(ty: Ty) -> bool { match ty.sty { - ty_int(ast::TyI) | ty_uint(ast::TyU) => false, + ty_int(ast::TyIs) | ty_uint(ast::TyUs) => false, ty_int(..) | ty_uint(..) | ty_float(..) => true, _ => false } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 58102fe5629d..cc9abecc20fc 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -86,9 +86,9 @@ use syntax::ast::{PolyTraitRef, PrimTy, SelfExplicit}; use syntax::ast::{RegionTyParamBound, StructField}; use syntax::ast::{TraitRef, TraitTyParamBound}; use syntax::ast::{Ty, TyBool, TyChar, TyF32}; -use syntax::ast::{TyF64, TyFloat, TyI, TyI8, TyI16, TyI32, TyI64, TyInt, TyObjectSum}; +use syntax::ast::{TyF64, TyFloat, TyIs, TyI8, TyI16, TyI32, TyI64, TyInt, TyObjectSum}; use syntax::ast::{TyParam, TyParamBound, TyPath, TyPtr, TyPolyTraitRef, TyQPath}; -use syntax::ast::{TyRptr, TyStr, TyU, TyU8, TyU16, TyU32, TyU64, TyUint}; +use syntax::ast::{TyRptr, TyStr, TyUs, TyU8, TyU16, TyU32, TyU64, TyUint}; use syntax::ast::{TypeImplItem}; use syntax::ast; use syntax::ast_map; @@ -833,13 +833,15 @@ impl PrimitiveTypeTable { table.intern("char", TyChar); table.intern("f32", TyFloat(TyF32)); table.intern("f64", TyFloat(TyF64)); - table.intern("int", TyInt(TyI)); + table.intern("int", TyInt(TyIs)); + table.intern("isize", TyInt(TyIs)); table.intern("i8", TyInt(TyI8)); table.intern("i16", TyInt(TyI16)); table.intern("i32", TyInt(TyI32)); table.intern("i64", TyInt(TyI64)); table.intern("str", TyStr); - table.intern("uint", TyUint(TyU)); + table.intern("uint", TyUint(TyUs)); + table.intern("usize", TyUint(TyUs)); table.intern("u8", TyUint(TyU8)); table.intern("u16", TyUint(TyU16)); table.intern("u32", TyUint(TyU32)); diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index edcfaae0f802..b889b5220788 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -903,8 +903,8 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>( ty::ty_int(t) => { let llty = Type::int_from_ty(cx.ccx(), t); let min = match t { - ast::TyI if llty == Type::i32(cx.ccx()) => i32::MIN as u64, - ast::TyI => i64::MIN as u64, + ast::TyIs if llty == Type::i32(cx.ccx()) => i32::MIN as u64, + ast::TyIs => i64::MIN as u64, ast::TyI8 => i8::MIN as u64, ast::TyI16 => i16::MIN as u64, ast::TyI32 => i32::MIN as u64, diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index 3f0f7fd9bd30..c099c80f8633 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -1797,14 +1797,14 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, ty::ty_bool => ("bool".to_string(), DW_ATE_boolean), ty::ty_char => ("char".to_string(), DW_ATE_unsigned_char), ty::ty_int(int_ty) => match int_ty { - ast::TyI => ("int".to_string(), DW_ATE_signed), + ast::TyIs => ("isize".to_string(), DW_ATE_signed), ast::TyI8 => ("i8".to_string(), DW_ATE_signed), ast::TyI16 => ("i16".to_string(), DW_ATE_signed), ast::TyI32 => ("i32".to_string(), DW_ATE_signed), ast::TyI64 => ("i64".to_string(), DW_ATE_signed) }, ty::ty_uint(uint_ty) => match uint_ty { - ast::TyU => ("uint".to_string(), DW_ATE_unsigned), + ast::TyUs => ("usize".to_string(), DW_ATE_unsigned), ast::TyU8 => ("u8".to_string(), DW_ATE_unsigned), ast::TyU16 => ("u16".to_string(), DW_ATE_unsigned), ast::TyU32 => ("u32".to_string(), DW_ATE_unsigned), @@ -3729,12 +3729,12 @@ fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, ty::ty_bool => output.push_str("bool"), ty::ty_char => output.push_str("char"), ty::ty_str => output.push_str("str"), - ty::ty_int(ast::TyI) => output.push_str("int"), + ty::ty_int(ast::TyIs) => output.push_str("isize"), ty::ty_int(ast::TyI8) => output.push_str("i8"), ty::ty_int(ast::TyI16) => output.push_str("i16"), ty::ty_int(ast::TyI32) => output.push_str("i32"), ty::ty_int(ast::TyI64) => output.push_str("i64"), - ty::ty_uint(ast::TyU) => output.push_str("uint"), + ty::ty_uint(ast::TyUs) => output.push_str("usize"), ty::ty_uint(ast::TyU8) => output.push_str("u8"), ty::ty_uint(ast::TyU16) => output.push_str("u16"), ty::ty_uint(ast::TyU32) => output.push_str("u32"), diff --git a/src/librustc_trans/trans/type_.rs b/src/librustc_trans/trans/type_.rs index 3785c2fb9bc5..88199f97b54b 100644 --- a/src/librustc_trans/trans/type_.rs +++ b/src/librustc_trans/trans/type_.rs @@ -112,7 +112,7 @@ impl Type { pub fn int_from_ty(ccx: &CrateContext, t: ast::IntTy) -> Type { match t { - ast::TyI => ccx.int_type(), + ast::TyIs => ccx.int_type(), ast::TyI8 => Type::i8(ccx), ast::TyI16 => Type::i16(ccx), ast::TyI32 => Type::i32(ccx), @@ -122,7 +122,7 @@ impl Type { pub fn uint_from_ty(ccx: &CrateContext, t: ast::UintTy) -> Type { match t { - ast::TyU => ccx.int_type(), + ast::TyUs => ccx.int_type(), ast::TyU8 => Type::i8(ccx), ast::TyU16 => Type::i16(ccx), ast::TyU32 => Type::i32(ccx), diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/trans/type_of.rs index 3e499ea8498f..d2f33c03ed54 100644 --- a/src/librustc_trans/trans/type_of.rs +++ b/src/librustc_trans/trans/type_of.rs @@ -264,7 +264,7 @@ pub fn type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Type { } match unsized_part_of_type(cx.tcx(), t).sty { - ty::ty_str | ty::ty_vec(..) => Type::uint_from_ty(cx, ast::TyU), + ty::ty_str | ty::ty_vec(..) => Type::uint_from_ty(cx, ast::TyUs), ty::ty_trait(_) => Type::vtable_ptr(cx), _ => panic!("Unexpected type returned from unsized_part_of_type : {}", t.repr(cx.tcx())) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 1b51434a58cc..7be383f2a026 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4859,7 +4859,7 @@ pub fn check_enum_variants(ccx: &CrateCtxt, ast::TyU16 => disr as u16 as Disr == disr, ast::TyU32 => disr as u32 as Disr == disr, ast::TyU64 => disr as u64 as Disr == disr, - ast::TyU => uint_in_range(ccx, ccx.tcx.sess.target.uint_type, disr) + ast::TyUs => uint_in_range(ccx, ccx.tcx.sess.target.uint_type, disr) } } fn int_in_range(ccx: &CrateCtxt, ty: ast::IntTy, disr: ty::Disr) -> bool { @@ -4868,7 +4868,7 @@ pub fn check_enum_variants(ccx: &CrateCtxt, ast::TyI16 => disr as i16 as Disr == disr, ast::TyI32 => disr as i32 as Disr == disr, ast::TyI64 => disr as i64 as Disr == disr, - ast::TyI => int_in_range(ccx, ccx.tcx.sess.target.int_type, disr) + ast::TyIs => int_in_range(ccx, ccx.tcx.sess.target.int_type, disr) } } match ty { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index bb9a9ac43034..60faa09b964d 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1238,8 +1238,8 @@ pub enum Type { #[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Copy)] pub enum PrimitiveType { - Int, I8, I16, I32, I64, - Uint, U8, U16, U32, U64, + Isize, I8, I16, I32, I64, + Usize, U8, U16, U32, U64, F32, F64, Char, Bool, @@ -1264,12 +1264,12 @@ pub enum TypeKind { impl PrimitiveType { fn from_str(s: &str) -> Option { match s.as_slice() { - "int" => Some(Int), + "isize" | "int" => Some(Isize), "i8" => Some(I8), "i16" => Some(I16), "i32" => Some(I32), "i64" => Some(I64), - "uint" => Some(Uint), + "usize" | "uint" => Some(Usize), "u8" => Some(U8), "u16" => Some(U16), "u32" => Some(U32), @@ -1308,12 +1308,12 @@ impl PrimitiveType { pub fn to_string(&self) -> &'static str { match *self { - Int => "int", + Isize => "isize", I8 => "i8", I16 => "i16", I32 => "i32", I64 => "i64", - Uint => "uint", + Usize => "usize", U8 => "u8", U16 => "u16", U32 => "u32", @@ -1387,12 +1387,12 @@ impl<'tcx> Clean for ty::Ty<'tcx> { match self.sty { ty::ty_bool => Primitive(Bool), ty::ty_char => Primitive(Char), - ty::ty_int(ast::TyI) => Primitive(Int), + ty::ty_int(ast::TyIs) => Primitive(Isize), ty::ty_int(ast::TyI8) => Primitive(I8), ty::ty_int(ast::TyI16) => Primitive(I16), ty::ty_int(ast::TyI32) => Primitive(I32), ty::ty_int(ast::TyI64) => Primitive(I64), - ty::ty_uint(ast::TyU) => Primitive(Uint), + ty::ty_uint(ast::TyUs) => Primitive(Usize), ty::ty_uint(ast::TyU8) => Primitive(U8), ty::ty_uint(ast::TyU16) => Primitive(U16), ty::ty_uint(ast::TyU32) => Primitive(U32), @@ -2265,12 +2265,12 @@ fn resolve_type(cx: &DocContext, ast::TyStr => return Primitive(Str), ast::TyBool => return Primitive(Bool), ast::TyChar => return Primitive(Char), - ast::TyInt(ast::TyI) => return Primitive(Int), + ast::TyInt(ast::TyIs) => return Primitive(Isize), ast::TyInt(ast::TyI8) => return Primitive(I8), ast::TyInt(ast::TyI16) => return Primitive(I16), ast::TyInt(ast::TyI32) => return Primitive(I32), ast::TyInt(ast::TyI64) => return Primitive(I64), - ast::TyUint(ast::TyU) => return Primitive(Uint), + ast::TyUint(ast::TyUs) => return Primitive(Usize), ast::TyUint(ast::TyU8) => return Primitive(U8), ast::TyUint(ast::TyU16) => return Primitive(U16), ast::TyUint(ast::TyU32) => return Primitive(U32), diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7aa7c4fcfb30..032ab05a418b 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1087,7 +1087,7 @@ pub struct Typedef { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub enum IntTy { - TyI, + TyIs, TyI8, TyI16, TyI32, @@ -1103,7 +1103,7 @@ impl fmt::Show for IntTy { impl IntTy { pub fn suffix_len(&self) -> uint { match *self { - TyI => 1, + TyIs => 1, TyI8 => 2, TyI16 | TyI32 | TyI64 => 3, } @@ -1112,7 +1112,7 @@ impl IntTy { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub enum UintTy { - TyU, + TyUs, TyU8, TyU16, TyU32, @@ -1122,7 +1122,7 @@ pub enum UintTy { impl UintTy { pub fn suffix_len(&self) -> uint { match *self { - TyU => 1, + TyUs => 1, TyU8 => 2, TyU16 | TyU32 | TyU64 => 3, } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 5e03afec16cf..d6df9f46621a 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -120,8 +120,8 @@ pub fn is_path(e: P) -> bool { /// We want to avoid "45int" and "-3int" in favor of "45" and "-3" pub fn int_ty_to_string(t: IntTy, val: Option) -> String { let s = match t { - TyI if val.is_some() => "i", - TyI => "int", + TyIs if val.is_some() => "is", + TyIs => "isize", TyI8 => "i8", TyI16 => "i16", TyI32 => "i32", @@ -141,7 +141,7 @@ pub fn int_ty_max(t: IntTy) -> u64 { match t { TyI8 => 0x80u64, TyI16 => 0x8000u64, - TyI | TyI32 => 0x80000000u64, // actually ni about TyI + TyIs | TyI32 => 0x80000000u64, // actually ni about TyIm TyI64 => 0x8000000000000000u64 } } @@ -150,8 +150,8 @@ pub fn int_ty_max(t: IntTy) -> u64 { /// We want to avoid "42uint" in favor of "42u" pub fn uint_ty_to_string(t: UintTy, val: Option) -> String { let s = match t { - TyU if val.is_some() => "u", - TyU => "uint", + TyUs if val.is_some() => "us", + TyUs => "usize", TyU8 => "u8", TyU16 => "u16", TyU32 => "u32", @@ -168,7 +168,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 { match t { TyU8 => 0xffu64, TyU16 => 0xffffu64, - TyU | TyU32 => 0xffffffffu64, // actually ni about TyU + TyUs | TyU32 => 0xffffffffu64, // actually ni about TyUm TyU64 => 0xffffffffffffffffu64 } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 43e23f26e930..523477eef22c 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -457,8 +457,10 @@ fn int_type_of_word(s: &str) -> Option { "u32" => Some(UnsignedInt(ast::TyU32)), "i64" => Some(SignedInt(ast::TyI64)), "u64" => Some(UnsignedInt(ast::TyU64)), - "int" => Some(SignedInt(ast::TyI)), - "uint" => Some(UnsignedInt(ast::TyU)), + "int" => Some(SignedInt(ast::TyIs)), + "uint" => Some(UnsignedInt(ast::TyUs)), + "isize" => Some(SignedInt(ast::TyIs)), + "usize" => Some(UnsignedInt(ast::TyUs)), _ => None } } @@ -502,7 +504,7 @@ impl IntType { SignedInt(ast::TyI16) | UnsignedInt(ast::TyU16) | SignedInt(ast::TyI32) | UnsignedInt(ast::TyU32) | SignedInt(ast::TyI64) | UnsignedInt(ast::TyU64) => true, - SignedInt(ast::TyI) | UnsignedInt(ast::TyU) => false + SignedInt(ast::TyIs) | UnsignedInt(ast::TyUs) => false } } } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index ea345f3a458f..843172cee19b 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -642,10 +642,10 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.expr(sp, ast::ExprLit(P(respan(sp, lit)))) } fn expr_uint(&self, span: Span, i: uint) -> P { - self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyU))) + self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs))) } fn expr_int(&self, sp: Span, i: int) -> P { - self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyI, ast::Sign::new(i)))) + self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs, ast::Sign::new(i)))) } fn expr_u8(&self, sp: Span, u: u8) -> P { self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU8))) diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 1aa430c4a082..1112eaa78902 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -1031,7 +1031,7 @@ impl<'a> MethodDef<'a> { let arms: Vec = variants.iter().enumerate() .map(|(index, variant)| { let pat = variant_to_pat(cx, sp, type_ident, &**variant); - let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyU)); + let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs)); cx.arm(sp, vec![pat], cx.expr_lit(sp, lit)) }).collect(); diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index f1b52fa33c38..ccc15449834c 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -273,13 +273,13 @@ pub mod rt { ); } - impl_to_source_int! { signed, int, TyI } + impl_to_source_int! { signed, int, TyIs } impl_to_source_int! { signed, i8, TyI8 } impl_to_source_int! { signed, i16, TyI16 } impl_to_source_int! { signed, i32, TyI32 } impl_to_source_int! { signed, i64, TyI64 } - impl_to_source_int! { unsigned, uint, TyU } + impl_to_source_int! { unsigned, uint, TyUs } impl_to_source_int! { unsigned, u8, TyU8 } impl_to_source_int! { unsigned, u16, TyU16 } impl_to_source_int! { unsigned, u32, TyU32 } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index b0969a573e66..c26613b4d6cb 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -701,12 +701,14 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) -> if let Some(suf) = suffix { if suf.is_empty() { sd.span_bug(sp, "found empty literal suffix in Some")} ty = match suf { - "i" => ast::SignedIntLit(ast::TyI, ast::Plus), + "i" => ast::SignedIntLit(ast::TyIs, ast::Plus), + "is" => ast::SignedIntLit(ast::TyIs, ast::Plus), "i8" => ast::SignedIntLit(ast::TyI8, ast::Plus), "i16" => ast::SignedIntLit(ast::TyI16, ast::Plus), "i32" => ast::SignedIntLit(ast::TyI32, ast::Plus), "i64" => ast::SignedIntLit(ast::TyI64, ast::Plus), - "u" => ast::UnsignedIntLit(ast::TyU), + "u" => ast::UnsignedIntLit(ast::TyUs), + "us" => ast::UnsignedIntLit(ast::TyUs), "u8" => ast::UnsignedIntLit(ast::TyU8), "u16" => ast::UnsignedIntLit(ast::TyU16), "u32" => ast::UnsignedIntLit(ast::TyU32), diff --git a/src/test/run-fail/assert-as-macro.rs b/src/test/run-fail/assert-as-macro.rs index fb069e61bd2a..59e79fe9266f 100644 --- a/src/test/run-fail/assert-as-macro.rs +++ b/src/test/run-fail/assert-as-macro.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:assertion failed: 1i == 2 +// error-pattern:assertion failed: 1is == 2 fn main() { - assert!(1i == 2); + assert!(1is == 2); } diff --git a/src/test/run-fail/panic.rs b/src/test/run-fail/panic.rs index 54ccc98bcd92..dd4c58f176c8 100644 --- a/src/test/run-fail/panic.rs +++ b/src/test/run-fail/panic.rs @@ -8,8 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - - -// error-pattern:1i == 2 -fn main() { assert!((1i == 2)); } +// error-pattern:1is == 2 +fn main() { assert!((1is == 2)); } diff --git a/src/test/run-pass/tydesc-name.rs b/src/test/run-pass/tydesc-name.rs index 4f473755cb6c..e3b148ac92db 100644 --- a/src/test/run-pass/tydesc-name.rs +++ b/src/test/run-pass/tydesc-name.rs @@ -17,7 +17,7 @@ struct Foo { pub fn main() { unsafe { - assert_eq!((*get_tydesc::()).name, "int"); - assert_eq!((*get_tydesc::>()).name, "Foo"); + assert_eq!((*get_tydesc::()).name, "isize"); + assert_eq!((*get_tydesc::>()).name, "Foo"); } }