Auto merge of #24485 - brson:is, r=alexcrichton

It was an oversight that this was not done in the great int upheaval.

[breaking-change]
This commit is contained in:
bors 2015-04-16 01:17:04 +00:00
commit e40449e0d5
8 changed files with 24 additions and 12 deletions

View File

@ -361,7 +361,7 @@ fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
InBoundsGEP(bcx, data_ptr, &[loop_counter])
};
let bcx = f(bcx, lleltptr, vt.unit_ty);
let plusone = Add(bcx, loop_counter, C_uint(bcx.ccx(), 1us), DebugLoc::None);
let plusone = Add(bcx, loop_counter, C_uint(bcx.ccx(), 1usize), DebugLoc::None);
AddIncomingToPhi(loop_counter, plusone, bcx.llbb);
let cond_val = ICmp(bcx, llvm::IntULT, plusone, count, DebugLoc::None);

View File

@ -714,8 +714,6 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
"u16" => ast::UnsignedIntLit(ast::TyU16),
"u32" => ast::UnsignedIntLit(ast::TyU32),
"u64" => ast::UnsignedIntLit(ast::TyU64),
"is" => ast::SignedIntLit(ast::TyIs, ast::Plus),
"us" => ast::UnsignedIntLit(ast::TyUs),
_ => {
// i<digits> and u<digits> look like widths, so lets
// give an error message along those lines

View File

@ -21,6 +21,6 @@ mod inner {
}
pub fn foo() {
let a = &1is as &inner::Trait;
let a = &1isize as &inner::Trait;
a.f();
}

View File

@ -52,12 +52,12 @@ fn qux() {
}
fn quy() {
let i = -23_us; //~ WARNING negation of unsigned int literal may be unintentional
let i = -23_usize; //~ WARNING negation of unsigned int literal may be unintentional
//~^ WARNING unused variable
}
fn quz() {
let i = 23_us;
let i = 23_usize;
let j = -i; //~ WARNING negation of unsigned int variable may be unintentional
//~^ WARNING unused variable
}

View File

@ -0,0 +1,14 @@
// 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let a = 1_is; //~ ERROR illegal suffix
let b = 2_us; //~ ERROR illegal suffix
}

View File

@ -16,5 +16,5 @@ impl Foo for usize {}
pub fn dummy() {
// force the vtable to be created
let _x = &1us as &Foo;
let _x = &1usize as &Foo;
}

View File

@ -21,6 +21,6 @@ impl double for usize {
}
pub fn main() {
let x: Box<_> = box() (box 3us as Box<double>);
let x: Box<_> = box() (box 3usize as Box<double>);
assert_eq!(x.double(), 6);
}

View File

@ -87,12 +87,12 @@ fn main() {
assert_eq!(cc().unwrap(), 3);
assert_eq!(dd().unwrap(), 3);
let i = box 32is as Box<A>;
let i = box 32isize as Box<A>;
assert_eq!(i.aaa(), 3);
let i = box 32is as Box<A>;
let i = box 32isize as Box<A>;
assert_eq!(i.bbb(), 3);
let i = box 32is as Box<A>;
let i = box 32isize as Box<A>;
assert_eq!(i.ccc().unwrap(), 3);
let i = box 32is as Box<A>;
let i = box 32isize as Box<A>;
assert_eq!(i.ddd().unwrap(), 3);
}