From 1f70acbf4c4f345265a7626bd927187d3bfed91f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 7 Jan 2015 15:48:16 -0800 Subject: Improvements to feature staging This gets rid of the 'experimental' level, removes the non-staged_api case (i.e. stability levels for out-of-tree crates), and lets the staged_api attributes use 'unstable' and 'deprecated' lints. This makes the transition period to the full feature staging design a bit nicer. --- src/libsyntax/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 1efd6a87f86..eb6a2a43d43 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -15,7 +15,7 @@ //! This API is completely unstable and subject to change. #![crate_name = "syntax"] -#![experimental] +#![unstable] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] -- cgit 1.4.1-3-g733a5 From 0d0869ad738c1961ebbe75412303d360c7e951ba Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Thu, 8 Jan 2015 12:01:48 +0100 Subject: Remove the deprecated opt_out_copy feature --- src/librustc/middle/traits/select.rs | 23 ++-------------- src/libsyntax/feature_gate.rs | 5 +--- src/test/compile-fail/opt-out-copy-bad.rs | 44 ----------------------------- src/test/run-pass/opt-out-copy.rs | 46 ------------------------------- 4 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 src/test/compile-fail/opt-out-copy-bad.rs delete mode 100644 src/test/run-pass/opt-out-copy.rs (limited to 'src/libsyntax') diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index f42f43d2576..dad74612369 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -713,12 +713,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { debug!("obligation self ty is {}", obligation.predicate.0.self_ty().repr(self.tcx())); - // If the user has asked for the older, compatibility - // behavior, ignore user-defined impls here. This will - // go away by the time 1.0 is released. - if !self.tcx().sess.features.borrow().opt_out_copy { - try!(self.assemble_candidates_from_impls(obligation, &mut candidates.vec)); - } + try!(self.assemble_candidates_from_impls(obligation, &mut candidates.vec)); try!(self.assemble_builtin_bound_candidates(ty::BoundCopy, stack, @@ -1505,21 +1500,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } ty::BoundCopy => { - // This is an Opt-In Built-In Trait. So, unless - // the user is asking for the old behavior, we - // don't supply any form of builtin impl. - if !this.tcx().sess.features.borrow().opt_out_copy { - return Ok(ParameterBuiltin) - } else { - // Older, backwards compatibility behavior: - if - Some(def_id) == tcx.lang_items.no_copy_bound() || - Some(def_id) == tcx.lang_items.managed_bound() || - ty::has_dtor(tcx, def_id) - { - return Err(Unimplemented); - } - } + return Ok(ParameterBuiltin) } ty::BoundSync => { diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 2cfcd38d48f..9f023be4a53 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -82,7 +82,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("issue_5723_bootstrap", Accepted), // A way to temporarily opt out of opt in copy. This will *never* be accepted. - ("opt_out_copy", Deprecated), + ("opt_out_copy", Removed), // A way to temporarily opt out of the new orphan rules. This will *never* be accepted. ("old_orphan_check", Deprecated), @@ -123,7 +123,6 @@ pub struct Features { pub import_shadowing: bool, pub visible_private_types: bool, pub quote: bool, - pub opt_out_copy: bool, pub old_orphan_check: bool, } @@ -135,7 +134,6 @@ impl Features { import_shadowing: false, visible_private_types: false, quote: false, - opt_out_copy: false, old_orphan_check: false, } } @@ -465,7 +463,6 @@ fn check_crate_inner(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C import_shadowing: cx.has_feature("import_shadowing"), visible_private_types: cx.has_feature("visible_private_types"), quote: cx.has_feature("quote"), - opt_out_copy: cx.has_feature("opt_out_copy"), old_orphan_check: cx.has_feature("old_orphan_check"), }, unknown_features) diff --git a/src/test/compile-fail/opt-out-copy-bad.rs b/src/test/compile-fail/opt-out-copy-bad.rs deleted file mode 100644 index 9e425fa8f2e..00000000000 --- a/src/test/compile-fail/opt-out-copy-bad.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(opt_out_copy)] -//~^ WARNING feature is deprecated -//~| WARNING feature is deprecated - -// Test that when using the `opt-out-copy` feature we still consider -// destructors to be non-movable - -struct CantCopyThis; - -impl Drop for CantCopyThis { - fn drop(&mut self) { } -} - -struct IWantToCopyThis { - but_i_cant: CantCopyThis, -} - -impl Copy for IWantToCopyThis {} -//~^ ERROR the trait `Copy` may not be implemented for this type - -enum CantCopyThisEither { - A, - B(::std::marker::NoCopy), -} - -enum IWantToCopyThisToo { - ButICant(CantCopyThisEither), -} - -impl Copy for IWantToCopyThisToo {} -//~^ ERROR the trait `Copy` may not be implemented for this type - -fn main() {} - diff --git a/src/test/run-pass/opt-out-copy.rs b/src/test/run-pass/opt-out-copy.rs deleted file mode 100644 index 8c7072cfdf5..00000000000 --- a/src/test/run-pass/opt-out-copy.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(opt_out_copy)] - -// Test the opt-out-copy feature guard. This is the same as the -// "opt-in-copy.rs" test from compile-fail, except that it is using -// the feature guard, and hence the structureds in this file are -// implicitly copyable, and hence we get no errors. This test can be -// safely removed once the opt-out-copy "feature" is rejected. - -struct CantCopyThis; - -struct IWantToCopyThis { - but_i_cant: CantCopyThis, -} - -impl Copy for IWantToCopyThis {} - -enum CantCopyThisEither { - A, - B, -} - -enum IWantToCopyThisToo { - ButICant(CantCopyThisEither), -} - -impl Copy for IWantToCopyThisToo {} - -fn is_copy() { } - -fn main() { - is_copy::(); - is_copy::(); - is_copy::(); - is_copy::(); -} - -- cgit 1.4.1-3-g733a5 From e95779554e9d6fc111102df7af80b40f8e22cfae Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 8 Jan 2015 20:13:14 +1100 Subject: Store deprecated status of i/u-suffixed literals. --- src/librustc/lint/builtin.rs | 16 +++++------ src/librustc/metadata/tyencode.rs | 4 +-- src/librustc/middle/const_eval.rs | 4 +-- src/librustc/middle/ty.rs | 14 +++++----- src/librustc_resolve/lib.rs | 8 +++--- src/librustc_trans/trans/base.rs | 4 +-- src/librustc_trans/trans/debuginfo.rs | 8 +++--- src/librustc_trans/trans/type_.rs | 4 +-- src/librustc_trans/trans/type_of.rs | 2 +- src/librustc_typeck/check/mod.rs | 6 ++--- src/librustdoc/clean/mod.rs | 8 +++--- src/libsyntax/ast.rs | 44 +++++++++++++++++++++++++------ src/libsyntax/ast_util.rs | 16 ++++++----- src/libsyntax/attr.rs | 10 +++---- src/libsyntax/ext/build.rs | 5 ++-- src/libsyntax/ext/deriving/generic/mod.rs | 2 +- src/libsyntax/ext/quote.rs | 28 ++++++++++---------- src/libsyntax/parse/mod.rs | 8 +++--- 18 files changed, 112 insertions(+), 79 deletions(-) (limited to 'src/libsyntax') diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 7d893f3a106..9795947ac81 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -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::TyIs { + let int_type = if let ast::TyIs(_) = t { 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::TyUs { + let uint_type = if let ast::TyUs(_) = t { 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::TyIs=> (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::TyUs=> (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::TyIs=> 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::TyUs=> 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,12 +404,12 @@ 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::TyIs)) => { + def::DefPrimTy(ast::TyInt(ast::TyIs(_))) => { self.cx.span_lint(IMPROPER_CTYPES, sp, "found rust type `isize` in foreign module, while \ libc::c_int or libc::c_long should be used"); } - def::DefPrimTy(ast::TyUint(ast::TyUs)) => { + def::DefPrimTy(ast::TyUint(ast::TyUs(_))) => { self.cx.span_lint(IMPROPER_CTYPES, sp, "found rust type `usize` in foreign module, while \ libc::c_uint or libc::c_ulong should be used"); diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index c019d129218..bdd08ad6c49 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::TyIs => mywrite!(w, "is"), + 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::TyUs => mywrite!(w, "us"), + 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 04d4b41b21a..52352e920ce 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::TyUs) => (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 64f0bcb1c88..2534232960f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2341,12 +2341,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::TyIs)), + 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::TyUs)), + 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)), @@ -2692,7 +2692,7 @@ impl FlagComputation { pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> { match tm { - ast::TyIs => tcx.types.int, + ast::TyIs(_) => tcx.types.int, ast::TyI8 => tcx.types.i8, ast::TyI16 => tcx.types.i16, ast::TyI32 => tcx.types.i32, @@ -2702,7 +2702,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::TyUs => tcx.types.uint, + ast::TyUs(_) => tcx.types.uint, ast::TyU8 => tcx.types.u8, ast::TyU16 => tcx.types.u16, ast::TyU32 => tcx.types.u32, @@ -3363,7 +3363,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::TyUs) | ty_int(ast::TyIs) => { + ty_uint(ast::TyUs(_)) | ty_int(ast::TyIs(_)) => { TC::ReachesFfiUnsafe } @@ -3937,7 +3937,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::TyUs) => true, + ty_infer(IntVar(_)) | ty_uint(ast::TyUs(_)) => true, _ => false } } @@ -3983,7 +3983,7 @@ pub fn type_is_signed(ty: Ty) -> bool { pub fn type_is_machine(ty: Ty) -> bool { match ty.sty { - ty_int(ast::TyIs) | ty_uint(ast::TyUs) => 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 a1ae96490ca..88f0abf3ca7 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -819,15 +819,15 @@ impl PrimitiveTypeTable { table.intern("char", TyChar); table.intern("f32", TyFloat(TyF32)); table.intern("f64", TyFloat(TyF64)); - table.intern("int", TyInt(TyIs)); - table.intern("isize", TyInt(TyIs)); + table.intern("int", TyInt(TyIs(true))); + table.intern("isize", TyInt(TyIs(false))); 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(TyUs)); - table.intern("usize", TyUint(TyUs)); + table.intern("uint", TyUint(TyUs(true))); + table.intern("usize", TyUint(TyUs(false))); 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 74071a1de4c..88ce36a710a 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -917,8 +917,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::TyIs if llty == Type::i32(cx.ccx()) => i32::MIN as u64, - ast::TyIs => 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 3a6f4b47e4e..2f58baab7fc 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -1804,14 +1804,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::TyIs => ("isize".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::TyUs => ("usize".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), @@ -3739,12 +3739,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::TyIs) => output.push_str("isize"), + 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::TyUs) => output.push_str("usize"), + 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 e2ed275d4c0..71a7789eb39 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::TyIs => 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::TyUs => 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 034a1ee8be5..416dfb420ff 100644 --- a/src/librustc_trans/trans/type_of.rs +++ b/src/librustc_trans/trans/type_of.rs @@ -263,7 +263,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::TyUs), + 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 b98b327100c..f3778eb0540 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2442,7 +2442,7 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, // First, try built-in indexing. match (ty::index(adjusted_ty), &index_ty.sty) { - (Some(ty), &ty::ty_uint(ast::TyUs)) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => { + (Some(ty), &ty::ty_uint(ast::TyUs(_))) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => { debug!("try_index_step: success, using built-in indexing"); fcx.write_adjustment(base_expr.id, base_expr.span, ty::AdjustDerefRef(adjustment)); return Some((tcx.types.uint, ty)); @@ -4770,7 +4770,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::TyUs => 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 { @@ -4779,7 +4779,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::TyIs => 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 fbb3c40ee99..a44c73e8c41 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1389,12 +1389,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::TyIs) => Primitive(Isize), + 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::TyUs) => Primitive(Usize), + 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), @@ -2269,12 +2269,12 @@ fn resolve_type(cx: &DocContext, ast::TyStr => return Primitive(Str), ast::TyBool => return Primitive(Bool), ast::TyChar => return Primitive(Char), - ast::TyInt(ast::TyIs) => return Primitive(Isize), + 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::TyUs) => return Primitive(Usize), + 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 0a9e0aedd3d..630f7768885 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1075,15 +1075,29 @@ pub struct Typedef { pub typ: P, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub enum IntTy { - TyIs, + TyIs(bool /* is this deprecated `int`? */), TyI8, TyI16, TyI32, TyI64, } +impl PartialEq for IntTy { + fn eq(&self, other: &IntTy) -> bool { + match (*self, *other) { + // true/false need to compare the same, so this can't be derived + (TyIs(_), TyIs(_)) | + (TyI8, TyI8) | + (TyI16, TyI16) | + (TyI32, TyI32) | + (TyI64, TyI64) => true, + _ => false + } + } +} + impl fmt::Show for IntTy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::String::fmt(self, f) @@ -1099,27 +1113,41 @@ impl fmt::String for IntTy { impl IntTy { pub fn suffix_len(&self) -> uint { match *self { - TyIs => 1, - TyI8 => 2, + TyIs(true) /* i */ => 1, + TyIs(false) /* is */ | TyI8 => 2, TyI16 | TyI32 | TyI64 => 3, } } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub enum UintTy { - TyUs, + TyUs(bool /* is this deprecated uint? */), TyU8, TyU16, TyU32, TyU64, } +impl PartialEq for UintTy { + fn eq(&self, other: &UintTy) -> bool { + match (*self, *other) { + // true/false need to compare the same, so this can't be derived + (TyUs(_), TyUs(_)) | + (TyU8, TyU8) | + (TyU16, TyU16) | + (TyU32, TyU32) | + (TyU64, TyU64) => true, + _ => false + } + } +} + impl UintTy { pub fn suffix_len(&self) -> uint { match *self { - TyUs => 1, - TyU8 => 2, + TyUs(true) /* u */ => 1, + TyUs(false) /* us */ | TyU8 => 2, TyU16 | TyU32 | TyU64 => 3, } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index b4e917e28cb..bc7fbd46fd8 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -127,8 +127,10 @@ 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 { - TyIs if val.is_some() => "is", - TyIs => "isize", + TyIs(true) if val.is_some() => "i", + TyIs(true) => "int", + TyIs(false) if val.is_some() => "is", + TyIs(false) => "isize", TyI8 => "i8", TyI16 => "i16", TyI32 => "i32", @@ -148,7 +150,7 @@ pub fn int_ty_max(t: IntTy) -> u64 { match t { TyI8 => 0x80u64, TyI16 => 0x8000u64, - TyIs | TyI32 => 0x80000000u64, // actually ni about TyIs + TyIs(_) | TyI32 => 0x80000000u64, // actually ni about TyIs TyI64 => 0x8000000000000000u64 } } @@ -157,8 +159,10 @@ 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 { - TyUs if val.is_some() => "us", - TyUs => "usize", + TyUs(true) if val.is_some() => "u", + TyUs(true) => "uint", + TyUs(false) if val.is_some() => "us", + TyUs(false) => "usize", TyU8 => "u8", TyU16 => "u16", TyU32 => "u32", @@ -175,7 +179,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 { match t { TyU8 => 0xffu64, TyU16 => 0xffffu64, - TyUs | TyU32 => 0xffffffffu64, // actually ni about TyUs + TyUs(_) | TyU32 => 0xffffffffu64, // actually ni about TyUs TyU64 => 0xffffffffffffffffu64 } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 2cea55dfc55..6f57c06d33e 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -464,10 +464,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::TyIs)), - "uint" => Some(UnsignedInt(ast::TyUs)), - "isize" => Some(SignedInt(ast::TyIs)), - "usize" => Some(UnsignedInt(ast::TyUs)), + "int" => Some(SignedInt(ast::TyIs(true))), + "uint" => Some(UnsignedInt(ast::TyUs(true))), + "isize" => Some(SignedInt(ast::TyIs(false))), + "usize" => Some(UnsignedInt(ast::TyUs(false))), _ => None } } @@ -511,7 +511,7 @@ impl IntType { SignedInt(ast::TyI16) | UnsignedInt(ast::TyU16) | SignedInt(ast::TyI32) | UnsignedInt(ast::TyU32) | SignedInt(ast::TyI64) | UnsignedInt(ast::TyU64) => true, - SignedInt(ast::TyIs) | UnsignedInt(ast::TyUs) => false + SignedInt(ast::TyIs(_)) | UnsignedInt(ast::TyUs(_)) => false } } } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 27523ea4535..c34142aec39 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -642,10 +642,11 @@ 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::TyUs))) + self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs(false)))) } fn expr_int(&self, sp: Span, i: int) -> P { - self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs, ast::Sign::new(i)))) + self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs(false), + 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 47b29a4db3e..e6b6f7bbd49 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::TyUs)); + let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs(false))); 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 2dbf29c145c..c42b188302c 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -244,10 +244,10 @@ pub mod rt { } macro_rules! impl_to_source_int { - (signed, $t:ty, $tag:ident) => ( + (signed, $t:ty, $tag:expr) => ( impl ToSource for $t { fn to_source(&self) -> String { - let lit = ast::LitInt(*self as u64, ast::SignedIntLit(ast::$tag, + let lit = ast::LitInt(*self as u64, ast::SignedIntLit($tag, ast::Sign::new(*self))); pprust::lit_to_string(&dummy_spanned(lit)) } @@ -258,10 +258,10 @@ pub mod rt { } } ); - (unsigned, $t:ty, $tag:ident) => ( + (unsigned, $t:ty, $tag:expr) => ( impl ToSource for $t { fn to_source(&self) -> String { - let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit(ast::$tag)); + let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit($tag)); pprust::lit_to_string(&dummy_spanned(lit)) } } @@ -273,17 +273,17 @@ pub mod rt { ); } - 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! { signed, int, ast::TyIs(false) } + impl_to_source_int! { signed, i8, ast::TyI8 } + impl_to_source_int! { signed, i16, ast::TyI16 } + impl_to_source_int! { signed, i32, ast::TyI32 } + impl_to_source_int! { signed, i64, ast::TyI64 } - 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 } - impl_to_source_int! { unsigned, u64, TyU64 } + impl_to_source_int! { unsigned, uint, ast::TyUs(false) } + impl_to_source_int! { unsigned, u8, ast::TyU8 } + impl_to_source_int! { unsigned, u16, ast::TyU16 } + impl_to_source_int! { unsigned, u32, ast::TyU32 } + impl_to_source_int! { unsigned, u64, ast::TyU64 } // Alas ... we write these out instead. All redundant. diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index c42a6beea2d..f1f547ba0c7 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -702,14 +702,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::TyIs, ast::Plus), - "is" => ast::SignedIntLit(ast::TyIs, ast::Plus), + "i" => ast::SignedIntLit(ast::TyIs(true), ast::Plus), + "is" => ast::SignedIntLit(ast::TyIs(false), 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::TyUs), - "us" => ast::UnsignedIntLit(ast::TyUs), + "u" => ast::UnsignedIntLit(ast::TyUs(true)), + "us" => ast::UnsignedIntLit(ast::TyUs(false)), "u8" => ast::UnsignedIntLit(ast::TyU8), "u16" => ast::UnsignedIntLit(ast::TyU16), "u32" => ast::UnsignedIntLit(ast::TyU32), -- cgit 1.4.1-3-g733a5 From d12514bc589c1955108d517acd6d5952929b1650 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 8 Jan 2015 21:16:35 +1100 Subject: Add a warning feature gate for int/uint in types and i/u suffixes. --- src/librustc/middle/ty.rs | 4 +- src/librustc_trans/trans/type_of.rs | 2 +- src/libsyntax/feature_gate.rs | 55 ++++++++++++++++++++++++++ src/test/compile-fail/feature-gate-int-uint.rs | 35 ++++++++++++++++ 4 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 src/test/compile-fail/feature-gate-int-uint.rs (limited to 'src/libsyntax') diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 2534232960f..ef86e67de16 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2341,12 +2341,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::TyIs(_))), + int: intern_ty(arena, interner, ty_int(ast::TyIs(false))), 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::TyUs(_))), + uint: intern_ty(arena, interner, ty_uint(ast::TyUs(false))), 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)), diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/trans/type_of.rs index 416dfb420ff..99330797422 100644 --- a/src/librustc_trans/trans/type_of.rs +++ b/src/librustc_trans/trans/type_of.rs @@ -263,7 +263,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::TyUs(_)), + ty::ty_str | ty::ty_vec(..) => Type::uint_from_ty(cx, ast::TyUs(false)), ty::ty_trait(_) => Type::vtable_ptr(cx), _ => panic!("Unexpected type returned from unsized_part_of_type : {}", t.repr(cx.tcx())) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 2cfcd38d48f..6deffa804b2 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -93,6 +93,9 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ // OIBIT specific features ("optin_builtin_traits", Active), + // int and uint are now deprecated + ("int_uint", Active), + // These are used to test this portion of the compiler, they don't actually // mean anything ("test_accepted_feature", Accepted), @@ -157,6 +160,14 @@ impl<'a> Context<'a> { } } + fn warn_feature(&self, feature: &str, span: Span, explain: &str) { + if !self.has_feature(feature) { + self.span_handler.span_warn(span, explain); + self.span_handler.span_help(span, &format!("add #![feature({})] to the \ + crate attributes to silence this warning", + feature)[]); + } + } fn has_feature(&self, feature: &str) -> bool { self.features.iter().any(|&n| n == feature) } @@ -334,6 +345,31 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { } fn visit_ty(&mut self, t: &ast::Ty) { + match t.node { + ast::TyPath(ref p, _) => { + match &*p.segments { + + [ast::PathSegment { identifier, .. }] => { + let name = token::get_ident(identifier); + let msg = if name == "int" { + Some("the `int` type is deprecated; \ + use `isize` or a fixed-sized integer") + } else if name == "uint" { + Some("the `unt` type is deprecated; \ + use `usize` or a fixed-sized integer") + } else { + None + }; + + if let Some(msg) = msg { + self.context.warn_feature("int_uint", t.span, msg) + } + } + _ => {} + } + } + _ => {} + } visit::walk_ty(self, t); } @@ -345,6 +381,25 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { "box expression syntax is experimental in alpha release; \ you can call `Box::new` instead."); } + ast::ExprLit(ref lit) => { + match lit.node { + ast::LitInt(_, ty) => { + let msg = if let ast::SignedIntLit(ast::TyIs(true), _) = ty { + Some("the `i` suffix on integers is deprecated; use `is` \ + or one of the fixed-sized suffixes") + } else if let ast::UnsignedIntLit(ast::TyUs(true)) = ty { + Some("the `u` suffix on integers is deprecated; use `us` \ + or one of the fixed-sized suffixes") + } else { + None + }; + if let Some(msg) = msg { + self.context.warn_feature("int_uint", e.span, msg); + } + } + _ => {} + } + } _ => {} } visit::walk_expr(self, e); diff --git a/src/test/compile-fail/feature-gate-int-uint.rs b/src/test/compile-fail/feature-gate-int-uint.rs new file mode 100644 index 00000000000..78b931b383f --- /dev/null +++ b/src/test/compile-fail/feature-gate-int-uint.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +mod u { + type X = uint; //~ WARN the `uint` type is deprecated + struct Foo { + x: uint //~ WARN the `uint` type is deprecated + } + fn bar(x: uint) { //~ WARN the `uint` type is deprecated + 1u; //~ WARN the `u` suffix on integers is deprecated + } +} +mod i { + type X = int; //~ WARN the `int` type is deprecated + struct Foo { + x: int //~ WARN the `int` type is deprecated + } + fn bar(x: int) { //~ WARN the `int` type is deprecated + 1i; //~ WARN the `u` suffix on integers is deprecated + } +} + +fn main() { + // make compilation fail, after feature gating + let () = 1u8; //~ ERROR +} -- cgit 1.4.1-3-g733a5 From 4f5a57e80ef6c029278f1e8ef59e13dcea9b255b Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 8 Jan 2015 21:45:49 +1100 Subject: Remove warning from the libraries. This adds the int_uint feature to *every* library, whether or not it needs it. --- src/compiletest/compiletest.rs | 1 + src/liballoc/lib.rs | 1 + src/libarena/lib.rs | 1 + src/libcollections/lib.rs | 1 + src/libcore/lib.rs | 3 ++- src/libcore/macros.rs | 4 ++-- src/libcoretest/lib.rs | 1 + src/libflate/lib.rs | 1 + src/libfmt_macros/lib.rs | 1 + src/libgetopts/lib.rs | 1 + src/libgraphviz/lib.rs | 1 + src/liblibc/lib.rs | 1 + src/liblog/lib.rs | 1 + src/librand/lib.rs | 2 +- src/librbml/lib.rs | 1 + src/libregex/lib.rs | 1 + src/librustc/lib.rs | 1 + src/librustc_back/lib.rs | 1 + src/librustc_borrowck/lib.rs | 1 + src/librustc_driver/lib.rs | 1 + src/librustc_llvm/lib.rs | 1 + src/librustc_resolve/lib.rs | 1 + src/librustc_trans/lib.rs | 1 + src/librustc_typeck/lib.rs | 1 + src/librustdoc/lib.rs | 1 + src/libserialize/lib.rs | 1 + src/libstd/lib.rs | 1 + src/libstd/macros.rs | 8 ++++---- src/libsyntax/lib.rs | 1 + src/libterm/lib.rs | 1 + src/libtest/lib.rs | 1 + src/libunicode/lib.rs | 1 + 32 files changed, 37 insertions(+), 8 deletions(-) (limited to 'src/libsyntax') diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 9a5665e6839..802fb05796d 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -12,6 +12,7 @@ #![allow(unknown_features)] #![feature(slicing_syntax, unboxed_closures)] #![feature(box_syntax)] +#![feature(int_uint)] #![deny(warnings)] diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 0bb8ba669ec..3fbb063b340 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -68,6 +68,7 @@ #![allow(unknown_features)] #![feature(lang_items, unsafe_destructor)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] #[macro_use] extern crate core; diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index f208ff9dc05..e6ceab4c4d4 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -32,6 +32,7 @@ #![feature(unsafe_destructor)] #![feature(unboxed_closures)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] #![allow(missing_docs)] extern crate alloc; diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 7692c1558a7..a651d8a9d76 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -27,6 +27,7 @@ #![feature(box_syntax)] #![feature(unboxed_closures)] #![feature(old_impl_check)] +#![allow(unknown_features)] #![feature(int_uint)] #![no_std] #[macro_use] diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index af5aba53bf4..39aaca93f1b 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -59,9 +59,10 @@ #![no_std] #![allow(unknown_features, raw_pointer_derive)] #![cfg_attr(stage0, allow(unused_attributes))] -#![feature(intrinsics, lang_items)] +#![allow(unknown_features)] #![feature(intrinsics, lang_items)] #![feature(simd, unsafe_destructor, slicing_syntax)] #![feature(unboxed_closures)] +#![allow(unknown_features)] #![feature(int_uint)] #![deny(missing_docs)] #[macro_use] diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index bfe88fff22f..f6415518864 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -15,7 +15,7 @@ macro_rules! panic { panic!("explicit panic") ); ($msg:expr) => ({ - static _MSG_FILE_LINE: (&'static str, &'static str, uint) = ($msg, file!(), line!()); + static _MSG_FILE_LINE: (&'static str, &'static str, usize) = ($msg, file!(), line!()); ::core::panicking::panic(&_MSG_FILE_LINE) }); ($fmt:expr, $($arg:tt)*) => ({ @@ -23,7 +23,7 @@ macro_rules! panic { // used inside a dead function. Just `#[allow(dead_code)]` is // insufficient, since the user may have // `#[forbid(dead_code)]` and which cannot be overridden. - static _FILE_LINE: (&'static str, uint) = (file!(), line!()); + static _FILE_LINE: (&'static str, usize) = (file!(), line!()); ::core::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_FILE_LINE) }); } diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index c12981b7d24..0d371dbe153 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -11,6 +11,7 @@ #![feature(unsafe_destructor, slicing_syntax)] #![feature(unboxed_closures)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate core; extern crate test; diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 1896bdd182a..fda52cebf75 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -17,6 +17,7 @@ #![crate_name = "flate"] #![experimental] #![staged_api] +#![allow(unknown_features)] #![feature(int_uint)] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 02eea5d024c..4ec5969a6d7 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -25,6 +25,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(slicing_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] pub use self::Piece::*; pub use self::Position::*; diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 1d6c99542b5..10d514fee8c 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -87,6 +87,7 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] #![feature(slicing_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] #![deny(missing_docs)] #[cfg(test)] #[macro_use] extern crate log; diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 9d2318e253e..268dfdc00f9 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -273,6 +273,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(slicing_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] use self::LabelText::*; diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index c39fd074387..dfa7f5cc754 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -12,6 +12,7 @@ #![crate_type = "rlib"] #![cfg_attr(not(feature = "cargo-build"), experimental)] #![cfg_attr(not(feature = "cargo-build"), staged_api)] +#![allow(unknown_features)] #![feature(int_uint)] #![no_std] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 0d5f6b65827..ef7c6f5f311 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -168,6 +168,7 @@ #![allow(unknown_features)] #![feature(slicing_syntax)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] #![deny(missing_docs)] extern crate regex; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 497e339b316..d7caa4158dd 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -22,7 +22,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] - +#![allow(unknown_features)] #![feature(int_uint)] #![no_std] #![experimental] #![staged_api] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index da803aa5011..4a28316fbea 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -26,6 +26,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] #![feature(slicing_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate serialize; #[macro_use] extern crate log; diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index d19ce3b460a..4fd4531a92b 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -26,6 +26,7 @@ #![allow(unknown_features)] #![feature(slicing_syntax)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] #![deny(missing_docs)] #[cfg(test)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index e0143917a7c..283e32e8802 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -27,6 +27,7 @@ #![feature(quote)] #![feature(slicing_syntax, unsafe_destructor)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] #![feature(rustc_diagnostic_macros)] #![feature(old_impl_check)] diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index fcd20158c0a..d07a11b8a6a 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -31,6 +31,7 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![allow(unknown_features)] #![feature(slicing_syntax, box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate syntax; extern crate serialize; diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 452eaaaa52d..0b96171548a 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -21,6 +21,7 @@ #![feature(quote)] #![feature(slicing_syntax, unsafe_destructor)] #![feature(rustc_diagnostic_macros)] +#![allow(unknown_features)] #![feature(int_uint)] #![allow(non_camel_case_types)] #[macro_use] extern crate log; diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 27e1eaacdfd..7617027dfd1 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -28,6 +28,7 @@ #![feature(slicing_syntax, unsafe_destructor)] #![feature(box_syntax)] #![feature(rustc_diagnostic_macros)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate arena; extern crate flate; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 4a281c413d6..2895defdd6f 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -25,6 +25,7 @@ #![allow(unknown_features)] #![feature(link_args)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate libc; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 88f0abf3ca7..edd67590e0c 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -19,6 +19,7 @@ #![feature(slicing_syntax)] #![feature(rustc_diagnostic_macros)] +#![allow(unknown_features)] #![feature(int_uint)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 5da51697d2f..b317cdc4dca 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -28,6 +28,7 @@ #![feature(slicing_syntax, unsafe_destructor)] #![feature(box_syntax)] #![feature(rustc_diagnostic_macros)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate arena; extern crate flate; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 76ac4b2e8af..e39d7186fa1 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -77,6 +77,7 @@ This API is completely unstable and subject to change. #![feature(slicing_syntax, unsafe_destructor)] #![feature(box_syntax)] #![feature(rustc_diagnostic_macros)] +#![allow(unknown_features)] #![feature(int_uint)] #![allow(non_camel_case_types)] #[macro_use] extern crate log; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 56f5c23f6f1..e0b0274b7c4 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -19,6 +19,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(slicing_syntax)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate arena; extern crate getopts; diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index b3c4cec2ef1..942a8cfa2c5 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -28,6 +28,7 @@ Core encoding and decoding interfaces. #![feature(box_syntax)] #![feature(old_impl_check)] #![feature(slicing_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] // test harness access #[cfg(test)] extern crate test; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 71221a654e8..dc157c7d676 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -110,6 +110,7 @@ #![feature(slicing_syntax, unboxed_closures)] #![feature(box_syntax)] #![feature(old_impl_check)] +#![allow(unknown_features)] #![feature(int_uint)] // Don't link to std. We are std. #![no_std] diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 0594b711ad6..6e7599b7b8f 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -44,7 +44,7 @@ macro_rules! panic { ($msg:expr) => ({ $crate::rt::begin_unwind($msg, { // static requires less code at runtime, more constant data - static _FILE_LINE: (&'static str, uint) = (file!(), line!()); + static _FILE_LINE: (&'static str, usize) = (file!(), line!()); &_FILE_LINE }) }); @@ -54,7 +54,7 @@ macro_rules! panic { // used inside a dead function. Just `#[allow(dead_code)]` is // insufficient, since the user may have // `#[forbid(dead_code)]` and which cannot be overridden. - static _FILE_LINE: (&'static str, uint) = (file!(), line!()); + static _FILE_LINE: (&'static str, usize) = (file!(), line!()); &_FILE_LINE }) }); @@ -466,7 +466,7 @@ pub mod builtin { /// A macro which expands to the line number on which it was invoked. /// - /// The expanded expression has type `uint`, and the returned line is not + /// The expanded expression has type `usize`, and the returned line is not /// the invocation of the `line!()` macro itself, but rather the first macro /// invocation leading up to the invocation of the `line!()` macro. /// @@ -481,7 +481,7 @@ pub mod builtin { /// A macro which expands to the column number on which it was invoked. /// - /// The expanded expression has type `uint`, and the returned column is not + /// The expanded expression has type `usize`, and the returned column is not /// the invocation of the `column!()` macro itself, but rather the first macro /// invocation leading up to the invocation of the `column!()` macro. /// diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 1efd6a87f86..4bbc8a40a9e 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -27,6 +27,7 @@ #![feature(slicing_syntax)] #![feature(box_syntax)] #![feature(quote, unsafe_destructor)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate arena; extern crate fmt_macros; diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index b4f224cb4a7..6db07b9c87c 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -51,6 +51,7 @@ #![allow(unknown_features)] #![feature(slicing_syntax)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] #![deny(missing_docs)] #[macro_use] extern crate log; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index d04308814f8..ec01b535bfd 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -34,6 +34,7 @@ #![allow(unknown_features)] #![feature(asm, slicing_syntax)] #![feature(box_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate getopts; extern crate regex; diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 27255cc33ee..6c95d6ef2a6 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -30,6 +30,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![no_std] #![feature(slicing_syntax)] +#![allow(unknown_features)] #![feature(int_uint)] extern crate core; -- cgit 1.4.1-3-g733a5 From dc1ba08d1603aeedf37a4a7182e990207891379d Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 8 Jan 2015 23:36:24 +1100 Subject: Test fixes. --- src/libsyntax/ext/deriving/rand.rs | 6 +++--- src/libsyntax/feature_gate.rs | 2 +- src/test/compile-fail/feature-gate-int-uint.rs | 16 ++++++++-------- src/test/compile-fail/issue-13482-2.rs | 2 +- src/test/compile-fail/issue-5544-a.rs | 2 +- src/test/compile-fail/lex-bad-numeric-literals.rs | 4 ++-- src/test/compile-fail/lint-type-limits.rs | 4 ++-- src/test/compile-fail/oversized-literal.rs | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index 5517019f804..1359cada673 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -98,13 +98,13 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) rand_name, vec!(rng.clone())); - // need to specify the uint-ness of the random number - let uint_ty = cx.ty_ident(trait_span, cx.ident_of("uint")); + // need to specify the usize-ness of the random number + let usize_ty = cx.ty_ident(trait_span, cx.ident_of("usize")); let value_ident = cx.ident_of("__value"); let let_statement = cx.stmt_let_typed(trait_span, false, value_ident, - uint_ty, + usize_ty, rv_call); // rand() % variants.len() diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 6deffa804b2..ec1910f9017 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -355,7 +355,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { Some("the `int` type is deprecated; \ use `isize` or a fixed-sized integer") } else if name == "uint" { - Some("the `unt` type is deprecated; \ + Some("the `uint` type is deprecated; \ use `usize` or a fixed-sized integer") } else { None diff --git a/src/test/compile-fail/feature-gate-int-uint.rs b/src/test/compile-fail/feature-gate-int-uint.rs index 94190cc1511..016a0394289 100644 --- a/src/test/compile-fail/feature-gate-int-uint.rs +++ b/src/test/compile-fail/feature-gate-int-uint.rs @@ -11,21 +11,21 @@ #![allow(dead_code)] mod u { - type X = usize; //~ WARN the `usize` type is deprecated + type X = uint; //~ WARN the `uint` type is deprecated struct Foo { - x: usize //~ WARN the `usize` type is deprecated + x: uint //~ WARN the `uint` type is deprecated } - fn bar(x: usize) { //~ WARN the `usize` type is deprecated - 1us; //~ WARN the `u` suffix on integers is deprecated + fn bar(x: uint) { //~ WARN the `uint` type is deprecated + 1u; //~ WARN the `u` suffix on integers is deprecated } } mod i { - type X = isize; //~ WARN the `isize` type is deprecated + type X = int; //~ WARN the `int` type is deprecated struct Foo { - x: isize //~ WARN the `isize` type is deprecated + x: int //~ WARN the `int` type is deprecated } - fn bar(x: isize) { //~ WARN the `isize` type is deprecated - 1is; //~ WARN the `u` suffix on integers is deprecated + fn bar(x: int) { //~ WARN the `int` type is deprecated + 1i; //~ WARN the `i` suffix on integers is deprecated } } diff --git a/src/test/compile-fail/issue-13482-2.rs b/src/test/compile-fail/issue-13482-2.rs index 5c9b0473cea..ef7d3d4d158 100644 --- a/src/test/compile-fail/issue-13482-2.rs +++ b/src/test/compile-fail/issue-13482-2.rs @@ -14,7 +14,7 @@ fn main() { let x = [1,2]; let y = match x { [] => None, - //~^ ERROR types: expected `[_#0is; 2]`, found `[_#7t; 0]` + //~^ ERROR types: expected `[_#0i; 2]`, found `[_#7t; 0]` // (expected array of 2 elements, found array of 0 elements) [a,_] => Some(a) }; diff --git a/src/test/compile-fail/issue-5544-a.rs b/src/test/compile-fail/issue-5544-a.rs index 6db126f403a..42a18ba5fb7 100644 --- a/src/test/compile-fail/issue-5544-a.rs +++ b/src/test/compile-fail/issue-5544-a.rs @@ -10,5 +10,5 @@ fn main() { let _i = 18446744073709551616; // 2^64 - //~^ ERROR isize literal is too large + //~^ ERROR int literal is too large } diff --git a/src/test/compile-fail/lex-bad-numeric-literals.rs b/src/test/compile-fail/lex-bad-numeric-literals.rs index 273a7627d73..9a490be6a01 100644 --- a/src/test/compile-fail/lex-bad-numeric-literals.rs +++ b/src/test/compile-fail/lex-bad-numeric-literals.rs @@ -21,8 +21,8 @@ fn main() { 0o; //~ ERROR: no valid digits 1e+; //~ ERROR: expected at least one digit in exponent 0x539.0; //~ ERROR: hexadecimal float literal is not supported - 99999999999999999999999999999999; //~ ERROR: isize literal is too large - 99999999999999999999999999999999u32; //~ ERROR: isize literal is too large + 99999999999999999999999999999999; //~ ERROR: int literal is too large + 99999999999999999999999999999999u32; //~ ERROR: int literal is too large 0x; //~ ERROR: no valid digits 0xu32; //~ ERROR: no valid digits 0ou32; //~ ERROR: no valid digits diff --git a/src/test/compile-fail/lint-type-limits.rs b/src/test/compile-fail/lint-type-limits.rs index 3224dec1c99..a2bc464ac49 100644 --- a/src/test/compile-fail/lint-type-limits.rs +++ b/src/test/compile-fail/lint-type-limits.rs @@ -50,12 +50,12 @@ fn qux() { } fn quy() { - let i = -23us; //~ WARNING negation of unsigned isize literal may be unintentional + let i = -23us; //~ WARNING negation of unsigned int literal may be unintentional //~^ WARNING unused variable } fn quz() { let i = 23us; - let j = -i; //~ WARNING negation of unsigned isize variable may be unintentional + let j = -i; //~ WARNING negation of unsigned int variable may be unintentional //~^ WARNING unused variable } diff --git a/src/test/compile-fail/oversized-literal.rs b/src/test/compile-fail/oversized-literal.rs index 2a70653bd6c..5416bcacf3d 100644 --- a/src/test/compile-fail/oversized-literal.rs +++ b/src/test/compile-fail/oversized-literal.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - println!("{}", 18446744073709551616u64); //~ error: isize literal is too large + println!("{}", 18446744073709551616u64); //~ error: int literal is too large } -- cgit 1.4.1-3-g733a5