Kill more isize
s
This commit is contained in:
parent
105bfd3001
commit
b4a43f3864
197 changed files with 806 additions and 807 deletions
|
@ -424,7 +424,7 @@ Let's see an example. This Rust code will not compile:
|
||||||
use std::thread::Thread;
|
use std::thread::Thread;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut numbers = vec![1is, 2, 3];
|
let mut numbers = vec![1, 2, 3];
|
||||||
|
|
||||||
for i in 0..3 {
|
for i in 0..3 {
|
||||||
Thread::spawn(move || {
|
Thread::spawn(move || {
|
||||||
|
@ -478,7 +478,7 @@ use std::thread::Thread;
|
||||||
use std::sync::{Arc,Mutex};
|
use std::sync::{Arc,Mutex};
|
||||||
|
|
||||||
fn main() {
|
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 {
|
for i in 0us..3 {
|
||||||
let number = numbers.clone();
|
let number = numbers.clone();
|
||||||
|
@ -539,7 +539,7 @@ safety check that makes this an error about moved values:
|
||||||
use std::thread::Thread;
|
use std::thread::Thread;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let vec = vec![1is, 2, 3];
|
let vec = vec![1, 2, 3];
|
||||||
|
|
||||||
for i in 0us..3 {
|
for i in 0us..3 {
|
||||||
Thread::spawn(move || {
|
Thread::spawn(move || {
|
||||||
|
|
|
@ -333,7 +333,7 @@ impl<T> DList<T> {
|
||||||
///
|
///
|
||||||
/// let mut dl = DList::new();
|
/// let mut dl = DList::new();
|
||||||
///
|
///
|
||||||
/// dl.push_front(2is);
|
/// dl.push_front(2);
|
||||||
/// assert_eq!(dl.len(), 1);
|
/// assert_eq!(dl.len(), 1);
|
||||||
///
|
///
|
||||||
/// dl.push_front(1);
|
/// dl.push_front(1);
|
||||||
|
@ -360,10 +360,10 @@ impl<T> DList<T> {
|
||||||
///
|
///
|
||||||
/// let mut dl = DList::new();
|
/// let mut dl = DList::new();
|
||||||
///
|
///
|
||||||
/// dl.push_front(2is);
|
/// dl.push_front(2);
|
||||||
/// dl.push_front(1);
|
/// dl.push_front(1);
|
||||||
/// assert_eq!(dl.len(), 2);
|
/// assert_eq!(dl.len(), 2);
|
||||||
/// assert_eq!(dl.front(), Some(&1is));
|
/// assert_eq!(dl.front(), Some(&1));
|
||||||
///
|
///
|
||||||
/// dl.clear();
|
/// dl.clear();
|
||||||
/// assert_eq!(dl.len(), 0);
|
/// assert_eq!(dl.len(), 0);
|
||||||
|
@ -388,7 +388,7 @@ impl<T> DList<T> {
|
||||||
/// assert_eq!(dl.front(), None);
|
/// assert_eq!(dl.front(), None);
|
||||||
///
|
///
|
||||||
/// dl.push_front(1);
|
/// dl.push_front(1);
|
||||||
/// assert_eq!(dl.front(), Some(&1is));
|
/// assert_eq!(dl.front(), Some(&1));
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -409,13 +409,13 @@ impl<T> DList<T> {
|
||||||
/// assert_eq!(dl.front(), None);
|
/// assert_eq!(dl.front(), None);
|
||||||
///
|
///
|
||||||
/// dl.push_front(1);
|
/// dl.push_front(1);
|
||||||
/// assert_eq!(dl.front(), Some(&1is));
|
/// assert_eq!(dl.front(), Some(&1));
|
||||||
///
|
///
|
||||||
/// match dl.front_mut() {
|
/// match dl.front_mut() {
|
||||||
/// None => {},
|
/// None => {},
|
||||||
/// Some(x) => *x = 5is,
|
/// Some(x) => *x = 5,
|
||||||
/// }
|
/// }
|
||||||
/// assert_eq!(dl.front(), Some(&5is));
|
/// assert_eq!(dl.front(), Some(&5));
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -436,7 +436,7 @@ impl<T> DList<T> {
|
||||||
/// assert_eq!(dl.back(), None);
|
/// assert_eq!(dl.back(), None);
|
||||||
///
|
///
|
||||||
/// dl.push_back(1);
|
/// dl.push_back(1);
|
||||||
/// assert_eq!(dl.back(), Some(&1is));
|
/// assert_eq!(dl.back(), Some(&1));
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -457,13 +457,13 @@ impl<T> DList<T> {
|
||||||
/// assert_eq!(dl.back(), None);
|
/// assert_eq!(dl.back(), None);
|
||||||
///
|
///
|
||||||
/// dl.push_back(1);
|
/// dl.push_back(1);
|
||||||
/// assert_eq!(dl.back(), Some(&1is));
|
/// assert_eq!(dl.back(), Some(&1));
|
||||||
///
|
///
|
||||||
/// match dl.back_mut() {
|
/// match dl.back_mut() {
|
||||||
/// None => {},
|
/// None => {},
|
||||||
/// Some(x) => *x = 5is,
|
/// Some(x) => *x = 5,
|
||||||
/// }
|
/// }
|
||||||
/// assert_eq!(dl.back(), Some(&5is));
|
/// assert_eq!(dl.back(), Some(&5));
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -483,8 +483,8 @@ impl<T> DList<T> {
|
||||||
///
|
///
|
||||||
/// let mut dl = DList::new();
|
/// let mut dl = DList::new();
|
||||||
///
|
///
|
||||||
/// dl.push_front(2is);
|
/// dl.push_front(2);
|
||||||
/// assert_eq!(dl.front().unwrap(), &2is);
|
/// assert_eq!(dl.front().unwrap(), &2);
|
||||||
///
|
///
|
||||||
/// dl.push_front(1);
|
/// dl.push_front(1);
|
||||||
/// assert_eq!(dl.front().unwrap(), &1);
|
/// assert_eq!(dl.front().unwrap(), &1);
|
||||||
|
@ -508,7 +508,7 @@ impl<T> DList<T> {
|
||||||
/// let mut d = DList::new();
|
/// let mut d = DList::new();
|
||||||
/// assert_eq!(d.pop_front(), None);
|
/// assert_eq!(d.pop_front(), None);
|
||||||
///
|
///
|
||||||
/// d.push_front(1is);
|
/// d.push_front(1);
|
||||||
/// d.push_front(3);
|
/// d.push_front(3);
|
||||||
/// assert_eq!(d.pop_front(), Some(3));
|
/// assert_eq!(d.pop_front(), Some(3));
|
||||||
/// assert_eq!(d.pop_front(), Some(1));
|
/// assert_eq!(d.pop_front(), Some(1));
|
||||||
|
@ -568,7 +568,7 @@ impl<T> DList<T> {
|
||||||
///
|
///
|
||||||
/// let mut d = DList::new();
|
/// let mut d = DList::new();
|
||||||
///
|
///
|
||||||
/// d.push_front(1is);
|
/// d.push_front(1);
|
||||||
/// d.push_front(2);
|
/// d.push_front(2);
|
||||||
/// d.push_front(3);
|
/// d.push_front(3);
|
||||||
///
|
///
|
||||||
|
|
|
@ -50,13 +50,13 @@ fn test_writer_hasher() {
|
||||||
assert_eq!(hash(&5u16), 5);
|
assert_eq!(hash(&5u16), 5);
|
||||||
assert_eq!(hash(&5u32), 5);
|
assert_eq!(hash(&5u32), 5);
|
||||||
assert_eq!(hash(&5u64), 5);
|
assert_eq!(hash(&5u64), 5);
|
||||||
assert_eq!(hash(&5u), 5);
|
assert_eq!(hash(&5us), 5);
|
||||||
|
|
||||||
assert_eq!(hash(&5i8), 5);
|
assert_eq!(hash(&5i8), 5);
|
||||||
assert_eq!(hash(&5i16), 5);
|
assert_eq!(hash(&5i16), 5);
|
||||||
assert_eq!(hash(&5i32), 5);
|
assert_eq!(hash(&5i32), 5);
|
||||||
assert_eq!(hash(&5i64), 5);
|
assert_eq!(hash(&5i64), 5);
|
||||||
assert_eq!(hash(&5), 5);
|
assert_eq!(hash(&5is), 5);
|
||||||
|
|
||||||
assert_eq!(hash(&false), 0);
|
assert_eq!(hash(&false), 0);
|
||||||
assert_eq!(hash(&true), 1);
|
assert_eq!(hash(&true), 1);
|
||||||
|
@ -76,12 +76,12 @@ fn test_writer_hasher() {
|
||||||
// FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]>
|
// FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]>
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr: *const i32 = mem::transmute(5is);
|
let ptr: *const i32 = mem::transmute(5us);
|
||||||
assert_eq!(hash(&ptr), 5);
|
assert_eq!(hash(&ptr), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr: *mut i32 = mem::transmute(5is);
|
let ptr: *mut i32 = mem::transmute(5us);
|
||||||
assert_eq!(hash(&ptr), 5);
|
assert_eq!(hash(&ptr), 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,7 +375,7 @@ fn test_iterator_size_hint() {
|
||||||
assert_eq!(c.clone().enumerate().size_hint(), (uint::MAX, None));
|
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().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().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().filter(|_| false).size_hint(), (0, None));
|
||||||
assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::MAX, None));
|
assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::MAX, None));
|
||||||
assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, 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().enumerate().size_hint(), (10, Some(10)));
|
||||||
assert_eq!(vi.clone().chain(v2.iter()).size_hint(), (13, Some(13)));
|
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().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().filter(|_| false).size_hint(), (0, Some(10)));
|
||||||
assert_eq!(vi.clone().map(|&i| i+1).size_hint(), (10, 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)));
|
assert_eq!(vi.filter_map(|_| Some(0)).size_hint(), (0, Some(10)));
|
||||||
|
|
|
@ -223,7 +223,7 @@ fn test_ord() {
|
||||||
/* FIXME(#20575)
|
/* FIXME(#20575)
|
||||||
#[test]
|
#[test]
|
||||||
fn test_collect() {
|
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![]));
|
assert!(v == Some(vec![]));
|
||||||
|
|
||||||
let v: Option<Vec<int>> = (0..3).map(|x| Some(x)).collect();
|
let v: Option<Vec<int>> = (0..3).map(|x| Some(x)).collect();
|
||||||
|
|
|
@ -1198,7 +1198,7 @@ mod test_set {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_drain() {
|
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.
|
// try this a bunch of times to make sure we don't screw up internal state.
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
|
@ -1217,7 +1217,7 @@ mod test_set {
|
||||||
for _ in s.iter() { panic!("s should be empty!"); }
|
for _ in s.iter() { panic!("s should be empty!"); }
|
||||||
|
|
||||||
// reset to try again.
|
// reset to try again.
|
||||||
s.extend(1is..100);
|
s.extend(1..100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1101,7 +1101,7 @@ mod test {
|
||||||
let dir = &tmpdir.join("di_readdir");
|
let dir = &tmpdir.join("di_readdir");
|
||||||
check!(mkdir(dir, old_io::USER_RWX));
|
check!(mkdir(dir, old_io::USER_RWX));
|
||||||
let prefix = "foo";
|
let prefix = "foo";
|
||||||
for n in 0is..3 {
|
for n in 0..3 {
|
||||||
let f = dir.join(format!("{}.txt", n));
|
let f = dir.join(format!("{}.txt", n));
|
||||||
let mut w = check!(File::create(&f));
|
let mut w = check!(File::create(&f));
|
||||||
let msg_str = format!("{}{}", prefix, n);
|
let msg_str = format!("{}{}", prefix, n);
|
||||||
|
|
|
@ -1160,7 +1160,7 @@ mod test {
|
||||||
tx.send(TcpStream::connect(addr).unwrap()).unwrap();
|
tx.send(TcpStream::connect(addr).unwrap()).unwrap();
|
||||||
});
|
});
|
||||||
let _l = rx.recv().unwrap();
|
let _l = rx.recv().unwrap();
|
||||||
for i in 0is..1001 {
|
for i in 0i32..1001 {
|
||||||
match a.accept() {
|
match a.accept() {
|
||||||
Ok(..) => break,
|
Ok(..) => break,
|
||||||
Err(ref e) if e.kind == TimedOut => {}
|
Err(ref e) if e.kind == TimedOut => {}
|
||||||
|
@ -1260,7 +1260,7 @@ mod test {
|
||||||
assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut);
|
assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut);
|
||||||
|
|
||||||
s.set_timeout(Some(20));
|
s.set_timeout(Some(20));
|
||||||
for i in 0is..1001 {
|
for i in 0i32..1001 {
|
||||||
match s.write(&[0; 128 * 1024]) {
|
match s.write(&[0; 128 * 1024]) {
|
||||||
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
|
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
|
||||||
Err(IoError { kind: TimedOut, .. }) => break,
|
Err(IoError { kind: TimedOut, .. }) => break,
|
||||||
|
@ -1318,7 +1318,7 @@ mod test {
|
||||||
|
|
||||||
let mut s = a.accept().unwrap();
|
let mut s = a.accept().unwrap();
|
||||||
s.set_write_timeout(Some(20));
|
s.set_write_timeout(Some(20));
|
||||||
for i in 0is..1001 {
|
for i in 0i32..1001 {
|
||||||
match s.write(&[0; 128 * 1024]) {
|
match s.write(&[0; 128 * 1024]) {
|
||||||
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
|
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
|
||||||
Err(IoError { kind: TimedOut, .. }) => break,
|
Err(IoError { kind: TimedOut, .. }) => break,
|
||||||
|
|
|
@ -573,7 +573,7 @@ pub fn byte_lit(lit: &str) -> (u8, usize) {
|
||||||
if lit.len() == 1 {
|
if lit.len() == 1 {
|
||||||
(lit.as_bytes()[0], 1)
|
(lit.as_bytes()[0], 1)
|
||||||
} else {
|
} else {
|
||||||
assert!(lit.as_bytes()[0] == b'\\', err(0is));
|
assert!(lit.as_bytes()[0] == b'\\', err(0));
|
||||||
let b = match lit.as_bytes()[1] {
|
let b = match lit.as_bytes()[1] {
|
||||||
b'"' => b'"',
|
b'"' => b'"',
|
||||||
b'n' => b'\n',
|
b'n' => b'\n',
|
||||||
|
|
|
@ -167,7 +167,7 @@ pub fn mk_printer(out: Box<old_io::Writer+'static>, linewidth: usize) -> Printer
|
||||||
let n: usize = 3 * linewidth;
|
let n: usize = 3 * linewidth;
|
||||||
debug!("mk_printer {}", linewidth);
|
debug!("mk_printer {}", linewidth);
|
||||||
let token: Vec<Token> = repeat(Token::Eof).take(n).collect();
|
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();
|
let scan_stack: Vec<usize> = repeat(0us).take(n).collect();
|
||||||
Printer {
|
Printer {
|
||||||
out: out,
|
out: out,
|
||||||
|
|
|
@ -195,14 +195,14 @@ mod test {
|
||||||
let v: SmallVector<isize> = SmallVector::zero();
|
let v: SmallVector<isize> = SmallVector::zero();
|
||||||
assert_eq!(0, v.len());
|
assert_eq!(0, v.len());
|
||||||
|
|
||||||
assert_eq!(1, SmallVector::one(1is).len());
|
assert_eq!(1, SmallVector::one(1).len());
|
||||||
assert_eq!(5, SmallVector::many(vec!(1is, 2, 3, 4, 5)).len());
|
assert_eq!(5, SmallVector::many(vec![1, 2, 3, 4, 5]).len());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_push_get() {
|
fn test_push_get() {
|
||||||
let mut v = SmallVector::zero();
|
let mut v = SmallVector::zero();
|
||||||
v.push(1is);
|
v.push(1);
|
||||||
assert_eq!(1, v.len());
|
assert_eq!(1, v.len());
|
||||||
assert_eq!(&1, v.get(0));
|
assert_eq!(&1, v.get(0));
|
||||||
v.push(2);
|
v.push(2);
|
||||||
|
@ -215,7 +215,7 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_from_iter() {
|
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!(3, v.len());
|
||||||
assert_eq!(&1, v.get(0));
|
assert_eq!(&1, v.get(0));
|
||||||
assert_eq!(&2, v.get(1));
|
assert_eq!(&2, v.get(1));
|
||||||
|
@ -228,11 +228,11 @@ mod test {
|
||||||
let v: Vec<isize> = v.into_iter().collect();
|
let v: Vec<isize> = v.into_iter().collect();
|
||||||
assert_eq!(Vec::new(), v);
|
assert_eq!(Vec::new(), v);
|
||||||
|
|
||||||
let v = SmallVector::one(1is);
|
let v = SmallVector::one(1);
|
||||||
assert_eq!(vec!(1is), v.into_iter().collect::<Vec<_>>());
|
assert_eq!(vec![1], v.into_iter().collect::<Vec<_>>());
|
||||||
|
|
||||||
let v = SmallVector::many(vec!(1is, 2is, 3is));
|
let v = SmallVector::many(vec![1, 2, 3]);
|
||||||
assert_eq!(vec!(1is, 2is, 3is), v.into_iter().collect::<Vec<_>>());
|
assert_eq!(vec!(1, 2, 3), v.into_iter().collect::<Vec<_>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -244,12 +244,12 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
#[should_fail]
|
#[should_fail]
|
||||||
fn test_expect_one_many() {
|
fn test_expect_one_many() {
|
||||||
SmallVector::many(vec!(1is, 2)).expect_one("");
|
SmallVector::many(vec!(1, 2)).expect_one("");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_expect_one_one() {
|
fn test_expect_one_one() {
|
||||||
assert_eq!(1is, SmallVector::one(1is).expect_one(""));
|
assert_eq!(1, SmallVector::one(1).expect_one(""));
|
||||||
assert_eq!(1is, SmallVector::many(vec!(1is)).expect_one(""));
|
assert_eq!(1, SmallVector::many(vec!(1)).expect_one(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,8 +104,8 @@ impl<'a, T> Iterator for ListIterator<'a, T> {
|
||||||
// corresponding mirrored piece), with, as minimum coordinates, (0,
|
// corresponding mirrored piece), with, as minimum coordinates, (0,
|
||||||
// 0). If all is false, only generate half of the possibilities (used
|
// 0). If all is false, only generate half of the possibilities (used
|
||||||
// to break the symmetry of the board).
|
// to break the symmetry of the board).
|
||||||
fn transform(piece: Vec<(isize, isize)> , all: bool) -> Vec<Vec<(isize, isize)>> {
|
fn transform(piece: Vec<(i32, i32)> , all: bool) -> Vec<Vec<(i32, i32)>> {
|
||||||
let mut res: Vec<Vec<(isize, isize)>> =
|
let mut res: Vec<Vec<(i32, i32)>> =
|
||||||
// rotations
|
// rotations
|
||||||
iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect())
|
iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect())
|
||||||
.take(if all {6} else {3})
|
.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
|
// Takes a piece with minimum coordinate (0, 0) (as generated by
|
||||||
// transform). Returns the corresponding mask if p translated by (dy,
|
// transform). Returns the corresponding mask if p translated by (dy,
|
||||||
// dx) is on the board.
|
// 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);
|
let mut m = 1 << (50 + id);
|
||||||
for &(y, x) in p.iter() {
|
for &(y, x) in p.iter() {
|
||||||
let x = x + dx + (y + (dy % 2)) / 2;
|
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
|
// To break the central symmetry of the problem, every
|
||||||
// transformation must be taken except for one piece (piece 3
|
// transformation must be taken except for one piece (piece 3
|
||||||
// here).
|
// here).
|
||||||
let transforms: Vec<Vec<Vec<(isize, isize)>>> =
|
let transforms: Vec<Vec<Vec<(i32, i32)>>> =
|
||||||
pieces.into_iter().enumerate()
|
pieces.into_iter().enumerate()
|
||||||
.map(|(id, p)| transform(p, id != 3))
|
.map(|(id, p)| transform(p, id != 3))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
(0is..50).map(|yx| {
|
(0i32..50).map(|yx| {
|
||||||
transforms.iter().enumerate().map(|(id, t)| {
|
transforms.iter().enumerate().map(|(id, t)| {
|
||||||
t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect()
|
t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect()
|
||||||
}).collect()
|
}).collect()
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x: isize = [1is, 2, 3];
|
let _x: i32 = [1i32, 2, 3];
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `isize`
|
//~| expected `i32`
|
||||||
//~| found `[isize; 3]`
|
//~| found `[i32; 3]`
|
||||||
//~| expected isize
|
//~| expected i32
|
||||||
//~| found array of 3 elements
|
//~| found array of 3 elements
|
||||||
|
|
||||||
let x: &[isize] = &[1, 2, 3];
|
let x: &[i32] = &[1i32, 2, 3];
|
||||||
let _y: &isize = x;
|
let _y: &i32 = x;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `&isize`
|
//~| expected `&i32`
|
||||||
//~| found `&[isize]`
|
//~| found `&[i32]`
|
||||||
//~| expected isize
|
//~| expected i32
|
||||||
//~| found slice
|
//~| found slice
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
// Test that the old fixed length array syntax is a parsing error.
|
// Test that the old fixed length array syntax is a parsing error.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x: [isize, ..3] = [0is, 1, 2]; //~ ERROR
|
let _x: [isize, ..3] = [0, 1, 2]; //~ ERROR
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
// Test that the old repeating array syntax gives an error.
|
// Test that the old repeating array syntax gives an error.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = [0is, ..3]; //~ ERROR
|
let _ = [0, ..3]; //~ ERROR
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub fn baz(x: &Foo<A=Bar>) {
|
||||||
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let a = 42is;
|
let a = 42;
|
||||||
foo1(a);
|
foo1(a);
|
||||||
//~^ ERROR type mismatch resolving
|
//~^ ERROR type mismatch resolving
|
||||||
//~| expected usize
|
//~| expected usize
|
||||||
|
|
|
@ -28,15 +28,15 @@ impl Foo for isize {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
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
|
//~^ 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
|
//~^ 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 `A` (from the trait `Foo`) must be specified
|
||||||
//~| ERROR the value of the associated type `B` (from the trait `Foo`) must be specified
|
//~| ERROR the value of the associated type `B` (from the trait `Foo`) must be specified
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ pub trait Foo {
|
||||||
type A;
|
type A;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Foo for isize {
|
impl Foo for i32 {
|
||||||
type A = usize;
|
type A = u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f1<T: Foo>(a: T, x: T::A) {}
|
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() {
|
pub fn f1_int_int() {
|
||||||
f1(2is, 4is);
|
f1(2i32, 4i32);
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected usize
|
//~| expected u32
|
||||||
//~| found isize
|
//~| found i32
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f1_int_uint() {
|
pub fn f1_int_uint() {
|
||||||
f1(2is, 4us);
|
f1(2i32, 4u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f1_uint_uint() {
|
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
|
||||||
//~| ERROR the trait `Foo` is not implemented
|
//~| ERROR the trait `Foo` is not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f1_uint_int() {
|
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
|
||||||
//~| ERROR the trait `Foo` is not implemented
|
//~| ERROR the trait `Foo` is not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f2_int() {
|
pub fn f2_int() {
|
||||||
let _: isize = f2(2is);
|
let _: i32 = f2(2i32);
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `isize`
|
//~| expected `i32`
|
||||||
//~| found `usize`
|
//~| found `u32`
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() { }
|
pub fn main() { }
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
static i: String = 10is;
|
static i: String = 10i32;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `collections::string::String`
|
//~| expected `collections::string::String`
|
||||||
//~| found `isize`
|
//~| found `i32`
|
||||||
//~| expected struct `collections::string::String`
|
//~| expected struct `collections::string::String`
|
||||||
//~| found isize
|
//~| found i32
|
||||||
fn main() { println!("{}", i); }
|
fn main() { println!("{}", i); }
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging
|
fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging
|
||||||
3is
|
3
|
||||||
}
|
}
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// 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; }
|
||||||
|
|
|
@ -16,28 +16,28 @@ struct Foo(Box<isize>, isize);
|
||||||
struct Bar(isize, isize);
|
struct Bar(isize, isize);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = (box 1is, 2is);
|
let x = (box 1, 2);
|
||||||
let r = &x.0;
|
let r = &x.0;
|
||||||
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
|
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 a = &x.0;
|
||||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
|
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 a = &mut x.0;
|
||||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
|
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 r = &x.0;
|
||||||
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
|
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 a = &x.0;
|
||||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
|
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 a = &mut x.0;
|
||||||
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
|
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// anonymous fields of a tuple vs the same anonymous field.
|
// anonymous fields of a tuple vs the same anonymous field.
|
||||||
|
|
||||||
fn distinct_variant() {
|
fn distinct_variant() {
|
||||||
let mut y = (1is, 2is);
|
let mut y = (1, 2);
|
||||||
|
|
||||||
let a = match y {
|
let a = match y {
|
||||||
(ref mut a, _) => a
|
(ref mut a, _) => a
|
||||||
|
@ -27,7 +27,7 @@ fn distinct_variant() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn same_variant() {
|
fn same_variant() {
|
||||||
let mut y = (1is, 2is);
|
let mut y = (1, 2);
|
||||||
|
|
||||||
let a = match y {
|
let a = match y {
|
||||||
(ref mut a, _) => a
|
(ref mut a, _) => a
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
||||||
let mut a = [box 0is, box 1is];
|
let mut a = [box 0, box 1];
|
||||||
drop(a[0]);
|
drop(a[0]);
|
||||||
a[1] = box 2is;
|
a[1] = box 2;
|
||||||
drop(a[0]); //~ ERROR use of moved value: `a[..]`
|
drop(a[0]); //~ ERROR use of moved value: `a[..]`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
fn foo() -> isize {
|
fn foo() -> isize {
|
||||||
let x: isize;
|
let x: isize;
|
||||||
|
|
||||||
while 1is != 2 {
|
while 1 != 2 {
|
||||||
break;
|
break;
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
|
println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||||
|
|
||||||
return 17is;
|
return 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { println!("{}", foo()); }
|
fn main() { println!("{}", foo()); }
|
||||||
|
|
|
@ -22,37 +22,37 @@ fn set(x: &mut isize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 4;
|
let c1 = |&mut:| x = 4;
|
||||||
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b() {
|
fn b() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| set(&mut x);
|
let c1 = |&mut:| set(&mut x);
|
||||||
let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x`
|
let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
fn c() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| set(&mut x);
|
let c1 = |&mut:| set(&mut x);
|
||||||
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d() {
|
fn d() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c2 = |&mut:| x * 5;
|
let c2 = |&mut:| x * 5;
|
||||||
x = 5; //~ ERROR cannot assign
|
x = 5; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
|
|
||||||
fn e() {
|
fn e() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| get(&x);
|
let c1 = |&mut:| get(&x);
|
||||||
x = 5; //~ ERROR cannot assign
|
x = 5; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
||||||
let mut x = box 3is;
|
let mut x = box 3;
|
||||||
let c1 = |&mut:| get(&*x);
|
let c1 = |&mut:| get(&*x);
|
||||||
*x = 5; //~ ERROR cannot assign
|
*x = 5; //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 4;
|
let c1 = |&mut:| x = 4;
|
||||||
let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once
|
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() {
|
fn b() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| set(&mut x);
|
let c1 = |&mut:| set(&mut x);
|
||||||
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
fn c() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 5;
|
let c1 = |&mut:| x = 5;
|
||||||
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d() {
|
fn d() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
let c1 = |&mut:| x = 5;
|
let c1 = |&mut:| x = 5;
|
||||||
let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure)
|
let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure)
|
||||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||||
|
|
|
@ -17,7 +17,7 @@ struct Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut y = 1is;
|
let mut y = 1;
|
||||||
let x = Some(&mut y);
|
let x = Some(&mut y);
|
||||||
for &a in x.iter() { //~ ERROR cannot move out
|
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
|
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
|
for &a in x.iter() { //~ ERROR cannot move out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
fn foo(x: isize) { println!("{}", x); }
|
fn foo(x: isize) { println!("{}", x); }
|
||||||
|
|
||||||
fn main() {
|
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`
|
foo(x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn foo(x: isize) { println!("{}", x); }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: isize;
|
let x: isize;
|
||||||
if 1is > 2 {
|
if 1 > 2 {
|
||||||
println!("whoops");
|
println!("whoops");
|
||||||
} else {
|
} else {
|
||||||
x = 10;
|
x = 10;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut _a = 3is;
|
let mut _a = 3;
|
||||||
let _b = &mut _a;
|
let _b = &mut _a;
|
||||||
{
|
{
|
||||||
let _c = &*_b;
|
let _c = &*_b;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = Some(box 1is);
|
let x = Some(box 1);
|
||||||
match x {
|
match x {
|
||||||
Some(ref _y) => {
|
Some(ref _y) => {
|
||||||
let _a = x; //~ ERROR cannot move
|
let _a = x; //~ ERROR cannot move
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = Some(box 1is);
|
let x = Some(box 1);
|
||||||
match x {
|
match x {
|
||||||
Some(ref y) => {
|
Some(ref y) => {
|
||||||
let _b = *y; //~ ERROR cannot move out
|
let _b = *y; //~ ERROR cannot move out
|
||||||
|
|
|
@ -41,7 +41,7 @@ fn block_overarching_alias_mut() {
|
||||||
|
|
||||||
let mut v = box 3;
|
let mut v = box 3;
|
||||||
let mut x = &mut v;
|
let mut x = &mut v;
|
||||||
for _ in 0is..3 {
|
for _ in 0..3 {
|
||||||
borrow(&*v); //~ ERROR cannot borrow
|
borrow(&*v); //~ ERROR cannot borrow
|
||||||
}
|
}
|
||||||
*x = box 5;
|
*x = box 5;
|
||||||
|
|
|
@ -19,10 +19,10 @@ fn separate_arms() {
|
||||||
None => {
|
None => {
|
||||||
// It is ok to reassign x here, because there is in
|
// It is ok to reassign x here, because there is in
|
||||||
// fact no outstanding loan of x!
|
// fact no outstanding loan of x!
|
||||||
x = Some(0is);
|
x = Some(0);
|
||||||
}
|
}
|
||||||
Some(ref _i) => {
|
Some(ref _i) => {
|
||||||
x = Some(1is); //~ ERROR cannot assign
|
x = Some(1); //~ ERROR cannot assign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x.clone(); // just to prevent liveness warnings
|
x.clone(); // just to prevent liveness warnings
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn f() {
|
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
|
//~^ NOTE reference must be valid for the block suffix following statement
|
||||||
//~^^ HELP consider using a `let` binding to increase its lifetime
|
//~^^ HELP consider using a `let` binding to increase its lifetime
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_imm() {
|
fn box_imm() {
|
||||||
let v = box 3is;
|
let v = box 3;
|
||||||
let _w = &v;
|
let _w = &v;
|
||||||
Thread::spawn(move|| {
|
Thread::spawn(move|| {
|
||||||
println!("v={}", *v);
|
println!("v={}", *v);
|
||||||
|
@ -26,7 +26,7 @@ fn box_imm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_imm_explicit() {
|
fn box_imm_explicit() {
|
||||||
let v = box 3is;
|
let v = box 3;
|
||||||
let _w = &v;
|
let _w = &v;
|
||||||
Thread::spawn(move|| {
|
Thread::spawn(move|| {
|
||||||
println!("v={}", *v);
|
println!("v={}", *v);
|
||||||
|
|
|
@ -19,7 +19,7 @@ struct S {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
match 1is {
|
match 1 {
|
||||||
x => {
|
x => {
|
||||||
x += 1; //~ ERROR re-assignment of immutable variable `x`
|
x += 1; //~ ERROR re-assignment of immutable variable `x`
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,13 @@ pub fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match (1is,) {
|
match (1,) {
|
||||||
(x,) => {
|
(x,) => {
|
||||||
x += 1; //~ ERROR re-assignment of immutable variable `x`
|
x += 1; //~ ERROR re-assignment of immutable variable `x`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match [1is,2,3] {
|
match [1,2,3] {
|
||||||
[x,_,_] => {
|
[x,_,_] => {
|
||||||
x += 1; //~ ERROR re-assignment of immutable variable `x`
|
x += 1; //~ ERROR re-assignment of immutable variable `x`
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = box box 2is;
|
let a = box box 2;
|
||||||
let b = &a;
|
let b = &a;
|
||||||
|
|
||||||
let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
|
let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub fn main() {
|
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
|
//~^ ERROR cannot move out of borrowed content
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ use std::thread::Thread;
|
||||||
fn borrow<T>(_: &T) { }
|
fn borrow<T>(_: &T) { }
|
||||||
|
|
||||||
fn different_vars_after_borrows() {
|
fn different_vars_after_borrows() {
|
||||||
let x1 = box 1is;
|
let x1 = box 1;
|
||||||
let p1 = &x1;
|
let p1 = &x1;
|
||||||
let x2 = box 2is;
|
let x2 = box 2;
|
||||||
let p2 = &x2;
|
let p2 = &x2;
|
||||||
Thread::spawn(move|| {
|
Thread::spawn(move|| {
|
||||||
drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
|
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() {
|
fn different_vars_after_moves() {
|
||||||
let x1 = box 1is;
|
let x1 = box 1;
|
||||||
drop(x1);
|
drop(x1);
|
||||||
let x2 = box 2is;
|
let x2 = box 2;
|
||||||
drop(x2);
|
drop(x2);
|
||||||
Thread::spawn(move|| {
|
Thread::spawn(move|| {
|
||||||
drop(x1); //~ ERROR capture of moved value: `x1`
|
drop(x1); //~ ERROR capture of moved value: `x1`
|
||||||
|
@ -39,7 +39,7 @@ fn different_vars_after_moves() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn same_var_after_borrow() {
|
fn same_var_after_borrow() {
|
||||||
let x = box 1is;
|
let x = box 1;
|
||||||
let p = &x;
|
let p = &x;
|
||||||
Thread::spawn(move|| {
|
Thread::spawn(move|| {
|
||||||
drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
|
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() {
|
fn same_var_after_move() {
|
||||||
let x = box 1is;
|
let x = box 1;
|
||||||
drop(x);
|
drop(x);
|
||||||
Thread::spawn(move|| {
|
Thread::spawn(move|| {
|
||||||
drop(x); //~ ERROR capture of moved value: `x`
|
drop(x); //~ ERROR capture of moved value: `x`
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl<T> Index<usize> for MyVec<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
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 good = &v[0]; // Shouldn't fail here
|
||||||
let bad = v[0];
|
let bad = v[0];
|
||||||
//~^ ERROR cannot move out of indexed content
|
//~^ ERROR cannot move out of indexed content
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
fn borrow(_v: &isize) {}
|
fn borrow(_v: &isize) {}
|
||||||
|
|
||||||
fn local() {
|
fn local() {
|
||||||
let mut v = box 3is;
|
let mut v = box 3;
|
||||||
borrow(&*v);
|
borrow(&*v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,27 +32,27 @@ fn local_recs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aliased_imm() {
|
fn aliased_imm() {
|
||||||
let mut v = box 3is;
|
let mut v = box 3;
|
||||||
let _w = &v;
|
let _w = &v;
|
||||||
borrow(&*v);
|
borrow(&*v);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aliased_mut() {
|
fn aliased_mut() {
|
||||||
let mut v = box 3is;
|
let mut v = box 3;
|
||||||
let _w = &mut v;
|
let _w = &mut v;
|
||||||
borrow(&*v); //~ ERROR cannot borrow `*v`
|
borrow(&*v); //~ ERROR cannot borrow `*v`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aliased_other() {
|
fn aliased_other() {
|
||||||
let mut v = box 3is;
|
let mut v = box 3;
|
||||||
let mut w = box 4is;
|
let mut w = box 4;
|
||||||
let _x = &mut w;
|
let _x = &mut w;
|
||||||
borrow(&*v);
|
borrow(&*v);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aliased_other_reassign() {
|
fn aliased_other_reassign() {
|
||||||
let mut v = box 3is;
|
let mut v = box 3;
|
||||||
let mut w = box 4is;
|
let mut w = box 4;
|
||||||
let mut _x = &mut w;
|
let mut _x = &mut w;
|
||||||
_x = &mut v;
|
_x = &mut v;
|
||||||
borrow(&*v); //~ ERROR cannot borrow `*v`
|
borrow(&*v); //~ ERROR cannot borrow `*v`
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut a = [1is, 2, 3, 4];
|
let mut a = [1, 2, 3, 4];
|
||||||
let t = match a {
|
let t = match a {
|
||||||
[1, 2, tail..] => tail,
|
[1, 2, tail..] => tail,
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut vec = [box 1is, box 2, box 3];
|
let mut vec = [box 1, box 2, box 3];
|
||||||
match vec {
|
match vec {
|
||||||
[box ref _a, _, _] => {
|
[box ref _a, _, _] => {
|
||||||
vec[0] = box 4; //~ ERROR cannot assign
|
vec[0] = box 4; //~ ERROR cannot assign
|
||||||
|
@ -21,7 +21,7 @@ fn a() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b() {
|
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();
|
let vec: &mut [Box<isize>] = vec.as_mut_slice();
|
||||||
match vec {
|
match vec {
|
||||||
[_b..] => {
|
[_b..] => {
|
||||||
|
@ -31,7 +31,7 @@ fn b() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
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();
|
let vec: &mut [Box<isize>] = vec.as_mut_slice();
|
||||||
match vec {
|
match vec {
|
||||||
[_a, //~ ERROR cannot move out
|
[_a, //~ ERROR cannot move out
|
||||||
|
@ -49,7 +49,7 @@ fn c() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn d() {
|
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();
|
let vec: &mut [Box<isize>] = vec.as_mut_slice();
|
||||||
match vec {
|
match vec {
|
||||||
[_a.., //~ ERROR cannot move out
|
[_a.., //~ ERROR cannot move out
|
||||||
|
@ -60,7 +60,7 @@ fn d() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn e() {
|
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();
|
let vec: &mut [Box<isize>] = vec.as_mut_slice();
|
||||||
match vec {
|
match vec {
|
||||||
[_a, _b, _c] => {} //~ ERROR cannot move out
|
[_a, _b, _c] => {} //~ ERROR cannot move out
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
fn test(cond: bool) {
|
fn test(cond: bool) {
|
||||||
let v;
|
let v;
|
||||||
while cond {
|
while cond {
|
||||||
v = 3is;
|
v = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
|
println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
fn f() -> isize {
|
fn f() -> isize {
|
||||||
let mut x: isize;
|
let mut x: isize;
|
||||||
while 1is == 1 { x = 10; }
|
while 1 == 1 { x = 10; }
|
||||||
return x; //~ ERROR use of possibly uninitialized variable: `x`
|
return x; //~ ERROR use of possibly uninitialized variable: `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,6 @@ impl <T: Sync> Foo for T { }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
1193182is.foo(tx);
|
1193182.foo(tx);
|
||||||
assert!(rx.recv() == 1193182is);
|
assert!(rx.recv() == 1193182);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 1is;
|
let x = 1;
|
||||||
move|:| { x = 2; };
|
move|:| { x = 2; };
|
||||||
//~^ ERROR: cannot assign to immutable captured outer variable
|
//~^ ERROR: cannot assign to immutable captured outer variable
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
// Tests that we forbid coercion from `[T; n]` to `&[T]`
|
// Tests that we forbid coercion from `[T; n]` to `&[T]`
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: &[isize] = [0is];
|
let _: &[i32] = [0i32];
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `&[isize]`
|
//~| expected `&[i32]`
|
||||||
//~| found `[isize; 1]`
|
//~| found `[i32; 1]`
|
||||||
//~| expected &-ptr
|
//~| expected &-ptr
|
||||||
//~| found array of 1 elements
|
//~| found array of 1 elements
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,29 +27,29 @@ fn main() {
|
||||||
// if n > m, it's a type mismatch error.
|
// if n > m, it's a type mismatch error.
|
||||||
|
|
||||||
// n < m
|
// n < m
|
||||||
let &x = &(&1is as &T);
|
let &x = &(&1 as &T);
|
||||||
let &x = &&(&1is as &T);
|
let &x = &&(&1 as &T);
|
||||||
let &&x = &&(&1is as &T);
|
let &&x = &&(&1 as &T);
|
||||||
|
|
||||||
// n == m
|
// n == m
|
||||||
let &x = &1is as &T; //~ ERROR type `&T` cannot be dereferenced
|
let &x = &1 as &T; //~ ERROR type `&T` cannot be dereferenced
|
||||||
let &&x = &(&1is as &T); //~ ERROR type `&T` cannot be dereferenced
|
let &&x = &(&1 as &T); //~ ERROR type `&T` cannot be dereferenced
|
||||||
let box x = box 1is as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced
|
let box x = box 1 as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced
|
||||||
|
|
||||||
// n > m
|
// n > m
|
||||||
let &&x = &1is as &T;
|
let &&x = &1 as &T;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `T`
|
//~| expected `T`
|
||||||
//~| found `&_`
|
//~| found `&_`
|
||||||
//~| expected trait T
|
//~| expected trait T
|
||||||
//~| found &-ptr
|
//~| found &-ptr
|
||||||
let &&&x = &(&1is as &T);
|
let &&&x = &(&1 as &T);
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `T`
|
//~| expected `T`
|
||||||
//~| found `&_`
|
//~| found `&_`
|
||||||
//~| expected trait T
|
//~| expected trait T
|
||||||
//~| found &-ptr
|
//~| found &-ptr
|
||||||
let box box x = box 1is as Box<T>;
|
let box box x = box 1 as Box<T>;
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `T`
|
//~| expected `T`
|
||||||
//~| found `Box<_>`
|
//~| found `Box<_>`
|
||||||
|
|
|
@ -18,7 +18,7 @@ struct Fat<T: ?Sized> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
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 g: &Fat<[isize]> = &f;
|
||||||
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
|
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
|
||||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = [ 1is, 2, 3, 4, 5 ];
|
let x = [ 1, 2, 3, 4, 5 ];
|
||||||
match x {
|
match x {
|
||||||
[ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches
|
[ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches
|
||||||
[ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches
|
[ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches
|
||||||
|
|
|
@ -34,7 +34,7 @@ fn main() {
|
||||||
//~| expected ()
|
//~| expected ()
|
||||||
//~| found box
|
//~| found box
|
||||||
|
|
||||||
needs_fn(1is);
|
needs_fn(1);
|
||||||
//~^ ERROR `core::ops::Fn<(isize,)>`
|
//~^ ERROR `core::ops::Fn<(isize,)>`
|
||||||
//~| ERROR `core::ops::Fn<(isize,)>`
|
//~| ERROR `core::ops::Fn<(isize,)>`
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for
|
for
|
||||||
&1is //~ ERROR refutable pattern in `for` loop binding
|
&1 //~ ERROR refutable pattern in `for` loop binding
|
||||||
in [1is].iter() {}
|
in [1].iter() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut my_stuff = std::collections::HashMap::new();
|
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();
|
let (_, thing) = my_stuff.iter().next().unwrap();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut my_stuff = std::collections::HashMap::new();
|
let mut my_stuff = std::collections::HashMap::new();
|
||||||
my_stuff.insert(0is, 42is);
|
my_stuff.insert(0, 42);
|
||||||
|
|
||||||
let mut it = my_stuff.iter();
|
let mut it = my_stuff.iter();
|
||||||
my_stuff.insert(1, 43); //~ ERROR cannot borrow
|
my_stuff.insert(1, 43); //~ ERROR cannot borrow
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = if true { 10is } else { 10us };
|
let x = if true { 10i32 } else { 10u32 };
|
||||||
//~^ ERROR if and else have incompatible types
|
//~^ ERROR if and else have incompatible types
|
||||||
//~| expected `isize`
|
//~| expected `i32`
|
||||||
//~| found `usize`
|
//~| found `u32`
|
||||||
//~| expected isize
|
//~| expected i32
|
||||||
//~| found usize
|
//~| found u32
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,20 +20,20 @@ fn macros() {
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
foo!(a, 1is, { //~ ERROR irrefutable if-let
|
foo!(a, 1, { //~ ERROR irrefutable if-let
|
||||||
println!("irrefutable pattern");
|
println!("irrefutable pattern");
|
||||||
});
|
});
|
||||||
bar!(a, 1is, { //~ ERROR irrefutable if-let
|
bar!(a, 1, { //~ ERROR irrefutable if-let
|
||||||
println!("irrefutable pattern");
|
println!("irrefutable pattern");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
if let a = 1is { //~ ERROR irrefutable if-let
|
if let a = 1 { //~ ERROR irrefutable if-let
|
||||||
println!("irrefutable pattern");
|
println!("irrefutable pattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
if let a = 1is { //~ ERROR irrefutable if-let
|
if let a = 1 { //~ ERROR irrefutable if-let
|
||||||
println!("irrefutable pattern");
|
println!("irrefutable pattern");
|
||||||
} else if true {
|
} else if true {
|
||||||
println!("else-if in irrefutable if-let");
|
println!("else-if in irrefutable if-let");
|
||||||
|
@ -41,15 +41,15 @@ pub fn main() {
|
||||||
println!("else in irrefutable if-let");
|
println!("else in irrefutable if-let");
|
||||||
}
|
}
|
||||||
|
|
||||||
if let 1is = 2is {
|
if let 1 = 2 {
|
||||||
println!("refutable pattern");
|
println!("refutable pattern");
|
||||||
} else if let a = 1is { //~ ERROR irrefutable if-let
|
} else if let a = 1 { //~ ERROR irrefutable if-let
|
||||||
println!("irrefutable pattern");
|
println!("irrefutable pattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
if true {
|
if true {
|
||||||
println!("if");
|
println!("if");
|
||||||
} else if let a = 1is { //~ ERROR irrefutable if-let
|
} else if let a = 1 { //~ ERROR irrefutable if-let
|
||||||
println!("irrefutable pattern");
|
println!("irrefutable pattern");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
use std::num::SignedInt;
|
use std::num::SignedInt;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _f = 10is.abs; //~ ERROR attempted to take value of method
|
let _f = 10.abs; //~ ERROR attempted to take value of method
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// issue #17123
|
// issue #17123
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
100000000000000000000000000000000is //~ ERROR int literal is too large
|
100000000000000000000000000000000 //~ ERROR int literal is too large
|
||||||
|
|
||||||
; // the span shouldn't point to this.
|
; // the span shouldn't point to this.
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = box 1is;
|
let x = box 1;
|
||||||
let f = move|:| {
|
let f = move|:| {
|
||||||
let _a = x;
|
let _a = x;
|
||||||
drop(x);
|
drop(x);
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
// This file must never have a trailing newline
|
// This file must never have a trailing newline
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = Some(3is);
|
let x = Some(3);
|
||||||
let y = x.as_ref().unwrap_or(&5is); //~ ERROR: borrowed value does not live long enough
|
let y = x.as_ref().unwrap_or(&5); //~ ERROR: borrowed value does not live long enough
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn blah() -> isize { //~ ERROR not all control paths return a value
|
fn blah() -> i32 { //~ ERROR not all control paths return a value
|
||||||
1is
|
1i32
|
||||||
|
|
||||||
; //~ HELP consider removing this semicolon:
|
; //~ HELP consider removing this semicolon:
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut v = vec!(1is);
|
let mut v = vec!(1);
|
||||||
let mut f = |&mut:| v.push(2is);
|
let mut f = |&mut:| v.push(2);
|
||||||
let _w = v; //~ ERROR: cannot move out of `v`
|
let _w = v; //~ ERROR: cannot move out of `v`
|
||||||
|
|
||||||
f();
|
f();
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let r = {
|
let r = {
|
||||||
let x = box 42is;
|
let x = box 42;
|
||||||
let f = move|:| &x; //~ ERROR: `x` does not live long enough
|
let f = move|:| &x; //~ ERROR: `x` does not live long enough
|
||||||
f()
|
f()
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@ fn main() {
|
||||||
loop {
|
loop {
|
||||||
let tx = tx;
|
let tx = tx;
|
||||||
//~^ ERROR: use of moved value: `tx`
|
//~^ ERROR: use of moved value: `tx`
|
||||||
tx.send(1is);
|
tx.send(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Regression test for issue #1362 - without that fix the span will be bogus
|
// Regression test for issue #1362 - without that fix the span will be bogus
|
||||||
// no-reformat
|
// no-reformat
|
||||||
fn main() {
|
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
|
// 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
|
// on is significant; an error later in the source file might not
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
// Regression test for issue #1448 and #1386
|
// Regression test for issue #1448 and #1386
|
||||||
|
|
||||||
fn foo(a: usize) -> usize { a }
|
fn foo(a: u32) -> u32 { a }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("{}", foo(10is)); //~ ERROR mismatched types
|
println!("{}", foo(10i32)); //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,6 @@ fn make_shower<T>(x: T) -> Debuger<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let show3 = make_shower(3is);
|
let show3 = make_shower(3);
|
||||||
show3();
|
show3();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
macro_rules! f { () => (n) }
|
macro_rules! f { () => (n) }
|
||||||
|
|
||||||
fn main() -> (){
|
fn main() -> (){
|
||||||
for n in 0is..1 {
|
for n in 0..1 {
|
||||||
println!("{}", f!()); //~ ERROR unresolved name `n`
|
println!("{}", f!()); //~ ERROR unresolved name `n`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = vec![
|
let v = vec![
|
||||||
&3is
|
&3
|
||||||
//~^ ERROR borrowed value does not live long enough
|
//~^ ERROR borrowed value does not live long enough
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ impl Drop for Enum {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let foo = X(1is);
|
let foo = X(1);
|
||||||
drop(foo);
|
drop(foo);
|
||||||
match foo { //~ ERROR use of moved value
|
match foo { //~ ERROR use of moved value
|
||||||
X(1is) => (),
|
X(1) => (),
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ enum Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match Foo::Bar(1is) {
|
match Foo::Bar(1) {
|
||||||
Foo { i } => () //~ ERROR `Foo` does not name a struct or a struct variant
|
Foo { i } => () //~ ERROR `Foo` does not name a struct or a struct variant
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ enum MyOption<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match MyOption::MySome(42is) {
|
match MyOption::MySome(42) {
|
||||||
MyOption::MySome { x: 42is } => (),
|
MyOption::MySome { x: 42 } => (),
|
||||||
//~^ ERROR `MyOption::MySome` does not name a struct or a struct variant
|
//~^ ERROR `MyOption::MySome` does not name a struct or a struct variant
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,6 @@ impl Pair<
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let result = &Pair("shane", 1is);
|
let result = &Pair("shane", 1);
|
||||||
result.say();
|
result.say();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for _ in 1is..101 {
|
for _ in 1..101 {
|
||||||
let x = (); //~ ERROR: unused variable: `x`
|
let x = (); //~ ERROR: unused variable: `x`
|
||||||
match () {
|
match () {
|
||||||
a => {} //~ ERROR: unused variable: `a`
|
a => {} //~ ERROR: unused variable: `a`
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let t = (42is, 42is);
|
let t = (42, 42);
|
||||||
t.0::<isize>; //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `::`
|
t.0::<isize>; //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `::`
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
// compile-flags: -D while-true
|
// compile-flags: -D while-true
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut i = 0is;
|
let mut i = 0;
|
||||||
while true { //~ ERROR denote infinite loops with loop
|
while true { //~ ERROR denote infinite loops with loop
|
||||||
i += 1is;
|
i += 1;
|
||||||
if i == 5is { break; }
|
if i == 5 { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct Obj {
|
||||||
|
|
||||||
impl Obj {
|
impl Obj {
|
||||||
pub fn boom() -> bool {
|
pub fn boom() -> bool {
|
||||||
return 1is+1 == 2
|
return 1+1 == 2
|
||||||
}
|
}
|
||||||
pub fn chirp(&self) {
|
pub fn chirp(&self) {
|
||||||
self.boom(); //~ ERROR `&Obj` does not implement any method in scope named `boom`
|
self.boom(); //~ ERROR `&Obj` does not implement any method in scope named `boom`
|
||||||
|
@ -24,5 +24,5 @@ impl Obj {
|
||||||
fn main() {
|
fn main() {
|
||||||
let o = Obj { member: 0 };
|
let o = Obj { member: 0 };
|
||||||
o.chirp();
|
o.chirp();
|
||||||
1is + 1;
|
1 + 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = &5is;
|
let v = &5;
|
||||||
println!("{}", f(v).call_mut(()));
|
println!("{}", f(v).call_mut(()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,16 @@ fn main() {
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
match &Some(42is) {
|
match &Some(42i32) {
|
||||||
Some(x) => (),
|
Some(x) => (),
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `&core::option::Option<isize>`
|
//~| expected `&core::option::Option<i32>`
|
||||||
//~| found `core::option::Option<_>`
|
//~| found `core::option::Option<_>`
|
||||||
//~| expected &-ptr
|
//~| expected &-ptr
|
||||||
//~| found enum `core::option::Option`
|
//~| found enum `core::option::Option`
|
||||||
None => ()
|
None => ()
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `&core::option::Option<isize>`
|
//~| expected `&core::option::Option<i32>`
|
||||||
//~| found `core::option::Option<_>`
|
//~| found `core::option::Option<_>`
|
||||||
//~| expected &-ptr
|
//~| expected &-ptr
|
||||||
//~| found enum `core::option::Option`
|
//~| found enum `core::option::Option`
|
||||||
|
|
|
@ -19,7 +19,7 @@ impl<T:Copy> Foo for T {
|
||||||
fn take_param<T:Foo>(foo: &T) { }
|
fn take_param<T:Foo>(foo: &T) { }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = box 3is;
|
let x = box 3;
|
||||||
take_param(&x);
|
take_param(&x);
|
||||||
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@ impl<T:Copy> Foo for T {
|
||||||
fn take_param<T:Foo>(foo: &T) { }
|
fn take_param<T:Foo>(foo: &T) { }
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let x = box 3is;
|
let x = box 3;
|
||||||
take_param(&x); //~ ERROR `core::marker::Copy` is not implemented
|
take_param(&x); //~ ERROR `core::marker::Copy` is not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b() {
|
fn b() {
|
||||||
let x = box 3is;
|
let x = box 3;
|
||||||
let y = &x;
|
let y = &x;
|
||||||
let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented
|
let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub fn pub_fn() {
|
||||||
let e = used_enum::foo3;
|
let e = used_enum::foo3;
|
||||||
SemiUsedStruct::la_la_la();
|
SemiUsedStruct::la_la_la();
|
||||||
|
|
||||||
let i = 1is;
|
let i = 1;
|
||||||
match i {
|
match i {
|
||||||
USED_STATIC => (),
|
USED_STATIC => (),
|
||||||
USED_CONST => (),
|
USED_CONST => (),
|
||||||
|
|
|
@ -86,6 +86,6 @@ mod inner {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn foo() {
|
pub fn foo() {
|
||||||
let a = &1is as &inner::Trait;
|
let a = &1 as &inner::Trait;
|
||||||
a.f();
|
a.f();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl X {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo() -> isize {
|
fn foo() -> isize {
|
||||||
return (1is); //~ ERROR unnecessary parentheses around `return` value
|
return (1); //~ ERROR unnecessary parentheses around `return` value
|
||||||
}
|
}
|
||||||
fn bar() -> X {
|
fn bar() -> X {
|
||||||
return (X { y: true }); //~ ERROR unnecessary parentheses around `return` value
|
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
|
match (true) { //~ ERROR unnecessary parentheses around `match` head expression
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
if let 1is = (1is) {} //~ ERROR unnecessary parentheses around `if let` head expression
|
if let 1 = (1) {} //~ ERROR unnecessary parentheses around `if let` head expression
|
||||||
while let 1is = (2is) {} //~ ERROR unnecessary parentheses around `while let` head expression
|
while let 1 = (2) {} //~ ERROR unnecessary parentheses around `while let` head expression
|
||||||
let v = X { y: false };
|
let v = X { y: false };
|
||||||
// struct lits needs parens, so these shouldn't warn.
|
// struct lits needs parens, so these shouldn't warn.
|
||||||
if (v == X { y: true }) {}
|
if (v == X { y: true }) {}
|
||||||
|
@ -47,7 +47,7 @@ fn main() {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut _a = (0is); //~ ERROR unnecessary parentheses around assigned value
|
let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value
|
||||||
_a = (0is); //~ ERROR unnecessary parentheses around assigned value
|
_a = (0); //~ ERROR unnecessary parentheses around assigned value
|
||||||
_a += (1is); //~ ERROR unnecessary parentheses around assigned value
|
_a += (1); //~ ERROR unnecessary parentheses around assigned value
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ mod bar {
|
||||||
pub mod c {
|
pub mod c {
|
||||||
use foo::Point;
|
use foo::Point;
|
||||||
use foo::Square; //~ ERROR unused import
|
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)]
|
#[allow(unused_imports)]
|
||||||
|
@ -65,8 +65,8 @@ mod bar {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
cal(foo::Point{x:3, y:9});
|
cal(foo::Point{x:3, y:9});
|
||||||
let mut a = 3is;
|
let mut a = 3;
|
||||||
let mut b = 4is;
|
let mut b = 4;
|
||||||
swap(&mut a, &mut b);
|
swap(&mut a, &mut b);
|
||||||
test::C.b();
|
test::C.b();
|
||||||
let _a = foo();
|
let _a = foo();
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// negative cases
|
// negative cases
|
||||||
let mut a = 3is; //~ ERROR: variable does not need to be mutable
|
let mut a = 3; //~ ERROR: variable does not need to be mutable
|
||||||
let mut a = 2is; //~ ERROR: variable does not need to be mutable
|
let mut a = 2; //~ ERROR: variable does not need to be mutable
|
||||||
let mut b = 3is; //~ ERROR: variable does not need to be mutable
|
let mut b = 3; //~ ERROR: variable does not need to be mutable
|
||||||
let mut a = vec!(3is); //~ 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) = (1is, 2is); //~ 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
|
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, 1) | //~ ERROR: variable does not need to be mutable
|
||||||
(mut x, 2) |
|
(mut x, 2) |
|
||||||
(mut x, 3) => {
|
(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
|
fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable
|
||||||
|
|
||||||
// positive cases
|
// positive cases
|
||||||
let mut a = 2is;
|
let mut a = 2;
|
||||||
a = 3is;
|
a = 3;
|
||||||
let mut a = Vec::new();
|
let mut a = Vec::new();
|
||||||
a.push(3is);
|
a.push(3);
|
||||||
let mut a = Vec::new();
|
let mut a = Vec::new();
|
||||||
callback(|| {
|
callback(|| {
|
||||||
a.push(3is);
|
a.push(3);
|
||||||
});
|
});
|
||||||
let (mut a, b) = (1is, 2is);
|
let (mut a, b) = (1, 2);
|
||||||
a = 34;
|
a = 34;
|
||||||
|
|
||||||
match 30is {
|
match 30 {
|
||||||
mut x => {
|
mut x => {
|
||||||
x = 21is;
|
x = 21;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match (30is, 2is) {
|
match (30, 2) {
|
||||||
(mut x, 1) |
|
(mut x, 1) |
|
||||||
(mut x, 2) |
|
(mut x, 2) |
|
||||||
(mut x, 3) => {
|
(mut x, 3) => {
|
||||||
|
@ -65,12 +65,12 @@ fn main() {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let x = |&mut: mut y: isize| y = 32is;
|
let x = |&mut: mut y: isize| y = 32;
|
||||||
fn nothing(mut foo: isize) { foo = 37is; }
|
fn nothing(mut foo: isize) { foo = 37; }
|
||||||
|
|
||||||
// leading underscore should avoid the warning, just like the
|
// leading underscore should avoid the warning, just like the
|
||||||
// unused variable lint.
|
// unused variable lint.
|
||||||
let mut _allowed = 1is;
|
let mut _allowed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn callback<F>(f: F) where F: FnOnce() {}
|
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
|
// make sure the lint attribute can be turned off
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
fn foo(mut a: isize) {
|
fn foo(mut a: isize) {
|
||||||
let mut a = 3is;
|
let mut a = 3;
|
||||||
let mut b = vec!(2is);
|
let mut b = vec!(2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Tests that a function with a ! annotation always actually fails
|
// 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
|
fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging
|
||||||
println!("{}", 3is);
|
println!("{}", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { bad_bang(5us); }
|
fn main() { bad_bang(5us); }
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
//
|
//
|
||||||
// regression test for #8005
|
// regression test for #8005
|
||||||
|
|
||||||
macro_rules! test { () => { fn foo() -> isize { 1is; } } }
|
macro_rules! test { () => { fn foo() -> i32 { 1i32; } } }
|
||||||
//~^ ERROR not all control paths return a value
|
//~^ ERROR not all control paths return a value
|
||||||
//~^^ HELP consider removing this semicolon
|
//~^^ 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
|
fn bar(x: u32) -> u32 { //~ ERROR not all control paths return a value
|
||||||
x * 2; //~ HELP consider removing this semicolon
|
x * 2; //~ HELP consider removing this semicolon
|
||||||
|
|
|
@ -31,40 +31,40 @@ fn f1d() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f2() {
|
fn f2() {
|
||||||
let x = 3is;
|
let x = 3;
|
||||||
//~^ ERROR unused variable: `x`
|
//~^ ERROR unused variable: `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f3() {
|
fn f3() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
//~^ ERROR variable `x` is assigned to, but never used
|
//~^ ERROR variable `x` is assigned to, but never used
|
||||||
x += 4is;
|
x += 4;
|
||||||
//~^ ERROR value assigned to `x` is never read
|
//~^ ERROR value assigned to `x` is never read
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f3b() {
|
fn f3b() {
|
||||||
let mut z = 3is;
|
let mut z = 3;
|
||||||
//~^ ERROR variable `z` is assigned to, but never used
|
//~^ ERROR variable `z` is assigned to, but never used
|
||||||
loop {
|
loop {
|
||||||
z += 4is;
|
z += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn f3c() {
|
fn f3c() {
|
||||||
let mut z = 3is;
|
let mut z = 3;
|
||||||
loop { z += 4is; }
|
loop { z += 4; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[allow(unused_assignments)]
|
#[allow(unused_assignments)]
|
||||||
fn f3d() {
|
fn f3d() {
|
||||||
let mut x = 3is;
|
let mut x = 3;
|
||||||
x += 4is;
|
x += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f4() {
|
fn f4() {
|
||||||
match Some(3is) {
|
match Some(3) {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
//~^ ERROR unused variable: `i`
|
//~^ ERROR unused variable: `i`
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ enum tri {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f4b() -> isize {
|
fn f4b() -> isize {
|
||||||
match tri::a(3is) {
|
match tri::a(3) {
|
||||||
tri::a(i) | tri::b(i) | tri::c(i) => {
|
tri::a(i) | tri::b(i) | tri::c(i) => {
|
||||||
i
|
i
|
||||||
}
|
}
|
||||||
|
@ -85,17 +85,17 @@ fn f4b() -> isize {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f5a() {
|
fn f5a() {
|
||||||
for x in 1is..10 { }
|
for x in 1..10 { }
|
||||||
//~^ ERROR unused variable: `x`
|
//~^ ERROR unused variable: `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f5b() {
|
fn f5b() {
|
||||||
for (x, _) in [1is, 2, 3].iter().enumerate() { }
|
for (x, _) in [1, 2, 3].iter().enumerate() { }
|
||||||
//~^ ERROR unused variable: `x`
|
//~^ ERROR unused variable: `x`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f5c() {
|
fn f5c() {
|
||||||
for (_, x) in [1is, 2, 3].iter().enumerate() {
|
for (_, x) in [1, 2, 3].iter().enumerate() {
|
||||||
//~^ ERROR unused variable: `x`
|
//~^ ERROR unused variable: `x`
|
||||||
continue;
|
continue;
|
||||||
std::os::set_exit_status(*x); //~ WARNING unreachable statement
|
std::os::set_exit_status(*x); //~ WARNING unreachable statement
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = box 5is;
|
let x = box 5;
|
||||||
let y = x;
|
let y = x;
|
||||||
println!("{}", *x); //~ ERROR use of moved value: `*x`
|
println!("{}", *x); //~ ERROR use of moved value: `*x`
|
||||||
y.clone();
|
y.clone();
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn forever() -> ! {
|
||||||
loop {
|
loop {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 42is; //~ ERROR `return` in a function declared as diverging
|
return 42; //~ ERROR `return` in a function declared as diverging
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match 1is {
|
match 1i32 {
|
||||||
1is => 1is,
|
1i32 => 1,
|
||||||
2us => 1is, //~ ERROR mismatched types
|
2u32 => 1, //~ ERROR mismatched types
|
||||||
_ => 2is,
|
_ => 2,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match 0is { 1is => () } //~ ERROR non-exhaustive patterns
|
match 0 { 1 => () } //~ ERROR non-exhaustive patterns
|
||||||
match 0is { 0is if false => () } //~ ERROR non-exhaustive patterns
|
match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let v = [1is, 2, 3];
|
let v = [1, 2, 3];
|
||||||
match v {
|
match v {
|
||||||
[_, _, _] => {}
|
[_, _, _] => {}
|
||||||
[_, _, _] => {} //~ ERROR unreachable pattern
|
[_, _, _] => {} //~ ERROR unreachable pattern
|
||||||
|
|
|
@ -33,7 +33,7 @@ fn main() {
|
||||||
//~^ HELP maybe a `()` to call it is missing
|
//~^ HELP maybe a `()` to call it is missing
|
||||||
|
|
||||||
// Ensure the span is useful
|
// 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()
|
let a = ys.iter()
|
||||||
.map(|x| x)
|
.map(|x| x)
|
||||||
.filter(|&&x| x == 1)
|
.filter(|&&x| x == 1)
|
||||||
|
|
|
@ -23,9 +23,9 @@ fn main() {
|
||||||
//~| found `Foo`
|
//~| found `Foo`
|
||||||
//~| expected &-ptr
|
//~| expected &-ptr
|
||||||
//~| found struct `Foo`
|
//~| found struct `Foo`
|
||||||
Foo::bar(&42is); //~ ERROR mismatched types
|
Foo::bar(&42i32); //~ ERROR mismatched types
|
||||||
//~| expected `&Foo`
|
//~| expected `&Foo`
|
||||||
//~| found `&isize`
|
//~| found `&i32`
|
||||||
//~| expected struct `Foo`
|
//~| expected struct `Foo`
|
||||||
//~| found isize
|
//~| found i32
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
struct Foo(Box<isize>);
|
struct Foo(Box<isize>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = (box 1is,);
|
let x = (box 1,);
|
||||||
let y = x.0;
|
let y = x.0;
|
||||||
let z = x.0; //~ ERROR use of moved value: `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 y = x.0;
|
||||||
let z = x.0; //~ ERROR use of moved value: `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
Loading…
Add table
Add a link
Reference in a new issue