Skip to content

Forbid is/us suffixes. Fixes #22496 #24485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/tvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/issue-11224.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ mod inner {
}

pub fn foo() {
let a = &1is as &inner::Trait;
let a = &1isize as &inner::Trait;
a.f();
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/lint-type-limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
14 changes: 14 additions & 0 deletions src/test/compile-fail/old-suffixes-are-really-forbidden.rs
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion src/test/run-make/symbols-are-reasonable/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/test/run-pass/autoderef-method-on-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
8 changes: 4 additions & 4 deletions src/test/run-pass/issue-15763.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}