Rollup merge of #22994 - eddyb:unsuffix-ints-good, r=alexcrichton
Automatic has-same-types testing methodology can be found in #22501. Because most of them don't work with `--pretty=typed`, compile-fail tests were manually audited. r? @aturon
This commit is contained in:
commit
145b83e633
330 changed files with 1096 additions and 1098 deletions
|
|
@ -16,7 +16,7 @@ pub mod kitties {
|
|||
}
|
||||
|
||||
impl cat {
|
||||
pub fn speak(&mut self) { self.meows += 1_usize; }
|
||||
pub fn speak(&mut self) { self.meows += 1; }
|
||||
pub fn meow_count(&mut self) -> uint { self.meows }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ pub mod kitties {
|
|||
impl cat {
|
||||
pub fn meow(&mut self) {
|
||||
println!("Meow");
|
||||
self.meows += 1_usize;
|
||||
if self.meows % 5_usize == 0_usize {
|
||||
self.meows += 1;
|
||||
if self.meows % 5 == 0 {
|
||||
self.how_hungry += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ pub mod kitty {
|
|||
impl cat {
|
||||
fn meow(&mut self) {
|
||||
println!("Meow");
|
||||
self.meows += 1_usize;
|
||||
if self.meows % 5_usize == 0_usize {
|
||||
self.meows += 1;
|
||||
if self.meows % 5 == 0 {
|
||||
self.how_hungry += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ impl uint_helpers for uint {
|
|||
let mut i = *self;
|
||||
while i < v {
|
||||
f(i);
|
||||
i += 1_usize;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
#[inline]
|
||||
pub fn iter<T, F>(v: &[T], mut f: F) where F: FnMut(&T) {
|
||||
let mut i = 0_usize;
|
||||
let mut i = 0;
|
||||
let n = v.len();
|
||||
while i < n {
|
||||
f(&v[i]);
|
||||
i += 1_usize;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@
|
|||
|
||||
// same as cci_iter_lib, more-or-less, but not marked inline
|
||||
pub fn iter<F>(v: Vec<uint> , mut f: F) where F: FnMut(uint) {
|
||||
let mut i = 0_usize;
|
||||
let mut i = 0;
|
||||
let n = v.len();
|
||||
while i < n {
|
||||
f(v[i]);
|
||||
i += 1_usize;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
#![crate_type = "dylib"]
|
||||
#[macro_export]
|
||||
macro_rules! reexported {
|
||||
() => ( 3_usize )
|
||||
() => ( 3 )
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
|
|||
};
|
||||
|
||||
let mut text = &*text;
|
||||
let mut total = 0_usize;
|
||||
let mut total = 0;
|
||||
while !text.is_empty() {
|
||||
match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) {
|
||||
Some(&(rn, val)) => {
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ use std::ops::Add;
|
|||
|
||||
#[inline]
|
||||
pub fn has_closures() -> uint {
|
||||
let x = 1_usize;
|
||||
let x = 1;
|
||||
let mut f = move || x;
|
||||
let y = 1_usize;
|
||||
let y = 1;
|
||||
let g = || y;
|
||||
f() + g()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ impl Noise2DContext {
|
|||
*x = random_gradient(&mut rng);
|
||||
}
|
||||
|
||||
let mut permutations = [0i32; 256];
|
||||
let mut permutations = [0; 256];
|
||||
for (i, x) in permutations.iter_mut().enumerate() {
|
||||
*x = i as i32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ fn creature(
|
|||
to_rendezvous: Sender<CreatureInfo>,
|
||||
to_rendezvous_log: Sender<String>
|
||||
) {
|
||||
let mut creatures_met = 0i32;
|
||||
let mut creatures_met = 0;
|
||||
let mut evil_clones_met = 0;
|
||||
let mut rendezvous = from_rendezvous.iter();
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ impl Perm {
|
|||
}
|
||||
|
||||
fn get(&mut self, mut idx: i32) -> P {
|
||||
let mut pp = [0u8; 16];
|
||||
let mut pp = [0; 16];
|
||||
self.permcount = idx as u32;
|
||||
for (i, place) in self.perm.p.iter_mut().enumerate() {
|
||||
*place = i as i32 + 1;
|
||||
|
|
@ -183,7 +183,7 @@ fn main() {
|
|||
let n = std::env::args()
|
||||
.nth(1)
|
||||
.and_then(|arg| arg.parse().ok())
|
||||
.unwrap_or(2i32);
|
||||
.unwrap_or(2);
|
||||
|
||||
let (checksum, maxflips) = fannkuch(n);
|
||||
println!("{}\nPfannkuchen({}) = {}", checksum, n, maxflips);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ impl<'a, W: Writer> RepeatFasta<'a, W> {
|
|||
|
||||
fn make(&mut self, n: usize) -> IoResult<()> {
|
||||
let alu_len = self.alu.len();
|
||||
let mut buf = repeat(0u8).take(alu_len + LINE_LEN).collect::<Vec<_>>();
|
||||
let mut buf = repeat(0).take(alu_len + LINE_LEN).collect::<Vec<_>>();
|
||||
let alu: &[u8] = self.alu.as_bytes();
|
||||
|
||||
copy_memory(&mut buf, alu);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
|
|||
-> std::old_io::IoResult<()>
|
||||
{
|
||||
try!(wr.write(header.as_bytes()));
|
||||
let mut line = [0u8; LINE_LENGTH + 1];
|
||||
let mut line = [0; LINE_LENGTH + 1];
|
||||
while n > 0 {
|
||||
let nb = min(LINE_LENGTH, n);
|
||||
for i in 0..nb {
|
||||
|
|
|
|||
|
|
@ -78,11 +78,11 @@ impl Code {
|
|||
}
|
||||
|
||||
fn rotate(&self, c: u8, frame: usize) -> Code {
|
||||
Code(self.push_char(c).hash() & ((1u64 << (2 * frame)) - 1))
|
||||
Code(self.push_char(c).hash() & ((1 << (2 * frame)) - 1))
|
||||
}
|
||||
|
||||
fn pack(string: &str) -> Code {
|
||||
string.bytes().fold(Code(0u64), |a, b| a.push_char(b))
|
||||
string.bytes().fold(Code(0), |a, b| a.push_char(b))
|
||||
}
|
||||
|
||||
fn unpack(&self, frame: usize) -> String {
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > {
|
|||
.map(|(id, p)| transform(p, id != 3))
|
||||
.collect();
|
||||
|
||||
(0i32..50).map(|yx| {
|
||||
(0..50).map(|yx| {
|
||||
transforms.iter().enumerate().map(|(id, t)| {
|
||||
t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect()
|
||||
}).collect()
|
||||
|
|
@ -211,7 +211,7 @@ fn filter_masks(masks: &mut Vec<Vec<Vec<u64>>>) {
|
|||
|
||||
// Gets the identifier of a mask.
|
||||
fn get_id(m: u64) -> u8 {
|
||||
for id in 0u8..10 {
|
||||
for id in 0..10 {
|
||||
if m & (1 << (id + 50) as usize) != 0 {return id;}
|
||||
}
|
||||
panic!("{:016x} does not have a valid identifier", m);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ impl Sudoku {
|
|||
reader.read_line(&mut s).unwrap();
|
||||
assert_eq!(s, "9,9\n");
|
||||
|
||||
let mut g = repeat(vec![0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8])
|
||||
let mut g = repeat(vec![0, 0, 0, 0, 0, 0, 0, 0, 0])
|
||||
.take(10).collect::<Vec<_>>();
|
||||
for line in reader.lines() {
|
||||
let line = line.unwrap();
|
||||
|
|
@ -94,10 +94,10 @@ impl Sudoku {
|
|||
// solve sudoku grid
|
||||
pub fn solve(&mut self) {
|
||||
let mut work: Vec<(u8, u8)> = Vec::new(); /* queue of uncolored fields */
|
||||
for row in 0u8..9u8 {
|
||||
for col in 0u8..9u8 {
|
||||
for row in 0..9 {
|
||||
for col in 0..9 {
|
||||
let color = self.grid[row as usize][col as usize];
|
||||
if color == 0u8 {
|
||||
if color == 0 {
|
||||
work.push((row, col));
|
||||
}
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ impl Sudoku {
|
|||
}
|
||||
|
||||
fn next_color(&mut self, row: u8, col: u8, start_color: u8) -> bool {
|
||||
if start_color < 10u8 {
|
||||
if start_color < 10 {
|
||||
// colors not yet used
|
||||
let mut avail: Box<_> = box Colors::new(start_color);
|
||||
|
||||
|
|
@ -132,15 +132,15 @@ impl Sudoku {
|
|||
// find first remaining color that is available
|
||||
let next = avail.next();
|
||||
self.grid[row as usize][col as usize] = next;
|
||||
return 0u8 != next;
|
||||
return 0 != next;
|
||||
}
|
||||
self.grid[row as usize][col as usize] = 0u8;
|
||||
self.grid[row as usize][col as usize] = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// find colors available in neighbourhood of (row, col)
|
||||
fn drop_colors(&mut self, avail: &mut Colors, row: u8, col: u8) {
|
||||
for idx in 0u8..9u8 {
|
||||
for idx in 0..9 {
|
||||
/* check same column fields */
|
||||
avail.remove(self.grid[idx as usize][col as usize]);
|
||||
/* check same row fields */
|
||||
|
|
@ -148,10 +148,10 @@ impl Sudoku {
|
|||
}
|
||||
|
||||
// check same block fields
|
||||
let row0 = (row / 3u8) * 3u8;
|
||||
let col0 = (col / 3u8) * 3u8;
|
||||
for alt_row in row0..row0 + 3u8 {
|
||||
for alt_col in col0..col0 + 3u8 {
|
||||
let row0 = (row / 3) * 3;
|
||||
let col0 = (col / 3) * 3;
|
||||
for alt_row in row0..row0 + 3 {
|
||||
for alt_col in col0..col0 + 3 {
|
||||
avail.remove(self.grid[alt_row as usize][alt_col as usize]);
|
||||
}
|
||||
}
|
||||
|
|
@ -161,29 +161,29 @@ impl Sudoku {
|
|||
// Stores available colors as simple bitfield, bit 0 is always unset
|
||||
struct Colors(u16);
|
||||
|
||||
static HEADS: u16 = (1u16 << 10) - 1; /* bits 9..0 */
|
||||
static HEADS: u16 = (1 << 10) - 1; /* bits 9..0 */
|
||||
|
||||
impl Colors {
|
||||
fn new(start_color: u8) -> Colors {
|
||||
// Sets bits 9..start_color
|
||||
let tails = !0u16 << start_color as usize;
|
||||
let tails = !0 << start_color as usize;
|
||||
return Colors(HEADS & tails);
|
||||
}
|
||||
|
||||
fn next(&self) -> u8 {
|
||||
let Colors(c) = *self;
|
||||
let val = c & HEADS;
|
||||
if 0u16 == val {
|
||||
return 0u8;
|
||||
if 0 == val {
|
||||
return 0;
|
||||
} else {
|
||||
return val.trailing_zeros() as u8
|
||||
}
|
||||
}
|
||||
|
||||
fn remove(&mut self, color: u8) {
|
||||
if color != 0u8 {
|
||||
if color != 0 {
|
||||
let Colors(val) = *self;
|
||||
let mask = !(1u16 << color as usize);
|
||||
let mask = !(1 << color as usize);
|
||||
*self = Colors(val & mask);
|
||||
}
|
||||
}
|
||||
|
|
@ -191,57 +191,57 @@ impl Colors {
|
|||
|
||||
static DEFAULT_SUDOKU: [[u8;9];9] = [
|
||||
/* 0 1 2 3 4 5 6 7 8 */
|
||||
/* 0 */ [0u8, 4u8, 0u8, 6u8, 0u8, 0u8, 0u8, 3u8, 2u8],
|
||||
/* 1 */ [0u8, 0u8, 8u8, 0u8, 2u8, 0u8, 0u8, 0u8, 0u8],
|
||||
/* 2 */ [7u8, 0u8, 0u8, 8u8, 0u8, 0u8, 0u8, 0u8, 0u8],
|
||||
/* 3 */ [0u8, 0u8, 0u8, 5u8, 0u8, 0u8, 0u8, 0u8, 0u8],
|
||||
/* 4 */ [0u8, 5u8, 0u8, 0u8, 0u8, 3u8, 6u8, 0u8, 0u8],
|
||||
/* 5 */ [6u8, 8u8, 0u8, 0u8, 0u8, 0u8, 0u8, 9u8, 0u8],
|
||||
/* 6 */ [0u8, 9u8, 5u8, 0u8, 0u8, 6u8, 0u8, 7u8, 0u8],
|
||||
/* 7 */ [0u8, 0u8, 0u8, 0u8, 4u8, 0u8, 0u8, 6u8, 0u8],
|
||||
/* 8 */ [4u8, 0u8, 0u8, 0u8, 0u8, 7u8, 2u8, 0u8, 3u8]
|
||||
/* 0 */ [0, 4, 0, 6, 0, 0, 0, 3, 2],
|
||||
/* 1 */ [0, 0, 8, 0, 2, 0, 0, 0, 0],
|
||||
/* 2 */ [7, 0, 0, 8, 0, 0, 0, 0, 0],
|
||||
/* 3 */ [0, 0, 0, 5, 0, 0, 0, 0, 0],
|
||||
/* 4 */ [0, 5, 0, 0, 0, 3, 6, 0, 0],
|
||||
/* 5 */ [6, 8, 0, 0, 0, 0, 0, 9, 0],
|
||||
/* 6 */ [0, 9, 5, 0, 0, 6, 0, 7, 0],
|
||||
/* 7 */ [0, 0, 0, 0, 4, 0, 0, 6, 0],
|
||||
/* 8 */ [4, 0, 0, 0, 0, 7, 2, 0, 3]
|
||||
];
|
||||
|
||||
#[cfg(test)]
|
||||
static DEFAULT_SOLUTION: [[u8;9];9] = [
|
||||
/* 0 1 2 3 4 5 6 7 8 */
|
||||
/* 0 */ [1u8, 4u8, 9u8, 6u8, 7u8, 5u8, 8u8, 3u8, 2u8],
|
||||
/* 1 */ [5u8, 3u8, 8u8, 1u8, 2u8, 9u8, 7u8, 4u8, 6u8],
|
||||
/* 2 */ [7u8, 2u8, 6u8, 8u8, 3u8, 4u8, 1u8, 5u8, 9u8],
|
||||
/* 3 */ [9u8, 1u8, 4u8, 5u8, 6u8, 8u8, 3u8, 2u8, 7u8],
|
||||
/* 4 */ [2u8, 5u8, 7u8, 4u8, 9u8, 3u8, 6u8, 1u8, 8u8],
|
||||
/* 5 */ [6u8, 8u8, 3u8, 7u8, 1u8, 2u8, 5u8, 9u8, 4u8],
|
||||
/* 6 */ [3u8, 9u8, 5u8, 2u8, 8u8, 6u8, 4u8, 7u8, 1u8],
|
||||
/* 7 */ [8u8, 7u8, 2u8, 3u8, 4u8, 1u8, 9u8, 6u8, 5u8],
|
||||
/* 8 */ [4u8, 6u8, 1u8, 9u8, 5u8, 7u8, 2u8, 8u8, 3u8]
|
||||
/* 0 */ [1, 4, 9, 6, 7, 5, 8, 3, 2],
|
||||
/* 1 */ [5, 3, 8, 1, 2, 9, 7, 4, 6],
|
||||
/* 2 */ [7, 2, 6, 8, 3, 4, 1, 5, 9],
|
||||
/* 3 */ [9, 1, 4, 5, 6, 8, 3, 2, 7],
|
||||
/* 4 */ [2, 5, 7, 4, 9, 3, 6, 1, 8],
|
||||
/* 5 */ [6, 8, 3, 7, 1, 2, 5, 9, 4],
|
||||
/* 6 */ [3, 9, 5, 2, 8, 6, 4, 7, 1],
|
||||
/* 7 */ [8, 7, 2, 3, 4, 1, 9, 6, 5],
|
||||
/* 8 */ [4, 6, 1, 9, 5, 7, 2, 8, 3]
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn colors_new_works() {
|
||||
assert_eq!(*Colors::new(1), 1022u16);
|
||||
assert_eq!(*Colors::new(2), 1020u16);
|
||||
assert_eq!(*Colors::new(3), 1016u16);
|
||||
assert_eq!(*Colors::new(4), 1008u16);
|
||||
assert_eq!(*Colors::new(5), 992u16);
|
||||
assert_eq!(*Colors::new(6), 960u16);
|
||||
assert_eq!(*Colors::new(7), 896u16);
|
||||
assert_eq!(*Colors::new(8), 768u16);
|
||||
assert_eq!(*Colors::new(9), 512u16);
|
||||
assert_eq!(*Colors::new(1), 1022);
|
||||
assert_eq!(*Colors::new(2), 1020);
|
||||
assert_eq!(*Colors::new(3), 1016);
|
||||
assert_eq!(*Colors::new(4), 1008);
|
||||
assert_eq!(*Colors::new(5), 992);
|
||||
assert_eq!(*Colors::new(6), 960);
|
||||
assert_eq!(*Colors::new(7), 896);
|
||||
assert_eq!(*Colors::new(8), 768);
|
||||
assert_eq!(*Colors::new(9), 512);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colors_next_works() {
|
||||
assert_eq!(Colors(0).next(), 0u8);
|
||||
assert_eq!(Colors(2).next(), 1u8);
|
||||
assert_eq!(Colors(4).next(), 2u8);
|
||||
assert_eq!(Colors(8).next(), 3u8);
|
||||
assert_eq!(Colors(16).next(), 4u8);
|
||||
assert_eq!(Colors(32).next(), 5u8);
|
||||
assert_eq!(Colors(64).next(), 6u8);
|
||||
assert_eq!(Colors(128).next(), 7u8);
|
||||
assert_eq!(Colors(256).next(), 8u8);
|
||||
assert_eq!(Colors(512).next(), 9u8);
|
||||
assert_eq!(Colors(1024).next(), 0u8);
|
||||
assert_eq!(Colors(0).next(), 0);
|
||||
assert_eq!(Colors(2).next(), 1);
|
||||
assert_eq!(Colors(4).next(), 2);
|
||||
assert_eq!(Colors(8).next(), 3);
|
||||
assert_eq!(Colors(16).next(), 4);
|
||||
assert_eq!(Colors(32).next(), 5);
|
||||
assert_eq!(Colors(64).next(), 6);
|
||||
assert_eq!(Colors(128).next(), 7);
|
||||
assert_eq!(Colors(256).next(), 8);
|
||||
assert_eq!(Colors(512).next(), 9);
|
||||
assert_eq!(Colors(1024).next(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -253,7 +253,7 @@ fn colors_remove_works() {
|
|||
colors.remove(1);
|
||||
|
||||
// THEN
|
||||
assert_eq!(colors.next(), 2u8);
|
||||
assert_eq!(colors.next(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ pub use use_from_trait_xc::Trait;
|
|||
|
||||
fn main() {
|
||||
match () {
|
||||
Trait { x: 42_usize } => () //~ ERROR use of trait `Trait` in a struct pattern
|
||||
Trait { x: 42 } => () //~ ERROR use of trait `Trait` in a struct pattern
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let _x: i32 = [1i32, 2, 3];
|
||||
let _x: i32 = [1, 2, 3];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `i32`
|
||||
//~| found `[i32; 3]`
|
||||
//~| found `[_; 3]`
|
||||
//~| expected i32
|
||||
//~| found array of 3 elements
|
||||
|
||||
let x: &[i32] = &[1i32, 2, 3];
|
||||
let x: &[i32] = &[1, 2, 3];
|
||||
let _y: &i32 = x;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&i32`
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ pub fn main() {
|
|||
let x: isize;
|
||||
let y: isize;
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "=r"(x) : "=r"(5_usize)); //~ ERROR operand constraint contains '='
|
||||
asm!("mov $1, $0" : "=r"(y) : "+r"(5_usize)); //~ ERROR operand constraint contains '+'
|
||||
asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '='
|
||||
asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+'
|
||||
}
|
||||
foo(x);
|
||||
foo(y);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn main() {
|
|||
x = 1; //~ NOTE prior assignment occurs here
|
||||
foo(x);
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(5_usize));
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(5));
|
||||
//~^ ERROR re-assignment of immutable variable `x`
|
||||
}
|
||||
foo(x);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ fn foo(x: isize) { println!("{}", x); }
|
|||
pub fn main() {
|
||||
let x: isize;
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "r"(x) : "r"(5_usize)); //~ ERROR output operand constraint lacks '='
|
||||
asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '='
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct cat {
|
|||
}
|
||||
|
||||
impl cat {
|
||||
pub fn speak(&self) { self.meows += 1_usize; }
|
||||
pub fn speak(&self) { self.meows += 1; }
|
||||
}
|
||||
|
||||
fn cat(in_x : usize, in_y : isize) -> cat {
|
||||
|
|
@ -26,6 +26,6 @@ fn cat(in_x : usize, in_y : isize) -> cat {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52_usize, 99);
|
||||
let nyan : cat = cat(52, 99);
|
||||
nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// Tests that a function with a ! annotation always actually fails
|
||||
|
||||
fn bad_bang(i: usize) -> ! {
|
||||
return 7_usize; //~ ERROR `return` in a function declared as diverging [E0166]
|
||||
return 7; //~ ERROR `return` in a function declared as diverging [E0166]
|
||||
}
|
||||
|
||||
fn main() { bad_bang(5); }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
if i < 0_usize { } else { panic!(); }
|
||||
if i < 0 { } else { panic!(); }
|
||||
}
|
||||
|
||||
fn main() { bad_bang(5); }
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static i: String = 10i32;
|
||||
static i: String = 10;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `collections::string::String`
|
||||
//~| found `i32`
|
||||
//~| found `_`
|
||||
//~| expected struct `collections::string::String`
|
||||
//~| found i32
|
||||
//~| found integral variable
|
||||
fn main() { println!("{}", i); }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn foo<T:'static>() {
|
||||
1_usize.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
|
||||
1.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
|
||||
}
|
||||
|
||||
trait bar {
|
||||
|
|
|
|||
|
|
@ -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 `i32`
|
||||
// error-pattern:`&&` cannot be applied to type `_`
|
||||
|
||||
fn main() { let x = 1i32 && 2i32; }
|
||||
fn main() { let x = 1 && 2; }
|
||||
|
|
|
|||
|
|
@ -21,25 +21,25 @@ fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
|
|||
fn main() {
|
||||
// By-ref captures
|
||||
{
|
||||
let mut x = 0_usize;
|
||||
let mut x = 0;
|
||||
let _f = to_fn(|| x = 42); //~ ERROR cannot assign
|
||||
|
||||
let mut y = 0_usize;
|
||||
let mut y = 0;
|
||||
let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
|
||||
|
||||
let mut z = 0_usize;
|
||||
let mut z = 0;
|
||||
let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
|
||||
}
|
||||
|
||||
// By-value captures
|
||||
{
|
||||
let mut x = 0_usize;
|
||||
let mut x = 0;
|
||||
let _f = to_fn(move || x = 42); //~ ERROR cannot assign
|
||||
|
||||
let mut y = 0_usize;
|
||||
let mut y = 0;
|
||||
let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
|
||||
|
||||
let mut z = 0_usize;
|
||||
let mut z = 0;
|
||||
let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ enum Foo {
|
|||
}
|
||||
|
||||
fn blah() {
|
||||
let f = &Foo::Foo1(box 1u32, box 2u32);
|
||||
let f = &Foo::Foo1(box 1, box 2);
|
||||
match *f { //~ ERROR cannot move out of
|
||||
Foo::Foo1(num1, //~ NOTE attempting to move value to here
|
||||
num2) => (), //~ NOTE and here
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#![allow(dead_code)]
|
||||
fn main() {
|
||||
// Original borrow ends at end of function
|
||||
let mut x = 1_usize;
|
||||
let mut x = 1;
|
||||
let y = &mut x;
|
||||
let z = &x; //~ ERROR cannot borrow
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ fn foo() {
|
|||
match true {
|
||||
true => {
|
||||
// Original borrow ends at end of match arm
|
||||
let mut x = 1_usize;
|
||||
let mut x = 1;
|
||||
let y = &x;
|
||||
let z = &mut x; //~ ERROR cannot borrow
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ fn foo() {
|
|||
fn bar() {
|
||||
// Original borrow ends at end of closure
|
||||
|| {
|
||||
let mut x = 1_usize;
|
||||
let mut x = 1;
|
||||
let y = &mut x;
|
||||
let z = &mut x; //~ ERROR cannot borrow
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ fn cat(in_x : usize) -> cat {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let nyan = cat(0_usize);
|
||||
let nyan = cat(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ impl cat {
|
|||
fn sleep(&self) { loop{} }
|
||||
fn meow(&self) {
|
||||
println!("Meow");
|
||||
meows += 1_usize; //~ ERROR unresolved name
|
||||
meows += 1; //~ ERROR unresolved name
|
||||
sleep(); //~ ERROR unresolved name
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@
|
|||
// Tests that we forbid coercion from `[T; n]` to `&[T]`
|
||||
|
||||
fn main() {
|
||||
let _: &[i32] = [0i32];
|
||||
let _: &[i32] = [0];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&[i32]`
|
||||
//~| found `[i32; 1]`
|
||||
//~| found `[_; 1]`
|
||||
//~| expected &-ptr
|
||||
//~| found array of 1 elements
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const A: usize = { 1_usize; 2 };
|
||||
const A: usize = { 1; 2 };
|
||||
//~^ ERROR: blocks in constants are limited to items and tail expressions
|
||||
|
||||
const B: usize = { { } 2 };
|
||||
|
|
@ -19,7 +19,7 @@ macro_rules! foo {
|
|||
}
|
||||
const C: usize = { foo!(); 2 };
|
||||
|
||||
const D: usize = { let x = 4_usize; 2 };
|
||||
const D: usize = { let x = 4; 2 };
|
||||
//~^ ERROR: blocks in constants are limited to items and tail expressions
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ impl S { }
|
|||
impl T for S { }
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
static s: usize = 0_usize;
|
||||
static s: usize = 0;
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
const c: usize = 0_usize;
|
||||
const c: usize = 0;
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
mod m { }
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ use std::cell::RefCell;
|
|||
|
||||
fn main() {
|
||||
let b = {
|
||||
let a = Box::new(RefCell::new(4i8));
|
||||
*a.borrow() + 1i8 //~ ERROR `*a` does not live long enough
|
||||
let a = Box::new(RefCell::new(4));
|
||||
*a.borrow() + 1 //~ ERROR `*a` does not live long enough
|
||||
};
|
||||
println!("{}", b);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
// test. Not ideal, but oh well :(
|
||||
|
||||
fn main() {
|
||||
let a = &[1i32, 2, 3];
|
||||
let a = &[1, 2, 3];
|
||||
println!("{}", {
|
||||
extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
|
||||
fn atomic_fence();
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@
|
|||
mod circ1 {
|
||||
pub use circ2::f2;
|
||||
pub fn f1() { println!("f1"); }
|
||||
pub fn common() -> usize { return 0_usize; }
|
||||
pub fn common() -> usize { return 0; }
|
||||
}
|
||||
|
||||
mod circ2 {
|
||||
pub use circ1::f1;
|
||||
pub fn f2() { println!("f2"); }
|
||||
pub fn common() -> usize { return 1_usize; }
|
||||
pub fn common() -> usize { return 1; }
|
||||
}
|
||||
|
||||
mod test {
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
(return)[0_usize]; //~ ERROR the type of this value must be known in this context
|
||||
(return)[0]; //~ ERROR the type of this value must be known in this context
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ impl<T:Clone> ToOpt for Option<T> {
|
|||
}
|
||||
|
||||
fn function<T:ToOpt + Clone>(counter: usize, t: T) {
|
||||
if counter > 0_usize {
|
||||
function(counter - 1_usize, t.to_option());
|
||||
if counter > 0 {
|
||||
function(counter - 1, t.to_option());
|
||||
// FIXME(#4287) Error message should be here. It should be
|
||||
// a type error to instantiate `test` at a type other than T.
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
function(22_usize, 22_usize);
|
||||
function(22, 22);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn blah() -> i32 { //~ ERROR not all control paths return a value
|
||||
1i32
|
||||
1
|
||||
|
||||
; //~ HELP consider removing this semicolon:
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
|
|||
{
|
||||
let cont_iter = cont.iter();
|
||||
//~^ ERROR cannot infer an appropriate lifetime for autoref due to conflicting requirements
|
||||
let result = cont_iter.fold(Some(0u16), |state, val| {
|
||||
let result = cont_iter.fold(Some(0), |state, val| {
|
||||
state.map_or(None, |mask| {
|
||||
let bit = 1 << val;
|
||||
if mask & bit == 0 {Some(mask|bit)} else {None}
|
||||
|
|
@ -34,10 +34,10 @@ fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
|
|||
}
|
||||
|
||||
fn main() {
|
||||
check((3_usize, 5_usize));
|
||||
check((3, 5));
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&_`
|
||||
//~| found `(usize, usize)`
|
||||
//~| found `(_, _)`
|
||||
//~| expected &-ptr
|
||||
//~| found tuple
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,17 +14,17 @@ pub fn main() {
|
|||
// The expected arm type `Option<T>` has one type parameter, while
|
||||
// the actual arm `Result<T, E>` has two. typeck should not be
|
||||
// tricked into looking up a non-existing second type parameter.
|
||||
let _x: usize = match Some(1_usize) {
|
||||
let _x: usize = match Some(1) {
|
||||
Ok(u) => u,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<usize>`
|
||||
//~| expected `core::option::Option<_>`
|
||||
//~| found `core::result::Result<_, _>`
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| found enum `core::result::Result`
|
||||
|
||||
Err(e) => panic!(e)
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `core::option::Option<usize>`
|
||||
//~| expected `core::option::Option<_>`
|
||||
//~| found `core::result::Result<_, _>`
|
||||
//~| expected enum `core::option::Option`
|
||||
//~| found enum `core::result::Result`
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ fn main() {
|
|||
//~| expected u8
|
||||
//~| found array of 1 elements
|
||||
|
||||
let local = [0u8];
|
||||
let local = [0];
|
||||
let _v = &local as *mut u8;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `*mut u8`
|
||||
//~| found `&[u8; 1]`
|
||||
//~| found `&[_; 1]`
|
||||
//~| expected u8,
|
||||
//~| found array of 1 elements
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = 1_usize;
|
||||
let x = 1;
|
||||
let y: Foo;
|
||||
|
||||
// `x { ... }` should not be interpreted as a struct literal here
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@
|
|||
|
||||
fn main() {
|
||||
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
||||
(|| Box::new(*[0_usize].as_slice()))();
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[usize]`
|
||||
(|| Box::new(*[0].as_slice()))();
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[_]`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ static mut A2: usize = 1;
|
|||
const A3: usize = 1;
|
||||
|
||||
fn main() {
|
||||
match 1_usize {
|
||||
match 1 {
|
||||
A1 => {} //~ ERROR: static variables cannot be referenced in a pattern
|
||||
A2 => {} //~ ERROR: static variables cannot be referenced in a pattern
|
||||
A3 => {}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub static X: usize = 1_usize;
|
||||
pub static X: usize = 1;
|
||||
|
||||
fn main() {
|
||||
match 1_usize {
|
||||
match 1 {
|
||||
self::X => { },
|
||||
//~^ ERROR static variables cannot be referenced in a pattern, use a `const` instead
|
||||
_ => { },
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn _create_render(_: &()) ->
|
|||
AbstractRenderer
|
||||
//~^ ERROR: the trait `core::marker::Sized` is not implemented
|
||||
{
|
||||
match 0_usize {
|
||||
match 0 {
|
||||
_ => unimplemented!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ enum Foo {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let f = Foo::Variant(42_usize); //~ ERROR uses it like a function
|
||||
let f = Foo::Variant(42); //~ ERROR uses it like a function
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ impl Tr for usize {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let s = &mut 1_usize;
|
||||
let s = &mut 1;
|
||||
|
||||
MyPtr(s).poke(s);
|
||||
//~^ ERROR cannot borrow `*s` as mutable more than once at a time
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use std::cell::RefCell;
|
|||
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
||||
|
||||
fn main() {
|
||||
let mut y = 1_usize;
|
||||
let mut y = 1;
|
||||
let c = RefCell::new(vec![]);
|
||||
c.push(Box::new(|| y = 0));
|
||||
c.push(Box::new(|| y = 0));
|
||||
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
}
|
||||
|
||||
fn ufcs() {
|
||||
let mut y = 1_usize;
|
||||
let mut y = 1;
|
||||
let c = RefCell::new(vec![]);
|
||||
|
||||
Push::push(&c, Box::new(|| y = 0));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl Foo for Thing {
|
|||
|
||||
#[inline(never)]
|
||||
fn foo(b: &Bar) {
|
||||
b.foo(&0usize)
|
||||
b.foo(&0)
|
||||
//~^ ERROR the trait `Foo` is not implemented for the type `Bar`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
fn main() {
|
||||
if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
|
||||
//~| expected `()`
|
||||
//~| found `i32`
|
||||
//~| found `_`
|
||||
//~| expected ()
|
||||
//~| found i32
|
||||
765i32
|
||||
//~| found integral variable
|
||||
765
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ fn mut_ref() -> &'static mut T {
|
|||
}
|
||||
|
||||
fn mut_ptr() -> *mut T {
|
||||
unsafe { 0u8 as *mut T }
|
||||
unsafe { 0 as *mut T }
|
||||
}
|
||||
|
||||
fn const_ptr() -> *const T {
|
||||
unsafe { 0u8 as *const T }
|
||||
unsafe { 0 as *const T }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
fn fail_len(v: Vec<isize> ) -> usize {
|
||||
let mut i = 3;
|
||||
panic!();
|
||||
for x in &v { i += 1_usize; }
|
||||
for x in &v { i += 1; }
|
||||
//~^ ERROR: unreachable statement
|
||||
return i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
fn bar(int_param: usize) {}
|
||||
|
||||
fn main() {
|
||||
let foo: [u8; 4] = [1u8; 4_usize];
|
||||
let foo: [u8; 4] = [1; 4];
|
||||
bar(foo);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `usize`
|
||||
|
|
|
|||
|
|
@ -32,17 +32,17 @@ trait UnusedTrait : MarkerTrait {
|
|||
|
||||
impl CtxtFn for usize {
|
||||
fn f8(self, i: usize) -> usize {
|
||||
i * 4_usize
|
||||
i * 4
|
||||
}
|
||||
|
||||
fn f9(i: usize) -> usize {
|
||||
i * 4_usize
|
||||
i * 4
|
||||
}
|
||||
}
|
||||
|
||||
impl OtherTrait for usize {
|
||||
fn f9(i: usize) -> usize {
|
||||
i * 8_usize
|
||||
i * 8
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,16 +23,16 @@ fn main() {
|
|||
_ => ()
|
||||
}
|
||||
|
||||
match &Some(42i32) {
|
||||
match &Some(42) {
|
||||
Some(x) => (),
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&core::option::Option<i32>`
|
||||
//~| expected `&core::option::Option<_>`
|
||||
//~| found `core::option::Option<_>`
|
||||
//~| expected &-ptr
|
||||
//~| found enum `core::option::Option`
|
||||
None => ()
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&core::option::Option<i32>`
|
||||
//~| expected `&core::option::Option<_>`
|
||||
//~| found `core::option::Option<_>`
|
||||
//~| expected &-ptr
|
||||
//~| found enum `core::option::Option`
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn foo(_x: Rc<usize>) {}
|
|||
fn bar<F:FnOnce() + Send>(_: F) { }
|
||||
|
||||
fn main() {
|
||||
let x = Rc::new(3_usize);
|
||||
let x = Rc::new(3);
|
||||
bar(move|| foo(x));
|
||||
//~^ ERROR `core::marker::Send` is not implemented
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ impl<'r> Itble<'r, usize, Range<usize>> for (usize, usize) {
|
|||
fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool {
|
||||
//~^ HELP: consider using an explicit lifetime parameter as shown: fn check<'r, I: Iterator<Item = usize>, T: Itble<'r, usize, I>>(cont: &'r T)
|
||||
let cont_iter = cont.iter(); //~ ERROR: cannot infer
|
||||
let result = cont_iter.fold(Some(0u16), |state, val| {
|
||||
let result = cont_iter.fold(Some(0), |state, val| {
|
||||
state.map_or(None, |mask| {
|
||||
let bit = 1 << val;
|
||||
if mask & bit == 0 {Some(mask|bit)} else {None}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,6 @@ fn field_match_in_let(f: Bar) -> bool {
|
|||
fn main() {
|
||||
field_read(Foo { x: 1, b: false, marker: std::marker::NoCopy });
|
||||
field_match_in_patterns(XYZ::Z);
|
||||
field_match_in_let(Bar { x: 42_usize, b: true, _guard: () });
|
||||
field_match_in_let(Bar { x: 42, b: true, _guard: () });
|
||||
let _ = Baz { x: 0 };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
// regression test for #8005
|
||||
|
||||
macro_rules! test { () => { fn foo() -> i32 { 1i32; } } }
|
||||
macro_rules! test { () => { fn foo() -> i32 { 1; } } }
|
||||
//~^ ERROR not all control paths return a value
|
||||
//~^^ HELP consider removing this semicolon
|
||||
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@
|
|||
extern crate macro_non_reexport_2;
|
||||
|
||||
fn main() {
|
||||
assert_eq!(reexported!(), 3_usize); //~ ERROR macro undefined
|
||||
assert_eq!(reexported!(), 3); //~ ERROR macro undefined
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@
|
|||
extern crate macro_reexport_1;
|
||||
|
||||
fn main() {
|
||||
assert_eq!(reexported!(), 3_usize); //~ ERROR macro undefined
|
||||
assert_eq!(reexported!(), 3); //~ ERROR macro undefined
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ fn main() {
|
|||
//~| found `Foo`
|
||||
//~| expected &-ptr
|
||||
//~| found struct `Foo`
|
||||
Foo::bar(&42i32); //~ ERROR mismatched types
|
||||
Foo::bar(&42); //~ ERROR mismatched types
|
||||
//~| expected `&Foo`
|
||||
//~| found `&i32`
|
||||
//~| found `&_`
|
||||
//~| expected struct `Foo`
|
||||
//~| found i32
|
||||
//~| found integral variable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,21 +9,21 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let foo = &mut 1i32;
|
||||
let foo = &mut 1;
|
||||
|
||||
// (separate lines to ensure the spans are accurate)
|
||||
|
||||
let &_ //~ ERROR mismatched types
|
||||
//~| expected `&mut i32`
|
||||
//~| expected `&mut _`
|
||||
//~| found `&_`
|
||||
//~| values differ in mutability
|
||||
= foo;
|
||||
let &mut _ = foo;
|
||||
|
||||
let bar = &1i32;
|
||||
let bar = &1;
|
||||
let &_ = bar;
|
||||
let &mut _ //~ ERROR mismatched types
|
||||
//~| expected `&i32`
|
||||
//~| expected `&_`
|
||||
//~| found `&mut _`
|
||||
//~| values differ in mutability
|
||||
= bar;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@ fn cat(in_x : usize, in_y : isize) -> cat {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52_usize, 99);
|
||||
let nyan : cat = cat(52, 99);
|
||||
nyan.eat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ fn cat(in_x : usize, in_y : isize) -> cat {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52_usize, 99);
|
||||
let nyan : cat = cat(52, 99);
|
||||
nyan.how_hungry = 0; //~ ERROR cannot assign
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ fn struct_with_a_nested_enum_and_vector() {
|
|||
Foo { first: true, second: None } => (),
|
||||
Foo { first: true, second: Some(_) } => (),
|
||||
Foo { first: false, second: None } => (),
|
||||
Foo { first: false, second: Some([1_usize, 2_usize, 3_usize, 4_usize]) } => ()
|
||||
Foo { first: false, second: Some([1, 2, 3, 4]) } => ()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
|
||||
enum blah { a(isize, isize, usize), b(isize, isize), }
|
||||
|
||||
fn main() { match blah::a(1, 1, 2_usize) { blah::a(_, x, y) | blah::b(x, y) => { } } }
|
||||
fn main() { match blah::a(1, 1, 2) { blah::a(_, x, y) | blah::b(x, y) => { } } }
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ mod kitties {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let nyan : kitties::cat = kitties::cat(52_usize, 99);
|
||||
let nyan : kitties::cat = kitties::cat(52, 99);
|
||||
nyan.nap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ extern crate cci_class;
|
|||
use cci_class::kitties::cat;
|
||||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52_usize, 99);
|
||||
assert!((nyan.meows == 52_usize));
|
||||
let nyan : cat = cat(52, 99);
|
||||
assert!((nyan.meows == 52));
|
||||
//~^ ERROR field `meows` of struct `cci_class::kitties::cat` is private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ pub fn main() {
|
|||
//~^ ERROR the trait `core::num::Int` is not implemented for the type `f32`
|
||||
|
||||
// Unsized type.
|
||||
let arr: &[_] = &[1u32, 2, 3];
|
||||
let arr: &[_] = &[1, 2, 3];
|
||||
let range = *arr..;
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,18 +15,18 @@ struct dog {
|
|||
impl dog {
|
||||
pub fn chase_cat(&mut self) {
|
||||
let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
|
||||
*p += 1_usize;
|
||||
*p += 1;
|
||||
}
|
||||
|
||||
pub fn chase_cat_2(&mut self) {
|
||||
let p: &mut usize = &mut self.cats_chased;
|
||||
*p += 1_usize;
|
||||
*p += 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn dog() -> dog {
|
||||
dog {
|
||||
cats_chased: 0_usize
|
||||
cats_chased: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl dog {
|
|||
pub fn chase_cat(&mut self) {
|
||||
let _f = || {
|
||||
let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
|
||||
*p = 3_usize;
|
||||
*p = 3;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ enum ast<'a> {
|
|||
}
|
||||
|
||||
fn build() {
|
||||
let x = ast::num(3_usize);
|
||||
let y = ast::num(4_usize);
|
||||
let x = ast::num(3);
|
||||
let y = ast::num(4);
|
||||
let z = ast::add(&x, &y);
|
||||
compute(&z);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let a0 = 0u8;
|
||||
let f = 1u8;
|
||||
let a0 = 0;
|
||||
let f = 1;
|
||||
let mut a1 = &a0;
|
||||
match (&a1,) {
|
||||
(&ref b0,) => {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
fn main() {
|
||||
// Unboxed closure case
|
||||
{
|
||||
let mut x = 0_usize;
|
||||
let mut x = 0;
|
||||
let mut f = || &mut x; //~ ERROR cannot infer
|
||||
let x = f();
|
||||
let y = f();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ fn get_v(gc: Box<get_ctxt>) -> usize {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let ctxt = ctxt { v: 22_usize };
|
||||
let ctxt = ctxt { v: 22 };
|
||||
let hc = has_ctxt { c: &ctxt };
|
||||
assert_eq!(get_v(box hc as Box<get_ctxt>), 22_usize);
|
||||
assert_eq!(get_v(box hc as Box<get_ctxt>), 22);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,40 +26,40 @@ fn main() {
|
|||
let pt = PointF {
|
||||
//~^ ERROR structure constructor specifies a structure of type
|
||||
//~| expected f32
|
||||
//~| found i32
|
||||
x: 1i32,
|
||||
y: 2i32,
|
||||
//~| found integral variable
|
||||
x: 1,
|
||||
y: 2,
|
||||
};
|
||||
|
||||
let pt2 = Point::<f32> {
|
||||
//~^ ERROR structure constructor specifies a structure of type
|
||||
//~| expected f32
|
||||
//~| found i32
|
||||
x: 3i32,
|
||||
y: 4i32,
|
||||
//~| found integral variable
|
||||
x: 3,
|
||||
y: 4,
|
||||
};
|
||||
|
||||
let pair = PairF {
|
||||
//~^ ERROR structure constructor specifies a structure of type
|
||||
//~| expected f32
|
||||
//~| found i32
|
||||
x: 5i32,
|
||||
y: 6i32,
|
||||
//~| found integral variable
|
||||
x: 5,
|
||||
y: 6,
|
||||
};
|
||||
|
||||
let pair2 = PairF::<i32> {
|
||||
//~^ ERROR structure constructor specifies a structure of type
|
||||
//~| expected f32
|
||||
//~| found i32
|
||||
x: 7i32,
|
||||
y: 8i32,
|
||||
//~| found integral variable
|
||||
x: 7,
|
||||
y: 8,
|
||||
};
|
||||
|
||||
let pt3 = PointF::<i32> {
|
||||
//~^ ERROR wrong number of type arguments
|
||||
//~| ERROR structure constructor specifies a structure of type
|
||||
x: 9i32,
|
||||
y: 10i32,
|
||||
x: 9,
|
||||
y: 10,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@
|
|||
|
||||
fn f() -> isize { return g(); }
|
||||
|
||||
fn g() -> usize { return 0_usize; }
|
||||
fn g() -> usize { return 0; }
|
||||
|
||||
fn main() { let y = f(); }
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ where T : Convert<U>
|
|||
}
|
||||
|
||||
fn a() {
|
||||
test(22_i32, std::default::Default::default()); //~ ERROR type annotations required
|
||||
test(22, std::default::Default::default()); //~ ERROR type annotations required
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
struct Point(i32, i32);
|
||||
|
||||
fn main() {
|
||||
let origin = Point(0i32, 0i32);
|
||||
let origin = Point(0, 0);
|
||||
origin.0;
|
||||
origin.1;
|
||||
origin.2;
|
||||
//~^ ERROR attempted out-of-bounds tuple index `2` on type `Point`
|
||||
let tuple = (0i32, 0i32);
|
||||
let tuple = (0, 0);
|
||||
tuple.0;
|
||||
tuple.1;
|
||||
tuple.2;
|
||||
//~^ ERROR attempted out-of-bounds tuple index `2` on type `(i32, i32)`
|
||||
//~^ ERROR attempted out-of-bounds tuple index `2` on type `(_, _)`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
// Checking that the compiler reports multiple type errors at once
|
||||
|
||||
fn main() { let a: bool = 1i32; let b: i32 = true; }
|
||||
fn main() { let a: bool = 1; let b: i32 = true; }
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `bool`
|
||||
//~| found `i32`
|
||||
//~| found `_`
|
||||
//~| expected bool
|
||||
//~| found i32
|
||||
//~| found integral variable
|
||||
//~| ERROR mismatched types
|
||||
//~| expected `i32`
|
||||
//~| found `bool`
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ trait BrokenAdd: Int {
|
|||
impl<T: Int> BrokenAdd for T {}
|
||||
|
||||
pub fn main() {
|
||||
let foo: u8 = 0u8;
|
||||
let foo: u8 = 0;
|
||||
let x: u8 = foo.broken_add("hello darkness my old friend".to_string());
|
||||
println!("{}", x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn test2() -> (_, _) { (5, 5) }
|
|||
static TEST3: _ = "test";
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
static TEST4: _ = 145u16;
|
||||
static TEST4: _ = 145;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
static TEST5: (_, _) = (1, 2);
|
||||
|
|
@ -74,7 +74,7 @@ pub fn main() {
|
|||
static FN_TEST3: _ = "test";
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
static FN_TEST4: _ = 145u16;
|
||||
static FN_TEST4: _ = 145;
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
static FN_TEST5: (_, _) = (1, 2);
|
||||
|
|
|
|||
|
|
@ -23,28 +23,28 @@ fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
|
|||
fn main() {
|
||||
// By-ref cases
|
||||
{
|
||||
let x = Box::new(0_usize);
|
||||
let x = Box::new(0);
|
||||
let f = to_fn(|| drop(x)); //~ ERROR cannot move
|
||||
}
|
||||
{
|
||||
let x = Box::new(0_usize);
|
||||
let x = Box::new(0);
|
||||
let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move
|
||||
}
|
||||
{
|
||||
let x = Box::new(0_usize);
|
||||
let x = Box::new(0);
|
||||
let f = to_fn_once(|| drop(x)); // OK -- FnOnce
|
||||
}
|
||||
// By-value cases
|
||||
{
|
||||
let x = Box::new(0_usize);
|
||||
let x = Box::new(0);
|
||||
let f = to_fn(move || drop(x)); //~ ERROR cannot move
|
||||
}
|
||||
{
|
||||
let x = Box::new(0_usize);
|
||||
let x = Box::new(0);
|
||||
let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move
|
||||
}
|
||||
{
|
||||
let x = Box::new(0_usize);
|
||||
let x = Box::new(0);
|
||||
let f = to_fn_once(move || drop(x)); // this one is ok
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
fn set(x: &mut usize) { *x = 0; }
|
||||
|
||||
fn main() {
|
||||
let x = 0_usize;
|
||||
let x = 0;
|
||||
move || x = 1; //~ ERROR cannot assign
|
||||
move || set(&mut x); //~ ERROR cannot borrow
|
||||
move || x = 1; //~ ERROR cannot assign
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// reference cannot escape the region of that variable.
|
||||
fn main() {
|
||||
let _f = {
|
||||
let x = 0_usize;
|
||||
let x = 0;
|
||||
|| x //~ ERROR `x` does not live long enough
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// cause borrow conflicts.
|
||||
|
||||
fn main() {
|
||||
let mut x = 0_usize;
|
||||
let mut x = 0;
|
||||
let f = || x += 1;
|
||||
let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,21 +20,21 @@ fn to_fn<A,F:Fn<A>>(f: F) -> F { f }
|
|||
fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
|
||||
|
||||
fn a() {
|
||||
let n = 0u8;
|
||||
let n = 0;
|
||||
let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
|
||||
n += 1;
|
||||
});
|
||||
}
|
||||
|
||||
fn b() {
|
||||
let mut n = 0u8;
|
||||
let mut n = 0;
|
||||
let mut f = to_fn_mut(|| {
|
||||
n += 1; // OK
|
||||
});
|
||||
}
|
||||
|
||||
fn c() {
|
||||
let n = 0u8;
|
||||
let n = 0;
|
||||
let mut f = to_fn_mut(move || {
|
||||
// If we just did a straight-forward desugaring, this would
|
||||
// compile, but we do something a bit more subtle, and hence
|
||||
|
|
@ -44,21 +44,21 @@ fn c() {
|
|||
}
|
||||
|
||||
fn d() {
|
||||
let mut n = 0u8;
|
||||
let mut n = 0;
|
||||
let mut f = to_fn_mut(move || {
|
||||
n += 1; // OK
|
||||
});
|
||||
}
|
||||
|
||||
fn e() {
|
||||
let n = 0u8;
|
||||
let n = 0;
|
||||
let mut f = to_fn(move || {
|
||||
n += 1; //~ ERROR cannot assign
|
||||
});
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let mut n = 0u8;
|
||||
let mut n = 0;
|
||||
let mut f = to_fn(move || {
|
||||
n += 1; //~ ERROR cannot assign
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn call<F>(f: F) where F : Fn() {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let mut counter = 0_u32;
|
||||
let mut counter = 0;
|
||||
call(|| {
|
||||
counter += 1;
|
||||
//~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@
|
|||
|
||||
enum foo { a(Box<foo>, isize), b(usize), }
|
||||
|
||||
fn main() { match foo::b(1_usize) { foo::b(_) | foo::a(box _, 1) => { } foo::a(_, 1) => { } } }
|
||||
fn main() { match foo::b(1) { foo::b(_) | foo::a(box _, 1) => { } foo::a(_, 1) => { } } }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
fn f(p: *const u8) {
|
||||
*p = 0u8; //~ ERROR dereference of unsafe pointer requires unsafe function or block
|
||||
*p = 0; //~ ERROR dereference of unsafe pointer requires unsafe function or block
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,19 +33,19 @@ struct AffineU32(u32);
|
|||
|
||||
fn main() {
|
||||
{
|
||||
let a = AffineU32(1_u32);
|
||||
let a = AffineU32(1);
|
||||
let x = foo(&a);
|
||||
drop(a); //~ ERROR cannot move out of `a`
|
||||
drop(x);
|
||||
}
|
||||
{
|
||||
let a = AffineU32(1_u32);
|
||||
let a = AffineU32(1);
|
||||
let x = bar(&a);
|
||||
drop(a); //~ ERROR cannot move out of `a`
|
||||
drop(x);
|
||||
}
|
||||
{
|
||||
let a = AffineU32(1_u32);
|
||||
let a = AffineU32(1);
|
||||
let x = baz(&a);
|
||||
drop(a); //~ ERROR cannot move out of `a`
|
||||
drop(x);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ impl TraitB for isize {
|
|||
}
|
||||
|
||||
fn call_it<B:TraitB>(b: B) -> isize {
|
||||
let y = 4_usize;
|
||||
let y = 4;
|
||||
b.gimme_an_a(y) //~ ERROR the trait `TraitA` is not implemented
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,13 +139,13 @@ fn assoc_enum<T: TraitWithAssocType>(arg: Enum<T>) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
assoc_struct(Struct { b: -1i32, b1: 0i64 });
|
||||
assoc_local(1i32);
|
||||
assoc_arg::<i32>(2i64);
|
||||
assoc_return_value(3i32);
|
||||
assoc_tuple((4i32, 5i64));
|
||||
assoc_enum(Enum::Variant1(6i32, 7i64));
|
||||
assoc_enum(Enum::Variant2(8i64, 9i32));
|
||||
assoc_struct(Struct { b: -1, b1: 0 });
|
||||
assoc_local(1);
|
||||
assoc_arg::<i32>(2);
|
||||
assoc_return_value(3);
|
||||
assoc_tuple((4, 5));
|
||||
assoc_enum(Enum::Variant1(6, 7));
|
||||
assoc_enum(Enum::Variant2(8, 9));
|
||||
}
|
||||
|
||||
fn zzz() { () }
|
||||
|
|
|
|||
|
|
@ -128,10 +128,10 @@ fn main() {
|
|||
next: Val {
|
||||
val: box UniqueNode {
|
||||
next: Empty,
|
||||
value: 1_u16,
|
||||
value: 1,
|
||||
}
|
||||
},
|
||||
value: 0_u16,
|
||||
value: 0,
|
||||
};
|
||||
|
||||
let unique_unique: Box<UniqueNode<u32>> = box UniqueNode {
|
||||
|
|
|
|||
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