Kill more isizes

This commit is contained in:
Tobias Bucher 2015-01-31 17:23:42 +01:00
parent 105bfd3001
commit b4a43f3864
197 changed files with 806 additions and 807 deletions

View File

@ -424,7 +424,7 @@ Let's see an example. This Rust code will not compile:
use std::thread::Thread;
fn main() {
let mut numbers = vec![1is, 2, 3];
let mut numbers = vec![1, 2, 3];
for i in 0..3 {
Thread::spawn(move || {
@ -478,7 +478,7 @@ use std::thread::Thread;
use std::sync::{Arc,Mutex};
fn main() {
let numbers = Arc::new(Mutex::new(vec![1is, 2, 3]));
let numbers = Arc::new(Mutex::new(vec![1, 2, 3]));
for i in 0us..3 {
let number = numbers.clone();
@ -539,7 +539,7 @@ safety check that makes this an error about moved values:
use std::thread::Thread;
fn main() {
let vec = vec![1is, 2, 3];
let vec = vec![1, 2, 3];
for i in 0us..3 {
Thread::spawn(move || {

View File

@ -333,7 +333,7 @@ impl<T> DList<T> {
///
/// let mut dl = DList::new();
///
/// dl.push_front(2is);
/// dl.push_front(2);
/// assert_eq!(dl.len(), 1);
///
/// dl.push_front(1);
@ -360,10 +360,10 @@ impl<T> DList<T> {
///
/// let mut dl = DList::new();
///
/// dl.push_front(2is);
/// dl.push_front(2);
/// dl.push_front(1);
/// assert_eq!(dl.len(), 2);
/// assert_eq!(dl.front(), Some(&1is));
/// assert_eq!(dl.front(), Some(&1));
///
/// dl.clear();
/// assert_eq!(dl.len(), 0);
@ -388,7 +388,7 @@ impl<T> DList<T> {
/// assert_eq!(dl.front(), None);
///
/// dl.push_front(1);
/// assert_eq!(dl.front(), Some(&1is));
/// assert_eq!(dl.front(), Some(&1));
///
/// ```
#[inline]
@ -409,13 +409,13 @@ impl<T> DList<T> {
/// assert_eq!(dl.front(), None);
///
/// dl.push_front(1);
/// assert_eq!(dl.front(), Some(&1is));
/// assert_eq!(dl.front(), Some(&1));
///
/// match dl.front_mut() {
/// None => {},
/// Some(x) => *x = 5is,
/// Some(x) => *x = 5,
/// }
/// assert_eq!(dl.front(), Some(&5is));
/// assert_eq!(dl.front(), Some(&5));
///
/// ```
#[inline]
@ -436,7 +436,7 @@ impl<T> DList<T> {
/// assert_eq!(dl.back(), None);
///
/// dl.push_back(1);
/// assert_eq!(dl.back(), Some(&1is));
/// assert_eq!(dl.back(), Some(&1));
///
/// ```
#[inline]
@ -457,13 +457,13 @@ impl<T> DList<T> {
/// assert_eq!(dl.back(), None);
///
/// dl.push_back(1);
/// assert_eq!(dl.back(), Some(&1is));
/// assert_eq!(dl.back(), Some(&1));
///
/// match dl.back_mut() {
/// None => {},
/// Some(x) => *x = 5is,
/// Some(x) => *x = 5,
/// }
/// assert_eq!(dl.back(), Some(&5is));
/// assert_eq!(dl.back(), Some(&5));
///
/// ```
#[inline]
@ -483,8 +483,8 @@ impl<T> DList<T> {
///
/// let mut dl = DList::new();
///
/// dl.push_front(2is);
/// assert_eq!(dl.front().unwrap(), &2is);
/// dl.push_front(2);
/// assert_eq!(dl.front().unwrap(), &2);
///
/// dl.push_front(1);
/// assert_eq!(dl.front().unwrap(), &1);
@ -508,7 +508,7 @@ impl<T> DList<T> {
/// let mut d = DList::new();
/// assert_eq!(d.pop_front(), None);
///
/// d.push_front(1is);
/// d.push_front(1);
/// d.push_front(3);
/// assert_eq!(d.pop_front(), Some(3));
/// assert_eq!(d.pop_front(), Some(1));
@ -568,7 +568,7 @@ impl<T> DList<T> {
///
/// let mut d = DList::new();
///
/// d.push_front(1is);
/// d.push_front(1);
/// d.push_front(2);
/// d.push_front(3);
///

View File

@ -50,13 +50,13 @@ fn test_writer_hasher() {
assert_eq!(hash(&5u16), 5);
assert_eq!(hash(&5u32), 5);
assert_eq!(hash(&5u64), 5);
assert_eq!(hash(&5u), 5);
assert_eq!(hash(&5us), 5);
assert_eq!(hash(&5i8), 5);
assert_eq!(hash(&5i16), 5);
assert_eq!(hash(&5i32), 5);
assert_eq!(hash(&5i64), 5);
assert_eq!(hash(&5), 5);
assert_eq!(hash(&5is), 5);
assert_eq!(hash(&false), 0);
assert_eq!(hash(&true), 1);
@ -76,12 +76,12 @@ fn test_writer_hasher() {
// FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]>
unsafe {
let ptr: *const i32 = mem::transmute(5is);
let ptr: *const i32 = mem::transmute(5us);
assert_eq!(hash(&ptr), 5);
}
unsafe {
let ptr: *mut i32 = mem::transmute(5is);
let ptr: *mut i32 = mem::transmute(5us);
assert_eq!(hash(&ptr), 5);
}
}

View File

@ -375,7 +375,7 @@ fn test_iterator_size_hint() {
assert_eq!(c.clone().enumerate().size_hint(), (uint::MAX, None));
assert_eq!(c.clone().chain(vi.clone().map(|&i| i)).size_hint(), (uint::MAX, None));
assert_eq!(c.clone().zip(vi.clone()).size_hint(), (10, Some(10)));
assert_eq!(c.clone().scan(0i, |_,_| Some(0)).size_hint(), (0, None));
assert_eq!(c.clone().scan(0, |_,_| Some(0)).size_hint(), (0, None));
assert_eq!(c.clone().filter(|_| false).size_hint(), (0, None));
assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::MAX, None));
assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None));
@ -389,7 +389,7 @@ fn test_iterator_size_hint() {
assert_eq!(vi.clone().enumerate().size_hint(), (10, Some(10)));
assert_eq!(vi.clone().chain(v2.iter()).size_hint(), (13, Some(13)));
assert_eq!(vi.clone().zip(v2.iter()).size_hint(), (3, Some(3)));
assert_eq!(vi.clone().scan(0i, |_,_| Some(0)).size_hint(), (0, Some(10)));
assert_eq!(vi.clone().scan(0, |_,_| Some(0)).size_hint(), (0, Some(10)));
assert_eq!(vi.clone().filter(|_| false).size_hint(), (0, Some(10)));
assert_eq!(vi.clone().map(|&i| i+1).size_hint(), (10, Some(10)));
assert_eq!(vi.filter_map(|_| Some(0)).size_hint(), (0, Some(10)));

View File

@ -223,7 +223,7 @@ fn test_ord() {
/* FIXME(#20575)
#[test]
fn test_collect() {
let v: Option<Vec<int>> = (0..0).map(|_| Some(0i)).collect();
let v: Option<Vec<int>> = (0..0).map(|_| Some(0)).collect();
assert!(v == Some(vec![]));
let v: Option<Vec<int>> = (0..3).map(|x| Some(x)).collect();

View File

@ -1198,7 +1198,7 @@ mod test_set {
#[test]
fn test_drain() {
let mut s: HashSet<int> = (1is..100).collect();
let mut s: HashSet<i32> = (1..100).collect();
// try this a bunch of times to make sure we don't screw up internal state.
for _ in 0..20 {
@ -1217,7 +1217,7 @@ mod test_set {
for _ in s.iter() { panic!("s should be empty!"); }
// reset to try again.
s.extend(1is..100);
s.extend(1..100);
}
}
}

View File

@ -1101,7 +1101,7 @@ mod test {
let dir = &tmpdir.join("di_readdir");
check!(mkdir(dir, old_io::USER_RWX));
let prefix = "foo";
for n in 0is..3 {
for n in 0..3 {
let f = dir.join(format!("{}.txt", n));
let mut w = check!(File::create(&f));
let msg_str = format!("{}{}", prefix, n);

View File

@ -1160,7 +1160,7 @@ mod test {
tx.send(TcpStream::connect(addr).unwrap()).unwrap();
});
let _l = rx.recv().unwrap();
for i in 0is..1001 {
for i in 0i32..1001 {
match a.accept() {
Ok(..) => break,
Err(ref e) if e.kind == TimedOut => {}
@ -1260,7 +1260,7 @@ mod test {
assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut);
s.set_timeout(Some(20));
for i in 0is..1001 {
for i in 0i32..1001 {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
@ -1318,7 +1318,7 @@ mod test {
let mut s = a.accept().unwrap();
s.set_write_timeout(Some(20));
for i in 0is..1001 {
for i in 0i32..1001 {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,

View File

@ -573,7 +573,7 @@ pub fn byte_lit(lit: &str) -> (u8, usize) {
if lit.len() == 1 {
(lit.as_bytes()[0], 1)
} else {
assert!(lit.as_bytes()[0] == b'\\', err(0is));
assert!(lit.as_bytes()[0] == b'\\', err(0));
let b = match lit.as_bytes()[1] {
b'"' => b'"',
b'n' => b'\n',

View File

@ -167,7 +167,7 @@ pub fn mk_printer(out: Box<old_io::Writer+'static>, linewidth: usize) -> Printer
let n: usize = 3 * linewidth;
debug!("mk_printer {}", linewidth);
let token: Vec<Token> = repeat(Token::Eof).take(n).collect();
let size: Vec<isize> = repeat(0is).take(n).collect();
let size: Vec<isize> = repeat(0).take(n).collect();
let scan_stack: Vec<usize> = repeat(0us).take(n).collect();
Printer {
out: out,

View File

@ -195,14 +195,14 @@ mod test {
let v: SmallVector<isize> = SmallVector::zero();
assert_eq!(0, v.len());
assert_eq!(1, SmallVector::one(1is).len());
assert_eq!(5, SmallVector::many(vec!(1is, 2, 3, 4, 5)).len());
assert_eq!(1, SmallVector::one(1).len());
assert_eq!(5, SmallVector::many(vec![1, 2, 3, 4, 5]).len());
}
#[test]
fn test_push_get() {
let mut v = SmallVector::zero();
v.push(1is);
v.push(1);
assert_eq!(1, v.len());
assert_eq!(&1, v.get(0));
v.push(2);
@ -215,7 +215,7 @@ mod test {
#[test]
fn test_from_iter() {
let v: SmallVector<isize> = (vec![1is, 2, 3]).into_iter().collect();
let v: SmallVector<isize> = (vec![1, 2, 3]).into_iter().collect();
assert_eq!(3, v.len());
assert_eq!(&1, v.get(0));
assert_eq!(&2, v.get(1));
@ -228,11 +228,11 @@ mod test {
let v: Vec<isize> = v.into_iter().collect();
assert_eq!(Vec::new(), v);
let v = SmallVector::one(1is);
assert_eq!(vec!(1is), v.into_iter().collect::<Vec<_>>());
let v = SmallVector::one(1);
assert_eq!(vec![1], v.into_iter().collect::<Vec<_>>());
let v = SmallVector::many(vec!(1is, 2is, 3is));
assert_eq!(vec!(1is, 2is, 3is), v.into_iter().collect::<Vec<_>>());
let v = SmallVector::many(vec![1, 2, 3]);
assert_eq!(vec!(1, 2, 3), v.into_iter().collect::<Vec<_>>());
}
#[test]
@ -244,12 +244,12 @@ mod test {
#[test]
#[should_fail]
fn test_expect_one_many() {
SmallVector::many(vec!(1is, 2)).expect_one("");
SmallVector::many(vec!(1, 2)).expect_one("");
}
#[test]
fn test_expect_one_one() {
assert_eq!(1is, SmallVector::one(1is).expect_one(""));
assert_eq!(1is, SmallVector::many(vec!(1is)).expect_one(""));
assert_eq!(1, SmallVector::one(1).expect_one(""));
assert_eq!(1, SmallVector::many(vec!(1)).expect_one(""));
}
}

View File

@ -104,8 +104,8 @@ impl<'a, T> Iterator for ListIterator<'a, T> {
// corresponding mirrored piece), with, as minimum coordinates, (0,
// 0). If all is false, only generate half of the possibilities (used
// to break the symmetry of the board).
fn transform(piece: Vec<(isize, isize)> , all: bool) -> Vec<Vec<(isize, isize)>> {
let mut res: Vec<Vec<(isize, isize)>> =
fn transform(piece: Vec<(i32, i32)> , all: bool) -> Vec<Vec<(i32, i32)>> {
let mut res: Vec<Vec<(i32, i32)>> =
// rotations
iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect())
.take(if all {6} else {3})
@ -133,7 +133,7 @@ fn transform(piece: Vec<(isize, isize)> , all: bool) -> Vec<Vec<(isize, isize)>>
// Takes a piece with minimum coordinate (0, 0) (as generated by
// transform). Returns the corresponding mask if p translated by (dy,
// dx) is on the board.
fn mask(dy: isize, dx: isize, id: usize, p: &Vec<(isize, isize)>) -> Option<u64> {
fn mask(dy: i32, dx: i32, id: usize, p: &Vec<(i32, i32)>) -> Option<u64> {
let mut m = 1 << (50 + id);
for &(y, x) in p.iter() {
let x = x + dx + (y + (dy % 2)) / 2;
@ -164,12 +164,12 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > {
// To break the central symmetry of the problem, every
// transformation must be taken except for one piece (piece 3
// here).
let transforms: Vec<Vec<Vec<(isize, isize)>>> =
let transforms: Vec<Vec<Vec<(i32, i32)>>> =
pieces.into_iter().enumerate()
.map(|(id, p)| transform(p, id != 3))
.collect();
(0is..50).map(|yx| {
(0i32..50).map(|yx| {
transforms.iter().enumerate().map(|(id, t)| {
t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect()
}).collect()

View File

@ -9,18 +9,18 @@
// except according to those terms.
fn main() {
let _x: isize = [1is, 2, 3];
let _x: i32 = [1i32, 2, 3];
//~^ ERROR mismatched types
//~| expected `isize`
//~| found `[isize; 3]`
//~| expected isize
//~| expected `i32`
//~| found `[i32; 3]`
//~| expected i32
//~| found array of 3 elements
let x: &[isize] = &[1, 2, 3];
let _y: &isize = x;
let x: &[i32] = &[1i32, 2, 3];
let _y: &i32 = x;
//~^ ERROR mismatched types
//~| expected `&isize`
//~| found `&[isize]`
//~| expected isize
//~| expected `&i32`
//~| found `&[i32]`
//~| expected i32
//~| found slice
}

View File

@ -11,5 +11,5 @@
// Test that the old fixed length array syntax is a parsing error.
fn main() {
let _x: [isize, ..3] = [0is, 1, 2]; //~ ERROR
let _x: [isize, ..3] = [0, 1, 2]; //~ ERROR
}

View File

@ -11,5 +11,5 @@
// Test that the old repeating array syntax gives an error.
fn main() {
let _ = [0is, ..3]; //~ ERROR
let _ = [0, ..3]; //~ ERROR
}

View File

@ -45,7 +45,7 @@ pub fn baz(x: &Foo<A=Bar>) {
pub fn main() {
let a = 42is;
let a = 42;
foo1(a);
//~^ ERROR type mismatch resolving
//~| expected usize

View File

@ -28,15 +28,15 @@ impl Foo for isize {
}
pub fn main() {
let a = &42is as &Foo<A=usize, B=char>;
let a = &42 as &Foo<A=usize, B=char>;
let b = &42is as &Foo<A=usize>;
let b = &42 as &Foo<A=usize>;
//~^ ERROR the value of the associated type `B` (from the trait `Foo`) must be specified
let c = &42is as &Foo<B=char>;
let c = &42 as &Foo<B=char>;
//~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified
let d = &42is as &Foo;
let d = &42 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
}

View File

@ -14,8 +14,8 @@ pub trait Foo {
type A;
}
impl Foo for isize {
type A = usize;
impl Foo for i32 {
type A = u32;
}
pub fn f1<T: Foo>(a: T, x: T::A) {}
@ -24,33 +24,33 @@ pub fn f2<T: Foo>(a: T) -> T::A {
}
pub fn f1_int_int() {
f1(2is, 4is);
f1(2i32, 4i32);
//~^ ERROR mismatched types
//~| expected usize
//~| found isize
//~| expected u32
//~| found i32
}
pub fn f1_int_uint() {
f1(2is, 4us);
f1(2i32, 4u32);
}
pub fn f1_uint_uint() {
f1(2us, 4us);
f1(2u32, 4u32);
//~^ ERROR the trait `Foo` is not implemented
//~| ERROR the trait `Foo` is not implemented
}
pub fn f1_uint_int() {
f1(2us, 4is);
f1(2u32, 4i32);
//~^ ERROR the trait `Foo` is not implemented
//~| ERROR the trait `Foo` is not implemented
}
pub fn f2_int() {
let _: isize = f2(2is);
let _: i32 = f2(2i32);
//~^ ERROR mismatched types
//~| expected `isize`
//~| found `usize`
//~| expected `i32`
//~| found `u32`
}
pub fn main() { }

View File

@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
static i: String = 10is;
static i: String = 10i32;
//~^ ERROR mismatched types
//~| expected `collections::string::String`
//~| found `isize`
//~| found `i32`
//~| expected struct `collections::string::String`
//~| found isize
//~| found i32
fn main() { println!("{}", i); }

View File

@ -9,6 +9,6 @@
// except according to those terms.
fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging
3is
3
}
fn main() { }

View File

@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:`&&` cannot be applied to type `isize`
// error-pattern:`&&` cannot be applied to type `i32`
fn main() { let x = 1is && 2is; }
fn main() { let x = 1i32 && 2i32; }

View File

@ -16,28 +16,28 @@ struct Foo(Box<isize>, isize);
struct Bar(isize, isize);
fn main() {
let x = (box 1is, 2is);
let x = (box 1, 2);
let r = &x.0;
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
let mut x = (1is, 2is);
let mut x = (1, 2);
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 = (1is, 2is);
let mut x = (1, 2);
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 1is, 2is);
let x = Foo(box 1, 2);
let r = &x.0;
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
let mut x = Bar(1is, 2is);
let mut x = Bar(1, 2);
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(1is, 2is);
let mut x = Bar(1, 2);
let a = &mut x.0;
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
}

View File

@ -12,7 +12,7 @@
// anonymous fields of a tuple vs the same anonymous field.
fn distinct_variant() {
let mut y = (1is, 2is);
let mut y = (1, 2);
let a = match y {
(ref mut a, _) => a
@ -27,7 +27,7 @@ fn distinct_variant() {
}
fn same_variant() {
let mut y = (1is, 2is);
let mut y = (1, 2);
let a = match y {
(ref mut a, _) => a

View File

@ -12,9 +12,9 @@
#![feature(box_syntax)]
fn f() {
let mut a = [box 0is, box 1is];
let mut a = [box 0, box 1];
drop(a[0]);
a[1] = box 2is;
a[1] = box 2;
drop(a[0]); //~ ERROR use of moved value: `a[..]`
}

View File

@ -11,14 +11,14 @@
fn foo() -> isize {
let x: isize;
while 1is != 2 {
while 1 != 2 {
break;
x = 0;
}
println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
return 17is;
return 17;
}
fn main() { println!("{}", foo()); }

View File

@ -22,37 +22,37 @@ fn set(x: &mut isize) {
}
fn a() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| x = 4;
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
}
fn b() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| set(&mut x);
let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x`
}
fn c() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| set(&mut x);
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
}
fn d() {
let mut x = 3is;
let mut x = 3;
let c2 = |&mut:| x * 5;
x = 5; //~ ERROR cannot assign
}
fn e() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| get(&x);
x = 5; //~ ERROR cannot assign
}
fn f() {
let mut x = box 3is;
let mut x = box 3;
let c1 = |&mut:| get(&*x);
*x = 5; //~ ERROR cannot assign
}

View File

@ -15,7 +15,7 @@
#![feature(box_syntax)]
fn a() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| x = 4;
let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once
}
@ -25,19 +25,19 @@ fn set(x: &mut isize) {
}
fn b() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| set(&mut x);
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
}
fn c() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| x = 5;
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
}
fn d() {
let mut x = 3is;
let mut x = 3;
let c1 = |&mut:| x = 5;
let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure)
//~^ ERROR cannot borrow `x` as mutable more than once

View File

@ -17,7 +17,7 @@ struct Foo {
}
fn main() {
let mut y = 1is;
let mut y = 1;
let x = Some(&mut y);
for &a in x.iter() { //~ ERROR cannot move out
}
@ -28,7 +28,7 @@ fn main() {
for &a in f.a.iter() { //~ ERROR cannot move out
}
let x = Some(box 1is);
let x = Some(box 1);
for &a in x.iter() { //~ ERROR cannot move out
}
}

View File

@ -11,6 +11,6 @@
fn foo(x: isize) { println!("{}", x); }
fn main() {
let x: isize; if 1is > 2 { x = 10; }
let x: isize; if 1 > 2 { x = 10; }
foo(x); //~ ERROR use of possibly uninitialized variable: `x`
}

View File

@ -12,7 +12,7 @@ fn foo(x: isize) { println!("{}", x); }
fn main() {
let x: isize;
if 1is > 2 {
if 1 > 2 {
println!("whoops");
} else {
x = 10;

View File

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let mut _a = 3is;
let mut _a = 3;
let _b = &mut _a;
{
let _c = &*_b;

View File

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = Some(box 1is);
let x = Some(box 1);
match x {
Some(ref _y) => {
let _a = x; //~ ERROR cannot move

View File

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = Some(box 1is);
let x = Some(box 1);
match x {
Some(ref y) => {
let _b = *y; //~ ERROR cannot move out

View File

@ -41,7 +41,7 @@ fn block_overarching_alias_mut() {
let mut v = box 3;
let mut x = &mut v;
for _ in 0is..3 {
for _ in 0..3 {
borrow(&*v); //~ ERROR cannot borrow
}
*x = box 5;

View File

@ -19,10 +19,10 @@ fn separate_arms() {
None => {
// It is ok to reassign x here, because there is in
// fact no outstanding loan of x!
x = Some(0is);
x = Some(0);
}
Some(ref _i) => {
x = Some(1is); //~ ERROR cannot assign
x = Some(1); //~ ERROR cannot assign
}
}
x.clone(); // just to prevent liveness warnings

View File

@ -9,7 +9,7 @@
// except according to those terms.
fn f() {
let x = [1is].iter(); //~ ERROR borrowed value does not live long enough
let x = [1].iter(); //~ ERROR borrowed value does not live long enough
//~^ NOTE reference must be valid for the block suffix following statement
//~^^ HELP consider using a `let` binding to increase its lifetime
}

View File

@ -17,7 +17,7 @@ fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
}
fn box_imm() {
let v = box 3is;
let v = box 3;
let _w = &v;
Thread::spawn(move|| {
println!("v={}", *v);
@ -26,7 +26,7 @@ fn box_imm() {
}
fn box_imm_explicit() {
let v = box 3is;
let v = box 3;
let _w = &v;
Thread::spawn(move|| {
println!("v={}", *v);

View File

@ -19,7 +19,7 @@ struct S {
}
pub fn main() {
match 1is {
match 1 {
x => {
x += 1; //~ ERROR re-assignment of immutable variable `x`
}
@ -37,13 +37,13 @@ pub fn main() {
}
}
match (1is,) {
match (1,) {
(x,) => {
x += 1; //~ ERROR re-assignment of immutable variable `x`
}
}
match [1is,2,3] {
match [1,2,3] {
[x,_,_] => {
x += 1; //~ ERROR re-assignment of immutable variable `x`
}

View File

@ -14,7 +14,7 @@
#![feature(box_syntax)]
fn main() {
let a = box box 2is;
let a = box box 2;
let b = &a;
let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed

View File

@ -11,6 +11,6 @@
use std::rc::Rc;
pub fn main() {
let _x = Rc::new(vec!(1is, 2)).into_iter();
let _x = Rc::new(vec!(1, 2)).into_iter();
//~^ ERROR cannot move out of borrowed content
}

View File

@ -15,9 +15,9 @@ use std::thread::Thread;
fn borrow<T>(_: &T) { }
fn different_vars_after_borrows() {
let x1 = box 1is;
let x1 = box 1;
let p1 = &x1;
let x2 = box 2is;
let x2 = box 2;
let p2 = &x2;
Thread::spawn(move|| {
drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
@ -28,9 +28,9 @@ fn different_vars_after_borrows() {
}
fn different_vars_after_moves() {
let x1 = box 1is;
let x1 = box 1;
drop(x1);
let x2 = box 2is;
let x2 = box 2;
drop(x2);
Thread::spawn(move|| {
drop(x1); //~ ERROR capture of moved value: `x1`
@ -39,7 +39,7 @@ fn different_vars_after_moves() {
}
fn same_var_after_borrow() {
let x = box 1is;
let x = box 1;
let p = &x;
Thread::spawn(move|| {
drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
@ -49,7 +49,7 @@ fn same_var_after_borrow() {
}
fn same_var_after_move() {
let x = box 1is;
let x = box 1;
drop(x);
Thread::spawn(move|| {
drop(x); //~ ERROR capture of moved value: `x`

View File

@ -25,7 +25,7 @@ impl<T> Index<usize> for MyVec<T> {
}
fn main() {
let v = MyVec { data: vec!(box 1is, box 2, box 3) };
let v = MyVec { data: vec!(box 1, box 2, box 3) };
let good = &v[0]; // Shouldn't fail here
let bad = v[0];
//~^ ERROR cannot move out of indexed content

View File

@ -13,7 +13,7 @@
fn borrow(_v: &isize) {}
fn local() {
let mut v = box 3is;
let mut v = box 3;
borrow(&*v);
}
@ -32,27 +32,27 @@ fn local_recs() {
}
fn aliased_imm() {
let mut v = box 3is;
let mut v = box 3;
let _w = &v;
borrow(&*v);
}
fn aliased_mut() {
let mut v = box 3is;
let mut v = box 3;
let _w = &mut v;
borrow(&*v); //~ ERROR cannot borrow `*v`
}
fn aliased_other() {
let mut v = box 3is;
let mut w = box 4is;
let mut v = box 3;
let mut w = box 4;
let _x = &mut w;
borrow(&*v);
}
fn aliased_other_reassign() {
let mut v = box 3is;
let mut w = box 4is;
let mut v = box 3;
let mut w = box 4;
let mut _x = &mut w;
_x = &mut v;
borrow(&*v); //~ ERROR cannot borrow `*v`

View File

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let mut a = [1is, 2, 3, 4];
let mut a = [1, 2, 3, 4];
let t = match a {
[1, 2, tail..] => tail,
_ => unreachable!()

View File

@ -12,7 +12,7 @@
#![feature(box_syntax)]
fn a() {
let mut vec = [box 1is, box 2, box 3];
let mut vec = [box 1, box 2, box 3];
match vec {
[box ref _a, _, _] => {
vec[0] = box 4; //~ ERROR cannot assign
@ -21,7 +21,7 @@ fn a() {
}
fn b() {
let mut vec = vec!(box 1is, box 2, box 3);
let mut vec = vec!(box 1, box 2, box 3);
let vec: &mut [Box<isize>] = vec.as_mut_slice();
match vec {
[_b..] => {
@ -31,7 +31,7 @@ fn b() {
}
fn c() {
let mut vec = vec!(box 1is, box 2, box 3);
let mut vec = vec!(box 1, box 2, box 3);
let vec: &mut [Box<isize>] = vec.as_mut_slice();
match vec {
[_a, //~ ERROR cannot move out
@ -49,7 +49,7 @@ fn c() {
}
fn d() {
let mut vec = vec!(box 1is, box 2, box 3);
let mut vec = vec!(box 1, box 2, box 3);
let vec: &mut [Box<isize>] = vec.as_mut_slice();
match vec {
[_a.., //~ ERROR cannot move out
@ -60,7 +60,7 @@ fn d() {
}
fn e() {
let mut vec = vec!(box 1is, box 2, box 3);
let mut vec = vec!(box 1, box 2, box 3);
let vec: &mut [Box<isize>] = vec.as_mut_slice();
match vec {
[_a, _b, _c] => {} //~ ERROR cannot move out

View File

@ -11,7 +11,7 @@
fn test(cond: bool) {
let v;
while cond {
v = 3is;
v = 3;
break;
}
println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`

View File

@ -10,7 +10,7 @@
fn f() -> isize {
let mut x: isize;
while 1is == 1 { x = 10; }
while 1 == 1 { x = 10; }
return x; //~ ERROR use of possibly uninitialized variable: `x`
}

View File

@ -22,6 +22,6 @@ impl <T: Sync> Foo for T { }
fn main() {
let (tx, rx) = channel();
1193182is.foo(tx);
assert!(rx.recv() == 1193182is);
1193182.foo(tx);
assert!(rx.recv() == 1193182);
}

View File

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let x = 1is;
let x = 1;
move|:| { x = 2; };
//~^ ERROR: cannot assign to immutable captured outer variable

View File

@ -11,10 +11,10 @@
// Tests that we forbid coercion from `[T; n]` to `&[T]`
fn main() {
let _: &[isize] = [0is];
let _: &[i32] = [0i32];
//~^ ERROR mismatched types
//~| expected `&[isize]`
//~| found `[isize; 1]`
//~| expected `&[i32]`
//~| found `[i32; 1]`
//~| expected &-ptr
//~| found array of 1 elements
}

View File

@ -27,29 +27,29 @@ fn main() {
// if n > m, it's a type mismatch error.
// n < m
let &x = &(&1is as &T);
let &x = &&(&1is as &T);
let &&x = &&(&1is as &T);
let &x = &(&1 as &T);
let &x = &&(&1 as &T);
let &&x = &&(&1 as &T);
// n == m
let &x = &1is as &T; //~ ERROR type `&T` cannot be dereferenced
let &&x = &(&1is as &T); //~ ERROR type `&T` cannot be dereferenced
let box x = box 1is as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced
let &x = &1 as &T; //~ ERROR type `&T` cannot be dereferenced
let &&x = &(&1 as &T); //~ ERROR type `&T` cannot be dereferenced
let box x = box 1 as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced
// n > m
let &&x = &1is as &T;
let &&x = &1 as &T;
//~^ ERROR mismatched types
//~| expected `T`
//~| found `&_`
//~| expected trait T
//~| found &-ptr
let &&&x = &(&1is as &T);
let &&&x = &(&1 as &T);
//~^ ERROR mismatched types
//~| expected `T`
//~| found `&_`
//~| expected trait T
//~| found &-ptr
let box box x = box 1is as Box<T>;
let box box x = box 1 as Box<T>;
//~^ ERROR mismatched types
//~| expected `T`
//~| found `Box<_>`

View File

@ -18,7 +18,7 @@ struct Fat<T: ?Sized> {
}
pub fn main() {
let f: Fat<[isize; 3]> = Fat { ptr: [5is, 6, 7] };
let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] };
let g: &Fat<[isize]> = &f;
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
//~^ ERROR the trait `core::marker::Sized` is not implemented

View File

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let x = [ 1is, 2, 3, 4, 5 ];
let x = [ 1, 2, 3, 4, 5 ];
match x {
[ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches
[ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches

View File

@ -34,7 +34,7 @@ fn main() {
//~| expected ()
//~| found box
needs_fn(1is);
needs_fn(1);
//~^ ERROR `core::ops::Fn<(isize,)>`
//~| ERROR `core::ops::Fn<(isize,)>`
}

View File

@ -10,6 +10,6 @@
fn main() {
for
&1is //~ ERROR refutable pattern in `for` loop binding
in [1is].iter() {}
&1 //~ ERROR refutable pattern in `for` loop binding
in [1].iter() {}
}

View File

@ -10,7 +10,7 @@
fn main() {
let mut my_stuff = std::collections::HashMap::new();
my_stuff.insert(0is, 42is);
my_stuff.insert(0, 42);
let (_, thing) = my_stuff.iter().next().unwrap();

View File

@ -10,7 +10,7 @@
fn main() {
let mut my_stuff = std::collections::HashMap::new();
my_stuff.insert(0is, 42is);
my_stuff.insert(0, 42);
let mut it = my_stuff.iter();
my_stuff.insert(1, 43); //~ ERROR cannot borrow

View File

@ -9,10 +9,10 @@
// except according to those terms.
fn main() {
let x = if true { 10is } else { 10us };
let x = if true { 10i32 } else { 10u32 };
//~^ ERROR if and else have incompatible types
//~| expected `isize`
//~| found `usize`
//~| expected isize
//~| found usize
//~| expected `i32`
//~| found `u32`
//~| expected i32
//~| found u32
}

View File

@ -20,20 +20,20 @@ fn macros() {
}}
}
foo!(a, 1is, { //~ ERROR irrefutable if-let
foo!(a, 1, { //~ ERROR irrefutable if-let
println!("irrefutable pattern");
});
bar!(a, 1is, { //~ ERROR irrefutable if-let
bar!(a, 1, { //~ ERROR irrefutable if-let
println!("irrefutable pattern");
});
}
pub fn main() {
if let a = 1is { //~ ERROR irrefutable if-let
if let a = 1 { //~ ERROR irrefutable if-let
println!("irrefutable pattern");
}
if let a = 1is { //~ ERROR irrefutable if-let
if let a = 1 { //~ ERROR irrefutable if-let
println!("irrefutable pattern");
} else if true {
println!("else-if in irrefutable if-let");
@ -41,15 +41,15 @@ pub fn main() {
println!("else in irrefutable if-let");
}
if let 1is = 2is {
if let 1 = 2 {
println!("refutable pattern");
} else if let a = 1is { //~ ERROR irrefutable if-let
} else if let a = 1 { //~ ERROR irrefutable if-let
println!("irrefutable pattern");
}
if true {
println!("if");
} else if let a = 1is { //~ ERROR irrefutable if-let
} else if let a = 1 { //~ ERROR irrefutable if-let
println!("irrefutable pattern");
}
}

View File

@ -11,5 +11,5 @@
use std::num::SignedInt;
fn main() {
let _f = 10is.abs; //~ ERROR attempted to take value of method
let _f = 10.abs; //~ ERROR attempted to take value of method
}

View File

@ -11,7 +11,7 @@
// issue #17123
fn main() {
100000000000000000000000000000000is //~ ERROR int literal is too large
100000000000000000000000000000000 //~ ERROR int literal is too large
; // the span shouldn't point to this.
}

View File

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = box 1is;
let x = box 1;
let f = move|:| {
let _a = x;
drop(x);

View File

@ -11,6 +11,6 @@
// This file must never have a trailing newline
fn main() {
let x = Some(3is);
let y = x.as_ref().unwrap_or(&5is); //~ ERROR: borrowed value does not live long enough
let x = Some(3);
let y = x.as_ref().unwrap_or(&5); //~ ERROR: borrowed value does not live long enough
}

View File

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn blah() -> isize { //~ ERROR not all control paths return a value
1is
fn blah() -> i32 { //~ ERROR not all control paths return a value
1i32
; //~ HELP consider removing this semicolon:
}

View File

@ -9,8 +9,8 @@
// except according to those terms.
fn main() {
let mut v = vec!(1is);
let mut f = |&mut:| v.push(2is);
let mut v = vec!(1);
let mut f = |&mut:| v.push(2);
let _w = v; //~ ERROR: cannot move out of `v`
f();

View File

@ -12,7 +12,7 @@
fn main() {
let r = {
let x = box 42is;
let x = box 42;
let f = move|:| &x; //~ ERROR: `x` does not live long enough
f()
};

View File

@ -17,7 +17,7 @@ fn main() {
loop {
let tx = tx;
//~^ ERROR: use of moved value: `tx`
tx.send(1is);
tx.send(1);
}
});
}

View File

@ -11,7 +11,7 @@
// Regression test for issue #1362 - without that fix the span will be bogus
// no-reformat
fn main() {
let x: usize = 20is; //~ ERROR mismatched types
let x: u32 = 20i32; //~ ERROR mismatched types
}
// NOTE: Do not add any extra lines as the line number the error is
// on is significant; an error later in the source file might not

View File

@ -10,8 +10,8 @@
// Regression test for issue #1448 and #1386
fn foo(a: usize) -> usize { a }
fn foo(a: u32) -> u32 { a }
fn main() {
println!("{}", foo(10is)); //~ ERROR mismatched types
println!("{}", foo(10i32)); //~ ERROR mismatched types
}

View File

@ -30,6 +30,6 @@ fn make_shower<T>(x: T) -> Debuger<T> {
}
pub fn main() {
let show3 = make_shower(3is);
let show3 = make_shower(3);
show3();
}

View File

@ -18,7 +18,7 @@
macro_rules! f { () => (n) }
fn main() -> (){
for n in 0is..1 {
for n in 0..1 {
println!("{}", f!()); //~ ERROR unresolved name `n`
}
}

View File

@ -10,7 +10,7 @@
fn main() {
let v = vec![
&3is
&3
//~^ ERROR borrowed value does not live long enough
];

View File

@ -23,10 +23,10 @@ impl Drop for Enum {
}
fn main() {
let foo = X(1is);
let foo = X(1);
drop(foo);
match foo { //~ ERROR use of moved value
X(1is) => (),
X(1) => (),
_ => unreachable!()
}

View File

@ -13,7 +13,7 @@ enum Foo {
}
fn main() {
match Foo::Bar(1is) {
match Foo::Bar(1) {
Foo { i } => () //~ ERROR `Foo` does not name a struct or a struct variant
}
}

View File

@ -14,8 +14,8 @@ enum MyOption<T> {
}
fn main() {
match MyOption::MySome(42is) {
MyOption::MySome { x: 42is } => (),
match MyOption::MySome(42) {
MyOption::MySome { x: 42 } => (),
//~^ ERROR `MyOption::MySome` does not name a struct or a struct variant
_ => (),
}

View File

@ -25,6 +25,6 @@ impl Pair<
}
fn main() {
let result = &Pair("shane", 1is);
let result = &Pair("shane", 1);
result.say();
}

View File

@ -12,7 +12,7 @@
#![feature(core)]
fn main() {
for _ in 1is..101 {
for _ in 1..101 {
let x = (); //~ ERROR: unused variable: `x`
match () {
a => {} //~ ERROR: unused variable: `a`

View File

@ -9,6 +9,6 @@
// except according to those terms.
fn main() {
let t = (42is, 42is);
let t = (42, 42);
t.0::<isize>; //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `::`
}

View File

@ -10,9 +10,9 @@
// compile-flags: -D while-true
fn main() {
let mut i = 0is;
let mut i = 0;
while true { //~ ERROR denote infinite loops with loop
i += 1is;
if i == 5is { break; }
i += 1;
if i == 5 { break; }
}
}

View File

@ -14,7 +14,7 @@ struct Obj {
impl Obj {
pub fn boom() -> bool {
return 1is+1 == 2
return 1+1 == 2
}
pub fn chirp(&self) {
self.boom(); //~ ERROR `&Obj` does not implement any method in scope named `boom`
@ -24,5 +24,5 @@ impl Obj {
fn main() {
let o = Obj { member: 0 };
o.chirp();
1is + 1;
1 + 1;
}

View File

@ -18,6 +18,6 @@ fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
}
fn main() {
let v = &5is;
let v = &5;
println!("{}", f(v).call_mut(()));
}

View File

@ -23,16 +23,16 @@ fn main() {
_ => ()
}
match &Some(42is) {
match &Some(42i32) {
Some(x) => (),
//~^ ERROR mismatched types
//~| expected `&core::option::Option<isize>`
//~| expected `&core::option::Option<i32>`
//~| found `core::option::Option<_>`
//~| expected &-ptr
//~| found enum `core::option::Option`
None => ()
//~^ ERROR mismatched types
//~| expected `&core::option::Option<isize>`
//~| expected `&core::option::Option<i32>`
//~| found `core::option::Option<_>`
//~| expected &-ptr
//~| found enum `core::option::Option`

View File

@ -19,7 +19,7 @@ impl<T:Copy> Foo for T {
fn take_param<T:Foo>(foo: &T) { }
fn main() {
let x = box 3is;
let x = box 3;
take_param(&x);
//~^ ERROR the trait `core::marker::Copy` is not implemented
}

View File

@ -23,12 +23,12 @@ impl<T:Copy> Foo for T {
fn take_param<T:Foo>(foo: &T) { }
fn a() {
let x = box 3is;
let x = box 3;
take_param(&x); //~ ERROR `core::marker::Copy` is not implemented
}
fn b() {
let x = box 3is;
let x = box 3;
let y = &x;
let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented
}

View File

@ -91,7 +91,7 @@ pub fn pub_fn() {
let e = used_enum::foo3;
SemiUsedStruct::la_la_la();
let i = 1is;
let i = 1;
match i {
USED_STATIC => (),
USED_CONST => (),

View File

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

View File

@ -17,7 +17,7 @@ impl X {
}
fn foo() -> isize {
return (1is); //~ ERROR unnecessary parentheses around `return` value
return (1); //~ ERROR unnecessary parentheses around `return` value
}
fn bar() -> X {
return (X { y: true }); //~ ERROR unnecessary parentheses around `return` value
@ -32,8 +32,8 @@ fn main() {
match (true) { //~ ERROR unnecessary parentheses around `match` head expression
_ => {}
}
if let 1is = (1is) {} //~ ERROR unnecessary parentheses around `if let` head expression
while let 1is = (2is) {} //~ ERROR unnecessary parentheses around `while let` head expression
if let 1 = (1) {} //~ ERROR unnecessary parentheses around `if let` head expression
while let 1 = (2) {} //~ ERROR unnecessary parentheses around `while let` head expression
let v = X { y: false };
// struct lits needs parens, so these shouldn't warn.
if (v == X { y: true }) {}
@ -47,7 +47,7 @@ fn main() {
_ => {}
}
let mut _a = (0is); //~ ERROR unnecessary parentheses around assigned value
_a = (0is); //~ ERROR unnecessary parentheses around assigned value
_a += (1is); //~ ERROR unnecessary parentheses around assigned value
let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value
_a = (0); //~ ERROR unnecessary parentheses around assigned value
_a += (1); //~ ERROR unnecessary parentheses around assigned value
}

View File

@ -54,7 +54,7 @@ mod bar {
pub mod c {
use foo::Point;
use foo::Square; //~ ERROR unused import
pub fn cc(p: Point) -> isize { return 2is * (p.x + p.y); }
pub fn cc(p: Point) -> isize { return 2 * (p.x + p.y); }
}
#[allow(unused_imports)]
@ -65,8 +65,8 @@ mod bar {
fn main() {
cal(foo::Point{x:3, y:9});
let mut a = 3is;
let mut b = 4is;
let mut a = 3;
let mut b = 4;
swap(&mut a, &mut b);
test::C.b();
let _a = foo();

View File

@ -18,16 +18,16 @@
fn main() {
// negative cases
let mut a = 3is; //~ ERROR: variable does not need to be mutable
let mut a = 2is; //~ ERROR: variable does not need to be mutable
let mut b = 3is; //~ ERROR: variable does not need to be mutable
let mut a = vec!(3is); //~ ERROR: variable does not need to be mutable
let (mut a, b) = (1is, 2is); //~ ERROR: variable does not need to be mutable
let mut a = 3; //~ ERROR: variable does not need to be mutable
let mut a = 2; //~ ERROR: variable does not need to be mutable
let mut b = 3; //~ ERROR: variable does not need to be mutable
let mut a = vec!(3); //~ ERROR: variable does not need to be mutable
let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable
match 30is {
match 30 {
mut x => {} //~ ERROR: variable does not need to be mutable
}
match (30is, 2is) {
match (30, 2) {
(mut x, 1) | //~ ERROR: variable does not need to be mutable
(mut x, 2) |
(mut x, 3) => {
@ -35,28 +35,28 @@ fn main() {
_ => {}
}
let x = |&: mut y: isize| 10is; //~ ERROR: variable does not need to be mutable
let x = |&: mut y: isize| 10; //~ ERROR: variable does not need to be mutable
fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable
// positive cases
let mut a = 2is;
a = 3is;
let mut a = 2;
a = 3;
let mut a = Vec::new();
a.push(3is);
a.push(3);
let mut a = Vec::new();
callback(|| {
a.push(3is);
a.push(3);
});
let (mut a, b) = (1is, 2is);
let (mut a, b) = (1, 2);
a = 34;
match 30is {
match 30 {
mut x => {
x = 21is;
x = 21;
}
}
match (30is, 2is) {
match (30, 2) {
(mut x, 1) |
(mut x, 2) |
(mut x, 3) => {
@ -65,12 +65,12 @@ fn main() {
_ => {}
}
let x = |&mut: mut y: isize| y = 32is;
fn nothing(mut foo: isize) { foo = 37is; }
let x = |&mut: mut y: isize| y = 32;
fn nothing(mut foo: isize) { foo = 37; }
// leading underscore should avoid the warning, just like the
// unused variable lint.
let mut _allowed = 1is;
let mut _allowed = 1;
}
fn callback<F>(f: F) where F: FnOnce() {}
@ -78,6 +78,6 @@ fn callback<F>(f: F) where F: FnOnce() {}
// make sure the lint attribute can be turned off
#[allow(unused_mut)]
fn foo(mut a: isize) {
let mut a = 3is;
let mut b = vec!(2is);
let mut a = 3;
let mut b = vec!(2);
}

View File

@ -11,7 +11,7 @@
// Tests that a function with a ! annotation always actually fails
fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging
println!("{}", 3is);
println!("{}", 3);
}
fn main() { bad_bang(5us); }

View File

@ -10,11 +10,11 @@
//
// regression test for #8005
macro_rules! test { () => { fn foo() -> isize { 1is; } } }
//~^ ERROR not all control paths return a value
//~^^ HELP consider removing this semicolon
macro_rules! test { () => { fn foo() -> i32 { 1i32; } } }
//~^ ERROR not all control paths return a value
//~^^ HELP consider removing this semicolon
fn no_return() -> isize {} //~ ERROR not all control paths return a value
fn no_return() -> i32 {} //~ ERROR not all control paths return a value
fn bar(x: u32) -> u32 { //~ ERROR not all control paths return a value
x * 2; //~ HELP consider removing this semicolon

View File

@ -31,40 +31,40 @@ fn f1d() {
}
fn f2() {
let x = 3is;
let x = 3;
//~^ ERROR unused variable: `x`
}
fn f3() {
let mut x = 3is;
let mut x = 3;
//~^ ERROR variable `x` is assigned to, but never used
x += 4is;
x += 4;
//~^ ERROR value assigned to `x` is never read
}
fn f3b() {
let mut z = 3is;
let mut z = 3;
//~^ ERROR variable `z` is assigned to, but never used
loop {
z += 4is;
z += 4;
}
}
#[allow(unused_variables)]
fn f3c() {
let mut z = 3is;
loop { z += 4is; }
let mut z = 3;
loop { z += 4; }
}
#[allow(unused_variables)]
#[allow(unused_assignments)]
fn f3d() {
let mut x = 3is;
x += 4is;
let mut x = 3;
x += 4;
}
fn f4() {
match Some(3is) {
match Some(3) {
Some(i) => {
//~^ ERROR unused variable: `i`
}
@ -77,7 +77,7 @@ enum tri {
}
fn f4b() -> isize {
match tri::a(3is) {
match tri::a(3) {
tri::a(i) | tri::b(i) | tri::c(i) => {
i
}
@ -85,17 +85,17 @@ fn f4b() -> isize {
}
fn f5a() {
for x in 1is..10 { }
for x in 1..10 { }
//~^ ERROR unused variable: `x`
}
fn f5b() {
for (x, _) in [1is, 2, 3].iter().enumerate() { }
for (x, _) in [1, 2, 3].iter().enumerate() { }
//~^ ERROR unused variable: `x`
}
fn f5c() {
for (_, x) in [1is, 2, 3].iter().enumerate() {
for (_, x) in [1, 2, 3].iter().enumerate() {
//~^ ERROR unused variable: `x`
continue;
std::os::set_exit_status(*x); //~ WARNING unreachable statement

View File

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = box 5is;
let x = box 5;
let y = x;
println!("{}", *x); //~ ERROR use of moved value: `*x`
y.clone();

View File

@ -14,7 +14,7 @@ fn forever() -> ! {
loop {
break;
}
return 42is; //~ ERROR `return` in a function declared as diverging
return 42; //~ ERROR `return` in a function declared as diverging
}
fn main() {

View File

@ -9,9 +9,9 @@
// except according to those terms.
fn main() {
match 1is {
1is => 1is,
2us => 1is, //~ ERROR mismatched types
_ => 2is,
match 1i32 {
1i32 => 1,
2u32 => 1, //~ ERROR mismatched types
_ => 2,
};
}

View File

@ -9,6 +9,6 @@
// except according to those terms.
fn main() {
match 0is { 1is => () } //~ ERROR non-exhaustive patterns
match 0is { 0is if false => () } //~ ERROR non-exhaustive patterns
match 0 { 1 => () } //~ ERROR non-exhaustive patterns
match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns
}

View File

@ -9,7 +9,7 @@
// except according to those terms.
fn a() {
let v = [1is, 2, 3];
let v = [1, 2, 3];
match v {
[_, _, _] => {}
[_, _, _] => {} //~ ERROR unreachable pattern

View File

@ -33,7 +33,7 @@ fn main() {
//~^ HELP maybe a `()` to call it is missing
// Ensure the span is useful
let ys = &[1is,2,3,4,5,6,7];
let ys = &[1,2,3,4,5,6,7];
let a = ys.iter()
.map(|x| x)
.filter(|&&x| x == 1)

View File

@ -23,9 +23,9 @@ fn main() {
//~| found `Foo`
//~| expected &-ptr
//~| found struct `Foo`
Foo::bar(&42is); //~ ERROR mismatched types
//~| expected `&Foo`
//~| found `&isize`
//~| expected struct `Foo`
//~| found isize
Foo::bar(&42i32); //~ ERROR mismatched types
//~| expected `&Foo`
//~| found `&i32`
//~| expected struct `Foo`
//~| found i32
}

View File

@ -13,11 +13,11 @@
struct Foo(Box<isize>);
fn main() {
let x = (box 1is,);
let x = (box 1,);
let y = x.0;
let z = x.0; //~ ERROR use of moved value: `x.0`
let x = Foo(box 1is);
let x = Foo(box 1);
let y = x.0;
let z = x.0; //~ ERROR use of moved value: `x.0`
}

Some files were not shown because too many files have changed in this diff Show More