rollup merge of #20754: nikomatsakis/int-feature
Conflicts: src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs src/test/compile-fail/issue-2590.rs src/test/compile-fail/lint-stability.rs src/test/compile-fail/slice-mut-2.rs src/test/compile-fail/std-uncopyable-atomics.rs
This commit is contained in:
commit
4281bd1932
@ -12,6 +12,7 @@
|
||||
#![allow(unknown_features)]
|
||||
#![feature(slicing_syntax, unboxed_closures)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(int_uint)]
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#![feature(box_syntax)]
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(old_impl_check)]
|
||||
#![allow(unknown_features)] #![feature(int_uint)]
|
||||
#![no_std]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -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]
|
||||
|
@ -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)
|
||||
});
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#![crate_name = "flate"]
|
||||
#![unstable]
|
||||
#![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",
|
||||
|
@ -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::*;
|
||||
|
@ -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;
|
||||
|
@ -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::*;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#![crate_type = "rlib"]
|
||||
#![cfg_attr(not(feature = "cargo-build"), unstable)]
|
||||
#![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",
|
||||
|
@ -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;
|
||||
|
@ -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]
|
||||
#![unstable]
|
||||
#![staged_api]
|
||||
|
@ -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;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#![allow(unknown_features)]
|
||||
#![feature(slicing_syntax)]
|
||||
#![feature(box_syntax)]
|
||||
#![allow(unknown_features)] #![feature(int_uint)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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"),
|
||||
|
@ -528,12 +528,12 @@ pub fn eval_const_expr_partial(tcx: &ty::ctxt, e: &Expr) -> Result<const_val, St
|
||||
|
||||
eval_const_expr_partial(tcx, &**base)
|
||||
.and_then(|val| define_casts!(val, {
|
||||
ty::ty_int(ast::TyIs) => (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),
|
||||
|
@ -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)),
|
||||
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#![allow(unknown_features)]
|
||||
#![feature(link_args)]
|
||||
#![feature(box_syntax)]
|
||||
#![allow(unknown_features)] #![feature(int_uint)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
|
@ -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;
|
||||
@ -819,15 +820,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));
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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"),
|
||||
|
@ -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),
|
||||
|
@ -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()))
|
||||
|
@ -2459,7 +2459,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));
|
||||
@ -3225,8 +3225,24 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
|
||||
|
||||
if ty::type_is_integral(lhs_t) && ast_util::is_shift_binop(op) {
|
||||
// Shift is a special case: rhs must be uint, no matter what lhs is
|
||||
check_expr_has_type(fcx, &**rhs, fcx.tcx().types.uint);
|
||||
fcx.write_ty(expr.id, lhs_t);
|
||||
check_expr(fcx, &**rhs);
|
||||
let rhs_ty = fcx.expr_ty(&**rhs);
|
||||
let rhs_ty = fcx.infcx().resolve_type_vars_if_possible(&rhs_ty);
|
||||
if ty::type_is_integral(rhs_ty) {
|
||||
fcx.write_ty(expr.id, lhs_t);
|
||||
} else {
|
||||
fcx.type_error_message(
|
||||
expr.span,
|
||||
|actual| {
|
||||
format!(
|
||||
"right-hand-side of a shift operation must have integral type, \
|
||||
not `{}`",
|
||||
actual)
|
||||
},
|
||||
rhs_ty,
|
||||
None);
|
||||
fcx.write_ty(expr.id, fcx.tcx().types.err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4787,7 +4803,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 {
|
||||
@ -4796,7 +4812,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 {
|
||||
|
@ -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;
|
||||
|
@ -1389,12 +1389,12 @@ impl<'tcx> Clean<Type> 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),
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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]
|
||||
|
@ -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.
|
||||
///
|
||||
|
@ -1075,15 +1075,29 @@ pub struct Typedef {
|
||||
pub typ: P<Ty>,
|
||||
}
|
||||
|
||||
#[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,
|
||||
}
|
||||
}
|
||||
|
@ -127,8 +127,10 @@ pub fn is_path(e: P<Expr>) -> bool {
|
||||
/// We want to avoid "45int" and "-3int" in favor of "45" and "-3"
|
||||
pub fn int_ty_to_string(t: IntTy, val: Option<i64>) -> 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<u64>) -> 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
|
||||
}
|
||||
}
|
||||
|
@ -464,10 +464,10 @@ fn int_type_of_word(s: &str) -> Option<IntType> {
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<ast::Expr> {
|
||||
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<ast::Expr> {
|
||||
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<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU8)))
|
||||
|
@ -1031,7 +1031,7 @@ impl<'a> MethodDef<'a> {
|
||||
let arms: Vec<ast::Arm> = 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();
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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),
|
||||
@ -155,6 +158,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)
|
||||
}
|
||||
@ -332,6 +343,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 `uint` 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);
|
||||
}
|
||||
|
||||
@ -343,6 +379,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);
|
||||
|
@ -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;
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -15,6 +15,6 @@ pub use use_from_trait_xc::Trait;
|
||||
|
||||
fn main() {
|
||||
match () {
|
||||
Trait { x: 42u } => () //~ ERROR use of trait `Trait` in a struct pattern
|
||||
Trait { x: 42us } => () //~ ERROR use of trait `Trait` in a struct pattern
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
// except according to those terms.
|
||||
|
||||
|
||||
struct sty(Vec<int> );
|
||||
struct sty(Vec<isize> );
|
||||
|
||||
fn unpack<F>(_unpack: F) where F: FnOnce(&sty) -> Vec<int> {}
|
||||
fn unpack<F>(_unpack: F) where F: FnOnce(&sty) -> Vec<isize> {}
|
||||
|
||||
fn main() {
|
||||
let _foo = unpack(|s| {
|
||||
|
@ -10,6 +10,6 @@
|
||||
|
||||
// error-pattern: parameters were supplied
|
||||
|
||||
fn f(x: int) { }
|
||||
fn f(x: isize) { }
|
||||
|
||||
fn main() { let i: (); i = f(); }
|
||||
|
@ -11,6 +11,6 @@
|
||||
|
||||
// error-pattern: mismatched types
|
||||
|
||||
fn f(x: int) { }
|
||||
fn f(x: isize) { }
|
||||
|
||||
fn main() { let i: (); i = f(()); }
|
||||
|
@ -11,5 +11,5 @@
|
||||
// Test that the old fixed length array syntax is a parsing error.
|
||||
|
||||
fn main() {
|
||||
let _x: [int, ..3] = [0i, 1, 2]; //~ ERROR
|
||||
let _x: [isize, ..3] = [0is, 1, 2]; //~ ERROR
|
||||
}
|
||||
|
@ -11,5 +11,5 @@
|
||||
// Test that the old repeating array syntax gives an error.
|
||||
|
||||
fn main() {
|
||||
let _ = [0i, ..3]; //~ ERROR
|
||||
let _ = [0is, ..3]; //~ ERROR
|
||||
}
|
||||
|
@ -10,18 +10,18 @@
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
fn foo(x: int) { println!("{}", x); }
|
||||
fn foo(x: isize) { println!("{}", x); }
|
||||
|
||||
#[cfg(any(target_arch = "x86",
|
||||
target_arch = "x86_64",
|
||||
target_arch = "arm",
|
||||
target_arch = "aarch64"))]
|
||||
pub fn main() {
|
||||
let x: int;
|
||||
let y: int;
|
||||
let x: isize;
|
||||
let y: isize;
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "=r"(x) : "=r"(5u)); //~ ERROR input operand constraint contains '='
|
||||
asm!("mov $1, $0" : "=r"(y) : "+r"(5u)); //~ ERROR input operand constraint contains '+'
|
||||
asm!("mov $1, $0" : "=r"(x) : "=r"(5us)); //~ ERROR input operand constraint contains '='
|
||||
asm!("mov $1, $0" : "=r"(y) : "+r"(5us)); //~ ERROR input operand constraint contains '+'
|
||||
}
|
||||
foo(x);
|
||||
foo(y);
|
||||
|
@ -18,17 +18,17 @@
|
||||
target_arch = "x86_64"))]
|
||||
pub fn main() {
|
||||
// assignment not dead
|
||||
let mut x: int = 0;
|
||||
let mut x: isize = 0;
|
||||
unsafe {
|
||||
// extra colon
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(5u), "0"(x) : : "cc");
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(5us), "0"(x) : : "cc");
|
||||
//~^ WARNING unrecognized option
|
||||
}
|
||||
assert_eq!(x, 5);
|
||||
|
||||
unsafe {
|
||||
// comma in place of a colon
|
||||
asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8u) : "cc", "volatile");
|
||||
asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8us) : "cc", "volatile");
|
||||
//~^ WARNING expected a clobber, found an option
|
||||
}
|
||||
assert_eq!(x, 13);
|
||||
|
@ -10,18 +10,18 @@
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
fn foo(x: int) { println!("{}", x); }
|
||||
fn foo(x: isize) { println!("{}", x); }
|
||||
|
||||
#[cfg(any(target_arch = "x86",
|
||||
target_arch = "x86_64",
|
||||
target_arch = "arm",
|
||||
target_arch = "aarch64"))]
|
||||
pub fn main() {
|
||||
let x: int;
|
||||
let x: isize;
|
||||
x = 1; //~ NOTE prior assignment occurs here
|
||||
foo(x);
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(5u)); //~ ERROR re-assignment of immutable variable `x`
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(5us)); //~ ERROR re-assignment of immutable variable `x`
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
|
@ -10,16 +10,16 @@
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
fn foo(x: int) { println!("{}", x); }
|
||||
fn foo(x: isize) { println!("{}", x); }
|
||||
|
||||
#[cfg(any(target_arch = "x86",
|
||||
target_arch = "x86_64",
|
||||
target_arch = "arm",
|
||||
target_arch = "aarch64"))]
|
||||
pub fn main() {
|
||||
let x: int;
|
||||
let x: isize;
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "r"(x) : "r"(5u)); //~ ERROR output operand constraint lacks '='
|
||||
asm!("mov $1, $0" : "r"(x) : "r"(5us)); //~ ERROR output operand constraint lacks '='
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
|
@ -10,14 +10,14 @@
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
fn foo(x: int) { println!("{}", x); }
|
||||
fn foo(x: isize) { println!("{}", x); }
|
||||
|
||||
#[cfg(any(target_arch = "x86",
|
||||
target_arch = "x86_64",
|
||||
target_arch = "arm",
|
||||
target_arch = "aarch64"))]
|
||||
pub fn main() {
|
||||
let x: int;
|
||||
let x: isize;
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(x)); //~ ERROR use of possibly uninitialized variable: `x`
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn test() {
|
||||
let v: int;
|
||||
let v: isize;
|
||||
v = 1; //~ NOTE prior assignment occurs here
|
||||
println!("v={}", v);
|
||||
v = 2; //~ ERROR re-assignment of immutable variable
|
||||
|
@ -9,16 +9,16 @@
|
||||
// except according to those terms.
|
||||
|
||||
struct cat {
|
||||
meows : uint,
|
||||
meows : usize,
|
||||
|
||||
how_hungry : int,
|
||||
how_hungry : isize,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub fn speak(&self) { self.meows += 1u; }
|
||||
pub fn speak(&self) { self.meows += 1us; }
|
||||
}
|
||||
|
||||
fn cat(in_x : uint, in_y : int) -> cat {
|
||||
fn cat(in_x : usize, in_y : isize) -> cat {
|
||||
cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y
|
||||
@ -26,6 +26,6 @@ fn cat(in_x : uint, in_y : int) -> cat {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52u, 99);
|
||||
let nyan : cat = cat(52us, 99);
|
||||
nyan.speak = |&:| println!("meow"); //~ ERROR attempted to take value of method
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
type Bar = int; //~ERROR associated items are not allowed in inherent impls
|
||||
type Bar = isize; //~ERROR associated items are not allowed in inherent impls
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -11,7 +11,7 @@
|
||||
// Test equality constraints on associated types in a where clause.
|
||||
|
||||
pub trait ToInt {
|
||||
fn to_int(&self) -> int;
|
||||
fn to_int(&self) -> isize;
|
||||
}
|
||||
|
||||
pub trait GetToInt
|
||||
@ -21,13 +21,13 @@ pub trait GetToInt
|
||||
fn get(&self) -> <Self as GetToInt>::R;
|
||||
}
|
||||
|
||||
fn foo<G>(g: G) -> int
|
||||
fn foo<G>(g: G) -> isize
|
||||
where G : GetToInt
|
||||
{
|
||||
ToInt::to_int(&g.get()) //~ ERROR not implemented
|
||||
}
|
||||
|
||||
fn bar<G : GetToInt>(g: G) -> int
|
||||
fn bar<G : GetToInt>(g: G) -> isize
|
||||
where G::R : ToInt
|
||||
{
|
||||
ToInt::to_int(&g.get()) // OK
|
||||
|
@ -18,9 +18,9 @@ pub trait Foo {
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for int {
|
||||
type A = uint;
|
||||
fn boo(&self) -> uint { 42 }
|
||||
impl Foo for isize {
|
||||
type A = usize;
|
||||
fn boo(&self) -> usize { 42 }
|
||||
}
|
||||
|
||||
fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}
|
||||
|
@ -18,9 +18,9 @@ pub trait Foo {
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for int {
|
||||
type A = uint;
|
||||
fn boo(&self) -> uint {
|
||||
impl Foo for isize {
|
||||
type A = usize;
|
||||
fn boo(&self) -> usize {
|
||||
42
|
||||
}
|
||||
}
|
||||
@ -40,7 +40,7 @@ pub fn baz(x: &Foo<A=Bar>) {
|
||||
|
||||
|
||||
pub fn main() {
|
||||
let a = 42i;
|
||||
let a = 42is;
|
||||
foo1(a); //~ERROR expected usize, found struct Bar
|
||||
baz(&a); //~ERROR expected usize, found struct Bar
|
||||
}
|
||||
|
@ -12,15 +12,15 @@
|
||||
|
||||
trait Foo {
|
||||
type A;
|
||||
fn bar() -> int;
|
||||
fn bar() -> isize;
|
||||
}
|
||||
|
||||
impl Foo for int {
|
||||
type A = uint;
|
||||
fn bar() -> int { 42 }
|
||||
impl Foo for isize {
|
||||
type A = usize;
|
||||
fn bar() -> isize { 42 }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x: int = Foo::<A=uint>::bar();
|
||||
let x: isize = Foo::<A=usize>::bar();
|
||||
//~^ERROR unexpected binding of associated item in expression path
|
||||
}
|
||||
|
@ -17,43 +17,43 @@ pub trait TheTrait<T> {
|
||||
}
|
||||
|
||||
struct IntStruct {
|
||||
x: int
|
||||
x: isize
|
||||
}
|
||||
|
||||
impl<'a> TheTrait<&'a int> for IntStruct {
|
||||
type A = &'a int;
|
||||
impl<'a> TheTrait<&'a isize> for IntStruct {
|
||||
type A = &'a isize;
|
||||
|
||||
fn get(&self, t: &'a int) -> &'a int {
|
||||
fn get(&self, t: &'a isize) -> &'a isize {
|
||||
t
|
||||
}
|
||||
}
|
||||
|
||||
struct UintStruct {
|
||||
x: int
|
||||
x: isize
|
||||
}
|
||||
|
||||
impl<'a> TheTrait<&'a int> for UintStruct {
|
||||
type A = &'a uint;
|
||||
impl<'a> TheTrait<&'a isize> for UintStruct {
|
||||
type A = &'a usize;
|
||||
|
||||
fn get(&self, t: &'a int) -> &'a uint {
|
||||
fn get(&self, t: &'a isize) -> &'a usize {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
fn foo<T>()
|
||||
where T : for<'x> TheTrait<&'x int, A = &'x int>
|
||||
where T : for<'x> TheTrait<&'x isize, A = &'x isize>
|
||||
{
|
||||
// ok for IntStruct, but not UintStruct
|
||||
}
|
||||
|
||||
fn bar<T>()
|
||||
where T : for<'x> TheTrait<&'x int, A = &'x uint>
|
||||
where T : for<'x> TheTrait<&'x isize, A = &'x usize>
|
||||
{
|
||||
// ok for UintStruct, but not IntStruct
|
||||
}
|
||||
|
||||
fn baz<T>()
|
||||
where T : for<'x,'y> TheTrait<&'x int, A = &'y int>
|
||||
where T : for<'x,'y> TheTrait<&'x isize, A = &'y isize>
|
||||
{
|
||||
// not ok for either struct, due to the use of two lifetimes
|
||||
}
|
||||
|
@ -19,24 +19,24 @@ pub trait Foo {
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for int {
|
||||
type A = uint;
|
||||
impl Foo for isize {
|
||||
type A = usize;
|
||||
type B = char;
|
||||
fn boo(&self) -> uint {
|
||||
fn boo(&self) -> usize {
|
||||
42
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let a = &42i as &Foo<A=uint, B=char>;
|
||||
let a = &42is as &Foo<A=usize, B=char>;
|
||||
|
||||
let b = &42i as &Foo<A=uint>;
|
||||
let b = &42is as &Foo<A=usize>;
|
||||
//~^ ERROR the value of the associated type `B` (from the trait `Foo`) must be specified
|
||||
|
||||
let c = &42i as &Foo<B=char>;
|
||||
let c = &42is as &Foo<B=char>;
|
||||
//~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified
|
||||
|
||||
let d = &42i as &Foo;
|
||||
let d = &42is as &Foo;
|
||||
//~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified
|
||||
//~| ERROR the value of the associated type `B` (from the trait `Foo`) must be specified
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ trait Foo<T> {
|
||||
fn get_bar(&self) -> Self::Bar;
|
||||
}
|
||||
|
||||
fn f<T:Foo<int>>(t: &T) {
|
||||
fn f<T:Foo<isize>>(t: &T) {
|
||||
let u: <T as Foo<usize>>::Bar = t.get_bar();
|
||||
//~^ ERROR the trait `Foo<usize>` is not implemented for the type `T`
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ trait Trait {
|
||||
type Type;
|
||||
}
|
||||
|
||||
impl Trait for int {} //~ ERROR missing: `Type`
|
||||
impl Trait for isize {} //~ ERROR missing: `Type`
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
@ -14,7 +14,7 @@ trait Get {
|
||||
}
|
||||
|
||||
struct Struct {
|
||||
x: int,
|
||||
x: isize,
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
|
@ -14,8 +14,8 @@ pub trait Foo {
|
||||
type A;
|
||||
}
|
||||
|
||||
impl Foo for int {
|
||||
type A = uint;
|
||||
impl Foo for isize {
|
||||
type A = usize;
|
||||
}
|
||||
|
||||
pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||
@ -45,7 +45,7 @@ pub fn f1_uint_int() {
|
||||
}
|
||||
|
||||
pub fn f2_int() {
|
||||
let _: int = f2(2is);
|
||||
let _: isize = f2(2is);
|
||||
//~^ ERROR expected `isize`, found `usize`
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ pub trait Foo<T> {
|
||||
fn get(&self, t: T) -> Self::A;
|
||||
}
|
||||
|
||||
fn foo2<I>(x: <I as for<'x> Foo<&'x int>>::A)
|
||||
fn foo2<I>(x: <I as for<'x> Foo<&'x isize>>::A)
|
||||
//~^ ERROR expected identifier, found keyword `for`
|
||||
//~| ERROR expected one of `::` or `>`
|
||||
{
|
||||
|
@ -17,15 +17,15 @@ pub trait Foo<T> {
|
||||
fn get(&self, t: T) -> Self::A;
|
||||
}
|
||||
|
||||
fn foo<'a, I : for<'x> Foo<&'x int>>(
|
||||
x: <I as Foo<&'a int>>::A)
|
||||
fn foo<'a, I : for<'x> Foo<&'x isize>>(
|
||||
x: <I as Foo<&'a isize>>::A)
|
||||
{
|
||||
let y: I::A = x;
|
||||
}
|
||||
|
||||
fn bar<'a, 'b, I : for<'x> Foo<&'x int>>(
|
||||
x: <I as Foo<&'a int>>::A,
|
||||
y: <I as Foo<&'b int>>::A,
|
||||
fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
|
||||
x: <I as Foo<&'a isize>>::A,
|
||||
y: <I as Foo<&'b isize>>::A,
|
||||
cond: bool)
|
||||
{
|
||||
// x and y here have two distinct lifetimes:
|
||||
|
@ -17,7 +17,7 @@ pub trait Foo<T> {
|
||||
fn get(&self, t: T) -> Self::A;
|
||||
}
|
||||
|
||||
fn foo2<I : for<'x> Foo<&'x int>>(
|
||||
fn foo2<I : for<'x> Foo<&'x isize>>(
|
||||
x: I::A)
|
||||
//~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
|
||||
{
|
||||
@ -28,15 +28,15 @@ fn foo2<I : for<'x> Foo<&'x int>>(
|
||||
// specifically for fn signatures.
|
||||
}
|
||||
|
||||
fn foo3<I : for<'x> Foo<&'x int>>(
|
||||
x: <I as Foo<&int>>::A)
|
||||
fn foo3<I : for<'x> Foo<&'x isize>>(
|
||||
x: <I as Foo<&isize>>::A)
|
||||
{
|
||||
// OK, in this case we spelled out the precise regions involved, though we left one of
|
||||
// them anonymous.
|
||||
}
|
||||
|
||||
fn foo4<'a, I : for<'x> Foo<&'x int>>(
|
||||
x: <I as Foo<&'a int>>::A)
|
||||
fn foo4<'a, I : for<'x> Foo<&'x isize>>(
|
||||
x: <I as Foo<&'a isize>>::A)
|
||||
{
|
||||
// OK, in this case we spelled out the precise regions involved.
|
||||
}
|
||||
|
@ -17,18 +17,18 @@ pub trait Foo<T> {
|
||||
fn get(&self, t: T) -> Self::A;
|
||||
}
|
||||
|
||||
struct SomeStruct<I : for<'x> Foo<&'x int>> {
|
||||
struct SomeStruct<I : for<'x> Foo<&'x isize>> {
|
||||
field: I::A
|
||||
//~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
|
||||
}
|
||||
|
||||
struct AnotherStruct<I : for<'x> Foo<&'x int>> {
|
||||
field: <I as Foo<&int>>::A
|
||||
struct AnotherStruct<I : for<'x> Foo<&'x isize>> {
|
||||
field: <I as Foo<&isize>>::A
|
||||
//~^ ERROR missing lifetime specifier
|
||||
}
|
||||
|
||||
struct YetAnotherStruct<'a, I : for<'x> Foo<&'x int>> {
|
||||
field: <I as Foo<&'a int>>::A
|
||||
struct YetAnotherStruct<'a, I : for<'x> Foo<&'x isize>> {
|
||||
field: <I as Foo<&'a isize>>::A
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
@ -17,17 +17,17 @@ pub trait Foo<T> {
|
||||
fn get(&self, t: T) -> Self::A;
|
||||
}
|
||||
|
||||
trait SomeTrait<I : for<'x> Foo<&'x int>> {
|
||||
trait SomeTrait<I : for<'x> Foo<&'x isize>> {
|
||||
fn some_method(&self, arg: I::A);
|
||||
//~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
|
||||
}
|
||||
|
||||
trait AnotherTrait<I : for<'x> Foo<&'x int>> {
|
||||
fn some_method(&self, arg: <I as Foo<&int>>::A);
|
||||
trait AnotherTrait<I : for<'x> Foo<&'x isize>> {
|
||||
fn some_method(&self, arg: <I as Foo<&isize>>::A);
|
||||
}
|
||||
|
||||
trait YetAnotherTrait<I : for<'x> Foo<&'x int>> {
|
||||
fn some_method<'a>(&self, arg: <I as Foo<&'a int>>::A);
|
||||
trait YetAnotherTrait<I : for<'x> Foo<&'x isize>> {
|
||||
fn some_method<'a>(&self, arg: <I as Foo<&'a isize>>::A);
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
@ -12,15 +12,15 @@
|
||||
|
||||
trait Foo {
|
||||
type A;
|
||||
fn bar() -> int;
|
||||
fn bar() -> isize;
|
||||
}
|
||||
|
||||
impl Foo for int {
|
||||
type A = uint;
|
||||
fn bar() -> int { 42 }
|
||||
impl Foo for isize {
|
||||
type A = usize;
|
||||
fn bar() -> isize { 42 }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x: int = Foo::bar();
|
||||
let x: isize = Foo::bar();
|
||||
//~^ ERROR type annotations required
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ trait MyIter {
|
||||
fn test(&self);
|
||||
}
|
||||
|
||||
impl<'a> MyIter for &'a [int] {
|
||||
impl<'a> MyIter for &'a [isize] {
|
||||
fn test_mut(&mut self) { }
|
||||
fn test(&self) { }
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ fn main() {
|
||||
assert_eq!(z, 21);
|
||||
let forty: fish = fish{a: box 40};
|
||||
let two: fish = fish{a: box 2};
|
||||
let answer: int = forty.a + two.a;
|
||||
let answer: isize = forty.a + two.a;
|
||||
//~^ ERROR binary operation `+` cannot be applied to type `Box<isize>`
|
||||
println!("{}", answer);
|
||||
assert_eq!(answer, 42);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
|
||||
fn bad_bang(i: uint) -> ! {
|
||||
return 7u; //~ ERROR `return` in a function declared as diverging [E0166]
|
||||
fn bad_bang(i: usize) -> ! {
|
||||
return 7us; //~ ERROR `return` in a function declared as diverging [E0166]
|
||||
}
|
||||
|
||||
fn main() { bad_bang(5u); }
|
||||
fn main() { bad_bang(5us); }
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
|
||||
fn bad_bang(i: uint) -> ! { //~ ERROR computation may converge in a function marked as diverging
|
||||
if i < 0u { } else { panic!(); }
|
||||
fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging
|
||||
if i < 0us { } else { panic!(); }
|
||||
}
|
||||
|
||||
fn main() { bad_bang(5u); }
|
||||
fn main() { bad_bang(5us); }
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// error-pattern: can't capture dynamic environment in a fn item;
|
||||
fn foo() {
|
||||
let x: int;
|
||||
let x: isize;
|
||||
fn bar() { log(debug, x); }
|
||||
}
|
||||
fn main() { foo(); }
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: can't capture dynamic environment in a fn item;
|
||||
fn foo(x: int) {
|
||||
fn foo(x: isize) {
|
||||
fn bar() { log(debug, x); }
|
||||
}
|
||||
fn main() { foo(2); }
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: can't capture dynamic environment in a fn item;
|
||||
fn foo(x: int) {
|
||||
fn foo(x: isize) {
|
||||
fn mth() {
|
||||
fn bar() { log(debug, x); }
|
||||
}
|
||||
|
@ -8,4 +8,4 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main(x: int) { } //~ ERROR: main function expects type
|
||||
fn main(x: isize) { } //~ ERROR: main function expects type
|
||||
|
@ -11,7 +11,7 @@
|
||||
// error-pattern: expected
|
||||
|
||||
fn main() {
|
||||
let int x = 5;
|
||||
let isize x = 5;
|
||||
match x;
|
||||
}
|
||||
|
||||
|
@ -9,14 +9,14 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn foo<T:'static>() {
|
||||
1u.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
|
||||
1us.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
trait bar {
|
||||
fn bar<T:Send>(&self);
|
||||
}
|
||||
|
||||
impl bar for uint {
|
||||
impl bar for usize {
|
||||
fn bar<T:Send>(&self) {
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ trait Trait<T> {
|
||||
}
|
||||
|
||||
struct S2 {
|
||||
contents: int,
|
||||
contents: isize,
|
||||
}
|
||||
|
||||
impl Trait<int> for S2 {
|
||||
fn new<U>(x: int, _: U) -> S2 {
|
||||
impl Trait<isize> for S2 {
|
||||
fn new<U>(x: isize, _: U) -> S2 {
|
||||
S2 {
|
||||
contents: x,
|
||||
}
|
||||
@ -45,16 +45,16 @@ impl Trait<int> for S2 {
|
||||
}
|
||||
|
||||
fn foo<'a>() {
|
||||
let _ = S::new::<int,f64>(1, 1.0);
|
||||
let _ = S::new::<isize,f64>(1, 1.0);
|
||||
//~^ ERROR too many type parameters provided
|
||||
|
||||
let _ = S::<'a,int>::new::<f64>(1, 1.0);
|
||||
let _ = S::<'a,isize>::new::<f64>(1, 1.0);
|
||||
//~^ ERROR too many lifetime parameters provided
|
||||
|
||||
let _: S2 = Trait::new::<int,f64>(1, 1.0);
|
||||
let _: S2 = Trait::new::<isize,f64>(1, 1.0);
|
||||
//~^ ERROR too many type parameters provided
|
||||
|
||||
let _: S2 = Trait::<'a,int>::new::<f64>(1, 1.0);
|
||||
let _: S2 = Trait::<'a,isize>::new::<f64>(1, 1.0);
|
||||
//~^ ERROR too many lifetime parameters provided
|
||||
}
|
||||
|
||||
|
@ -11,5 +11,5 @@
|
||||
// error-pattern: expected
|
||||
|
||||
fn main() {
|
||||
let x.y::<int>.z foo;
|
||||
let x.y::<isize>.z foo;
|
||||
}
|
||||
|
@ -9,6 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging
|
||||
3i
|
||||
3is
|
||||
}
|
||||
fn main() { }
|
||||
|
@ -9,5 +9,5 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let x: [int 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `3`
|
||||
let x: [isize 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `3`
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
struct Foo { x: int }
|
||||
struct Foo { x: isize }
|
||||
match (Foo { x: 10 }) {
|
||||
Foo { ref x: ref x } => {}, //~ ERROR unexpected `:`
|
||||
_ => {}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
// error-pattern: unresolved
|
||||
|
||||
enum color { rgb(int, int, int), rgba(int, int, int, int), }
|
||||
enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
|
||||
|
||||
fn main() {
|
||||
let red: color = rgb(255, 0, 0);
|
||||
|
@ -13,29 +13,29 @@
|
||||
// Tests that we can't assign to or mutably borrow upvars from `Fn`
|
||||
// closures (issue #17780)
|
||||
|
||||
fn set(x: &mut uint) { *x = 5; }
|
||||
fn set(x: &mut usize) { *x = 5; }
|
||||
|
||||
fn main() {
|
||||
// By-ref captures
|
||||
{
|
||||
let mut x = 0u;
|
||||
let mut x = 0us;
|
||||
let _f = |&:| x = 42; //~ ERROR cannot assign
|
||||
|
||||
let mut y = 0u;
|
||||
let mut y = 0us;
|
||||
let _g = |&:| set(&mut y); //~ ERROR cannot borrow
|
||||
|
||||
let mut z = 0u;
|
||||
let mut z = 0us;
|
||||
let _h = |&mut:| { set(&mut z); |&:| z = 42; }; //~ ERROR cannot assign
|
||||
}
|
||||
// By-value captures
|
||||
{
|
||||
let mut x = 0u;
|
||||
let mut x = 0us;
|
||||
let _f = move |&:| x = 42; //~ ERROR cannot assign
|
||||
|
||||
let mut y = 0u;
|
||||
let mut y = 0us;
|
||||
let _g = move |&:| set(&mut y); //~ ERROR cannot borrow
|
||||
|
||||
let mut z = 0u;
|
||||
let mut z = 0us;
|
||||
let _h = move |&mut:| { set(&mut z); move |&:| z = 42; }; //~ ERROR cannot assign
|
||||
}
|
||||
}
|
||||
|
@ -11,33 +11,33 @@
|
||||
#![allow(unknown_features)]
|
||||
#![feature(box_syntax)]
|
||||
|
||||
struct Foo(Box<int>, int);
|
||||
struct Foo(Box<isize>, isize);
|
||||
|
||||
struct Bar(int, int);
|
||||
struct Bar(isize, isize);
|
||||
|
||||
fn main() {
|
||||
let x = (box 1i, 2i);
|
||||
let x = (box 1is, 2is);
|
||||
let r = &x.0;
|
||||
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
|
||||
|
||||
let mut x = (1i, 2i);
|
||||
let mut x = (1is, 2is);
|
||||
let a = &x.0;
|
||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
|
||||
|
||||
let mut x = (1i, 2i);
|
||||
let mut x = (1is, 2is);
|
||||
let a = &mut x.0;
|
||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
|
||||
|
||||
|
||||
let x = Foo(box 1i, 2i);
|
||||
let x = Foo(box 1is, 2is);
|
||||
let r = &x.0;
|
||||
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
|
||||
|
||||
let mut x = Bar(1i, 2i);
|
||||
let mut x = Bar(1is, 2is);
|
||||
let a = &x.0;
|
||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
|
||||
|
||||
let mut x = Bar(1i, 2i);
|
||||
let mut x = Bar(1is, 2is);
|
||||
let a = &mut x.0;
|
||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let i: int;
|
||||
let i: isize;
|
||||
|
||||
println!("{}", false && { i = 5; true });
|
||||
println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user