fn main() {
let _x: i32 = [1, 2, 3];
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `[_; 3]`
- //~| expected i32
- //~| found array of 3 elements
+ //~| expected type `i32`
+ //~| found type `[_; 3]`
+ //~| expected i32, found array of 3 elements
let x: &[i32] = &[1, 2, 3];
let _y: &i32 = x;
//~^ ERROR mismatched types
- //~| expected `&i32`
- //~| found `&[i32]`
- //~| expected i32
- //~| found slice
+ //~| expected type `&i32`
+ //~| found type `&[i32]`
+ //~| expected i32, found slice
}
fn foo2<I: Foo>(x: I) {
let _: Bar = x.boo();
//~^ ERROR mismatched types
- //~| expected `Bar`
- //~| found `<I as Foo>::A`
- //~| expected struct `Bar`
- //~| found associated type
+ //~| expected type `Bar`
+ //~| found type `<I as Foo>::A`
+ //~| expected struct `Bar`, found associated type
}
pub fn f1_int_int() {
f1(2i32, 4i32);
//~^ ERROR mismatched types
- //~| expected `u32`
- //~| found `i32`
+ //~| expected u32, found i32
}
pub fn f1_int_uint() {
pub fn f2_int() {
let _: i32 = f2(2i32);
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `u32`
+ //~| expected i32, found u32
}
pub fn main() { }
fn main() {
let mut x = Int(1);
x //~ error: use of moved value: `x`
+ //~^ value used here after move
+ //~| note: move occurs because `x` has type `Int`
+=
- x; //~ note: `x` moved here because it has type `Int`, which is non-copyable
+ x; //~ value moved here
let y = Int(2);
y //~ error: cannot borrow immutable local variable `y` as mutable
static i: String = 10;
//~^ ERROR mismatched types
-//~| expected `std::string::String`
-//~| found `_`
-//~| expected struct `std::string::String`
-//~| found integral variable
+//~| expected type `std::string::String`
+//~| found type `_`
+//~| expected struct `std::string::String`, found integral variable
fn main() { println!("{}", i); }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn main(x: isize) { } //~ ERROR: main function expects type
+fn main(x: isize) { } //~ ERROR: main function has wrong type
&mut f
+
&f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
+ //~^ cannot borrow `f` as immutable because it is also borrowed as mutable
}
fn immut_plus_mut() {
&f
+
&mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable
+ //~^ cannot borrow `f` as mutable because it is also borrowed as immutable
}
fn main() {}
fn main() {
while true {
true //~ ERROR mismatched types
- //~| expected `()`
- //~| found `bool`
- //~| expected ()
- //~| found bool
+ //~| expected type `()`
+ //~| found type `bool`
+ //~| expected (), found bool
}
}
fn copy_after_move() {
let a: Box<_> = box A { x: box 0, y: 1 };
let _x = a.x;
+ //~^ value moved here
let _y = a.y; //~ ERROR use of moved
- //~^^ NOTE `a` moved here (through moving `a.x`)
+ //~^ move occurs because `a.x` has type `Box<isize>`
+ //~| value used here after move
}
fn move_after_move() {
let a: Box<_> = box B { x: box 0, y: box 1 };
let _x = a.x;
+ //~^ value moved here
let _y = a.y; //~ ERROR use of moved
- //~^^ NOTE `a` moved here (through moving `a.x`)
+ //~^ move occurs because `a.x` has type `Box<isize>`
+ //~| value used here after move
}
fn borrow_after_move() {
let a: Box<_> = box A { x: box 0, y: 1 };
let _x = a.x;
+ //~^ value moved here
let _y = &a.y; //~ ERROR use of moved
- //~^^ NOTE `a` moved here (through moving `a.x`)
+ //~^ move occurs because `a.x` has type `Box<isize>`
+ //~| value used here after move
}
fn move_after_borrow() {
fn borrow_after_mut_borrow() {
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &mut a.x;
- //~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`);
+ //~^ NOTE mutable borrow occurs here (via `a.x`)
let _y = &a.y; //~ ERROR cannot borrow
+ //~^ immutable borrow occurs here (via `a.y`)
}
-//~^ NOTE previous borrow ends here
+//~^ NOTE mutable borrow ends here
fn mut_borrow_after_borrow() {
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &a.x;
- //~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`)
+ //~^ NOTE immutable borrow occurs here (via `a.x`)
let _y = &mut a.y; //~ ERROR cannot borrow
+ //~^ mutable borrow occurs here (via `a.y`)
}
-//~^ NOTE previous borrow ends here
+//~^ NOTE immutable borrow ends here
fn copy_after_move_nested() {
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = a.x.x;
- //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
+ //~^ value moved here
let _y = a.y; //~ ERROR use of collaterally moved
+ //~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
+ //~| value used here after move
}
fn move_after_move_nested() {
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = a.x.x;
- //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
+ //~^ value moved here
let _y = a.y; //~ ERROR use of collaterally moved
+ //~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
+ //~| value used here after move
}
fn borrow_after_move_nested() {
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = a.x.x;
- //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
+ //~^ value moved here
let _y = &a.y; //~ ERROR use of collaterally moved
+ //~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
+ //~| value used here after move
}
fn move_after_borrow_nested() {
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = &a.x.x;
- //~^ NOTE borrow of `a.x.x` occurs here
+ //~^ borrow of `a.x.x` occurs here
let _y = a.y; //~ ERROR cannot move
}
fn borrow_after_mut_borrow_nested() {
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &mut a.x.x;
- //~^ NOTE previous borrow of `a.x.x` occurs here; the mutable borrow prevents
+ //~^ mutable borrow occurs here
let _y = &a.y; //~ ERROR cannot borrow
+ //~^ immutable borrow occurs here
}
-//~^ NOTE previous borrow ends here
+//~^ NOTE mutable borrow ends here
fn mut_borrow_after_borrow_nested() {
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &a.x.x;
- //~^ NOTE previous borrow of `a.x.x` occurs here; the immutable borrow prevents
+ //~^ immutable borrow occurs here
let _y = &mut a.y; //~ ERROR cannot borrow
+ //~^ mutable borrow occurs here
}
-//~^ NOTE previous borrow ends here
+//~^ NOTE immutable borrow ends here
fn main() {
copy_after_move();
//~^ ERROR cannot borrow
let c2 = || set(&mut *x);
//~^ ERROR cannot borrow
- //~| ERROR closure requires unique access
+ //~| ERROR two closures require unique access to `x` at the same time
}
fn main() {
fn d(x: &mut isize) {
let c1 = || set(x);
- let c2 = || set(x); //~ ERROR closure requires unique access to `x`
+ let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time
}
fn e(x: &mut isize) {
borrow(&*v); //~ ERROR cannot borrow
if cond2 {
x = &mut v; //~ ERROR cannot borrow
+ //~^ ERROR cannot borrow
}
}
}
match 1 {
1 => { addr = &mut x; }
//~^ ERROR cannot borrow `x` as mutable more than once at a time
+ //~| ERROR cannot borrow `x` as mutable more than once at a time
2 => { addr = &mut x; }
//~^ ERROR cannot borrow `x` as mutable more than once at a time
_ => { addr = &mut x; }
// Original borrow ends at end of function
let mut x = 1;
let y = &mut x;
- //~^ previous borrow of `x` occurs here; the mutable borrow prevents
+ //~^ mutable borrow occurs here
let z = &x; //~ ERROR cannot borrow
+ //~^ immutable borrow occurs here
}
-//~^ NOTE previous borrow ends here
+//~^ NOTE mutable borrow ends here
fn foo() {
match true {
// Original borrow ends at end of match arm
let mut x = 1;
let y = &x;
- //~^ previous borrow of `x` occurs here; the immutable borrow prevents
+ //~^ immutable borrow occurs here
let z = &mut x; //~ ERROR cannot borrow
+ //~^ mutable borrow occurs here
}
- //~^ NOTE previous borrow ends here
+ //~^ NOTE immutable borrow ends here
false => ()
}
}
|| {
let mut x = 1;
let y = &mut x;
- //~^ previous borrow of `x` occurs here; the mutable borrow prevents
+ //~^ first mutable borrow occurs here
let z = &mut x; //~ ERROR cannot borrow
+ //~^ second mutable borrow occurs here
};
- //~^ NOTE previous borrow ends here
+ //~^ NOTE first borrow ends here
}
fn main() {
let x = X;
- let closure = |_| foo(x); //~ ERROR E0524
+ let closure = |_| foo(x); //~ ERROR E0525
bar(closure);
}
let x = 0;
f(&x);
//~^ ERROR mismatched types
- //~| expected `&mut i32`
- //~| found `&_`
+ //~| expected type `&mut i32`
+ //~| found type `&_`
//~| values differ in mutability
}
fn main() {
let _: &[i32] = [0];
//~^ ERROR mismatched types
- //~| expected `&[i32]`
- //~| found `[_; 1]`
- //~| expected &-ptr
- //~| found array of 1 elements
+ //~| expected type `&[i32]`
+ //~| found type `[_; 1]`
+ //~| expected &-ptr, found array of 1 elements
}
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let x: Box<Trait> = Box::new(Foo);
let _y: &Trait = x; //~ ERROR mismatched types
- //~| expected `&Trait`
- //~| found `Box<Trait>`
- //~| expected &-ptr
- //~| found box
+ //~| expected type `&Trait`
+ //~| found type `Box<Trait>`
+ //~| expected &-ptr, found box
}
// Here, F is instantiated with $0=uint
let x = foo();
//~^ ERROR: mismatched types
+ //~| expected type `usize`
+ //~| found type `isize`
+ //~| NOTE: conflicting type parameter defaults `usize` and `isize`
//~| NOTE: conflicting type parameter defaults `usize` and `isize`
//~| NOTE: ...that was applied to an unconstrained type variable here
//~^ NOTE: ...that also applies to the same type variable here
meh(foo);
- //~^ ERROR: mismatched types:
+ //~^ ERROR: mismatched types
//~| NOTE: conflicting type parameter defaults `bool` and `char`
+ //~| NOTE: conflicting type parameter defaults `bool` and `char`
+ //~| a second default is defined on `default_param_test::bleh`
//~| NOTE: ...that was applied to an unconstrained type variable here
+ //~| expected type `bool`
+ //~| found type `char`
}
// n > m
let &&x = &1isize as &T;
//~^ ERROR mismatched types
- //~| expected `T`
- //~| found `&_`
- //~| expected trait T
- //~| found &-ptr
+ //~| expected type `T`
+ //~| found type `&_`
+ //~| expected trait T, found &-ptr
let &&&x = &(&1isize as &T);
//~^ ERROR mismatched types
- //~| expected `T`
- //~| found `&_`
- //~| expected trait T
- //~| found &-ptr
+ //~| expected type `T`
+ //~| found type `&_`
+ //~| expected trait T, found &-ptr
let box box x = box 1isize as Box<T>;
//~^ ERROR mismatched types
- //~| expected `T`
- //~| found `Box<_>`
- //~| expected trait T
- //~| found box
+ //~| expected type `T`
+ //~| found type `Box<_>`
+ //~| expected trait T, found box
}
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types
- //~| expected `ToBar`
- //~| found `Bar1`
- //~| expected trait ToBar
- //~| found struct `Bar1`
+ //~| expected type `ToBar`
+ //~| found type `Bar1`
+ //~| expected trait ToBar, found struct `Bar1`
//~| ERROR `ToBar: std::marker::Sized` is not satisfied
}
let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
let f2: &Fat<[isize; 3]> = f1;
//~^ ERROR mismatched types
- //~| expected `&Fat<[isize; 3]>`
- //~| found `&Fat<[isize]>`
- //~| expected array of 3 elements
- //~| found slice
+ //~| expected type `&Fat<[isize; 3]>`
+ //~| found type `&Fat<[isize]>`
+ //~| expected array of 3 elements, found slice
}
impl<'a,'b> Foo<'a,'b> {
fn bar(self: Foo<'b,'a>) {}
//~^ ERROR mismatched types
- //~| expected `Foo<'a, 'b>`
- //~| found `Foo<'b, 'a>`
+ //~| expected type `Foo<'a, 'b>`
+ //~| found type `Foo<'b, 'a>`
//~| lifetime mismatch
//~| ERROR mismatched types
- //~| expected `Foo<'a, 'b>`
- //~| found `Foo<'b, 'a>`
+ //~| expected type `Foo<'a, 'b>`
+ //~| found type `Foo<'b, 'a>`
//~| lifetime mismatch
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-extern fn main() {} //~ ERROR: main function expects type
+extern fn main() {} //~ ERROR: main function has wrong type
fn main() {
eq(foo::<u8>, bar::<u8>);
//~^ ERROR mismatched types
- //~| expected `fn(isize) -> isize {foo::<u8>}`
- //~| found `fn(isize) -> isize {bar::<u8>}`
- //~| expected fn item
- //~| found a different fn item
+ //~| expected type `fn(isize) -> isize {foo::<u8>}`
+ //~| found type `fn(isize) -> isize {bar::<u8>}`
+ //~| expected fn item, found a different fn item
eq(foo::<u8>, foo::<i8>);
//~^ ERROR mismatched types
- //~| expected `fn(isize) -> isize {foo::<u8>}`
- //~| found `fn(isize) -> isize {foo::<i8>}`
+ //~| expected u8, found i8
eq(bar::<String>, bar::<Vec<u8>>);
//~^ ERROR mismatched types
- //~| expected `fn(isize) -> isize {bar::<std::string::String>}`
- //~| found `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
- //~| expected struct `std::string::String`
- //~| found struct `std::vec::Vec`
+ //~| expected type `fn(isize) -> isize {bar::<std::string::String>}`
+ //~| found type `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
+ //~| expected struct `std::string::String`, found struct `std::vec::Vec`
// Make sure we distinguish between trait methods correctly.
eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
//~^ ERROR mismatched types
- //~| expected `fn() {<u8 as Foo>::foo}`
- //~| found `fn() {<u16 as Foo>::foo}`
+ //~| expected u8, found u16
}
fn main() {
let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `Box<std::ops::FnOnce(isize)>`
- //~| expected ()
- //~| found box
+ //~| expected type `()`
+ //~| found type `Box<std::ops::FnOnce(isize)>`
+ //~| expected (), found box
let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `Box<std::ops::Fn(isize, isize)>`
- //~| expected ()
- //~| found box
+ //~| expected type `()`
+ //~| found type `Box<std::ops::Fn(isize, isize)>`
+ //~| expected (), found box
let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>;
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `Box<std::ops::FnMut() -> isize>`
- //~| expected ()
- //~| found box
+ //~| expected type `()`
+ //~| found type `Box<std::ops::FnMut() -> isize>`
+ //~| expected (), found box
needs_fn(1);
//~^ ERROR : std::ops::Fn<(isize,)>`
let x: Option<usize>;
x = 5;
//~^ ERROR mismatched types
- //~| expected `std::option::Option<usize>`
- //~| found `_`
- //~| expected enum `std::option::Option`
- //~| found integral variable
+ //~| expected type `std::option::Option<usize>`
+ //~| found type `_`
+ //~| expected enum `std::option::Option`, found integral variable
}
fn bar(x: x::foo) -> y::foo {
return x;
//~^ ERROR mismatched types
- //~| expected `y::foo`
- //~| found `x::foo`
- //~| expected enum `y::foo`
- //~| found enum `x::foo`
+ //~| expected type `y::foo`
+ //~| found type `x::foo`
+ //~| expected enum `y::foo`, found enum `x::foo`
}
fn main() {
fn bar(x: usize) -> Option<usize> {
return x;
//~^ ERROR mismatched types
- //~| expected `std::option::Option<usize>`
- //~| found `usize`
- //~| expected enum `std::option::Option`
- //~| found usize
+ //~| expected type `std::option::Option<usize>`
+ //~| found type `usize`
+ //~| expected enum `std::option::Option`, found usize
}
fn main() {
// Ensure that the printed type doesn't include the default type params...
let _: Foo<isize> = ();
//~^ ERROR mismatched types
- //~| expected `Foo<isize>`
- //~| found `()`
- //~| expected struct `Foo`
- //~| found ()
+ //~| expected type `Foo<isize>`
+ //~| found type `()`
+ //~| expected struct `Foo`, found ()
// ...even when they're present, but the same types as the defaults.
let _: Foo<isize, B, C> = ();
//~^ ERROR mismatched types
- //~| expected `Foo<isize>`
- //~| found `()`
- //~| expected struct `Foo`
- //~| found ()
+ //~| expected type `Foo<isize>`
+ //~| found type `()`
+ //~| expected struct `Foo`, found ()
// Including cases where the default is using previous type params.
let _: HashMap<String, isize> = ();
//~^ ERROR mismatched types
- //~| expected `HashMap<std::string::String, isize>`
- //~| found `()`
- //~| expected struct `HashMap`
- //~| found ()
+ //~| expected type `HashMap<std::string::String, isize>`
+ //~| found type `()`
+ //~| expected struct `HashMap`, found ()
let _: HashMap<String, isize, Hash<String>> = ();
//~^ ERROR mismatched types
- //~| expected `HashMap<std::string::String, isize>`
- //~| found `()`
- //~| expected struct `HashMap`
- //~| found ()
+ //~| expected type `HashMap<std::string::String, isize>`
+ //~| found type `()`
+ //~| expected struct `HashMap`, found ()
// But not when there's a different type in between.
let _: Foo<A, isize, C> = ();
//~^ ERROR mismatched types
- //~| expected `Foo<A, isize>`
- //~| found `()`
- //~| expected struct `Foo`
- //~| found ()
+ //~| expected type `Foo<A, isize>`
+ //~| found type `()`
+ //~| expected struct `Foo`, found ()
// And don't print <> at all when there's just defaults.
let _: Foo<A, B, C> = ();
//~^ ERROR mismatched types
- //~| expected `Foo`
- //~| found `()`
- //~| expected struct `Foo`
- //~| found ()
+ //~| expected type `Foo`
+ //~| found type `()`
+ //~| expected struct `Foo`, found ()
}
fn main() {
let x = if true { 10i32 } else { 10u32 };
//~^ ERROR if and else have incompatible types
- //~| expected `i32`
- //~| found `u32`
+ //~| expected i32, found u32
}
fn main() {
if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types
+ //~^ expected (), found integral variable
+ //~| expected type `()`
+ //~| found type `_`
()
} else { //~ NOTE: `if let` arm with an incompatible type
1
fn main() {
let a = if true { true };
//~^ ERROR if may be missing an else clause
- //~| expected `()`
- //~| found `bool`
- //~| expected ()
- //~| found bool
+ //~| expected type `()`
+ //~| found type `bool`
+ //~| expected (), found bool
println!("{}", a);
}
id_i8(a8); // ok
id_i8(a16);
//~^ ERROR mismatched types
- //~| expected `i8`
- //~| found `i16`
+ //~| expected i8, found i16
id_i8(a32);
//~^ ERROR mismatched types
- //~| expected `i8`
- //~| found `i32`
+ //~| expected i8, found i32
id_i8(a64);
//~^ ERROR mismatched types
- //~| expected `i8`
- //~| found `i64`
+ //~| expected i8, found i64
id_i16(a8);
//~^ ERROR mismatched types
- //~| expected `i16`
- //~| found `i8`
+ //~| expected i16, found i8
id_i16(a16); // ok
id_i16(a32);
//~^ ERROR mismatched types
- //~| expected `i16`
- //~| found `i32`
+ //~| expected i16, found i32
id_i16(a64);
//~^ ERROR mismatched types
- //~| expected `i16`
- //~| found `i64`
+ //~| expected i16, found i64
id_i32(a8);
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `i8`
+ //~| expected i32, found i8
id_i32(a16);
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `i16`
+ //~| expected i32, found i16
id_i32(a32); // ok
id_i32(a64);
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `i64`
+ //~| expected i32, found i64
id_i64(a8);
//~^ ERROR mismatched types
- //~| expected `i64`
- //~| found `i8`
+ //~| expected i64, found i8
id_i64(a16);
//~^ ERROR mismatched types
- //~| expected `i64`
- //~| found `i16`
+ //~| expected i64, found i16
id_i64(a32);
//~^ ERROR mismatched types
- //~| expected `i64`
- //~| found `i32`
+ //~| expected i64, found i32
id_i64(a64); // ok
id_i8(c8); // ok
id_i8(c16);
//~^ ERROR mismatched types
- //~| expected `i8`
- //~| found `i16`
+ //~| expected i8, found i16
id_i8(c32);
//~^ ERROR mismatched types
- //~| expected `i8`
- //~| found `i32`
+ //~| expected i8, found i32
id_i8(c64);
//~^ ERROR mismatched types
- //~| expected `i8`
- //~| found `i64`
+ //~| expected i8, found i64
id_i16(c8);
//~^ ERROR mismatched types
- //~| expected `i16`
- //~| found `i8`
+ //~| expected i16, found i8
id_i16(c16); // ok
id_i16(c32);
//~^ ERROR mismatched types
- //~| expected `i16`
- //~| found `i32`
+ //~| expected i16, found i32
id_i16(c64);
//~^ ERROR mismatched types
- //~| expected `i16`
- //~| found `i64`
+ //~| expected i16, found i64
id_i32(c8);
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `i8`
+ //~| expected i32, found i8
id_i32(c16);
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `i16`
+ //~| expected i32, found i16
id_i32(c32); // ok
id_i32(c64);
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `i64`
+ //~| expected i32, found i64
id_i64(a8);
//~^ ERROR mismatched types
- //~| expected `i64`
- //~| found `i8`
+ //~| expected i64, found i8
id_i64(a16);
//~^ ERROR mismatched types
- //~| expected `i64`
- //~| found `i16`
+ //~| expected i64, found i16
id_i64(a32);
//~^ ERROR mismatched types
- //~| expected `i64`
- //~| found `i32`
+ //~| expected i64, found i32
id_i64(a64); // ok
id_u8(b8); // ok
id_u8(b16);
//~^ ERROR mismatched types
- //~| expected `u8`
- //~| found `u16`
+ //~| expected u8, found u16
id_u8(b32);
//~^ ERROR mismatched types
- //~| expected `u8`
- //~| found `u32`
+ //~| expected u8, found u32
id_u8(b64);
//~^ ERROR mismatched types
- //~| expected `u8`
- //~| found `u64`
+ //~| expected u8, found u64
id_u16(b8);
//~^ ERROR mismatched types
- //~| expected `u16`
- //~| found `u8`
+ //~| expected u16, found u8
id_u16(b16); // ok
id_u16(b32);
//~^ ERROR mismatched types
- //~| expected `u16`
- //~| found `u32`
+ //~| expected u16, found u32
id_u16(b64);
//~^ ERROR mismatched types
- //~| expected `u16`
- //~| found `u64`
+ //~| expected u16, found u64
id_u32(b8);
//~^ ERROR mismatched types
- //~| expected `u32`
- //~| found `u8`
+ //~| expected u32, found u8
id_u32(b16);
//~^ ERROR mismatched types
- //~| expected `u32`
- //~| found `u16`
+ //~| expected u32, found u16
id_u32(b32); // ok
id_u32(b64);
//~^ ERROR mismatched types
- //~| expected `u32`
- //~| found `u64`
+ //~| expected u32, found u64
id_u64(b8);
//~^ ERROR mismatched types
- //~| expected `u64`
- //~| found `u8`
+ //~| expected u64, found u8
id_u64(b16);
//~^ ERROR mismatched types
- //~| expected `u64`
- //~| found `u16`
+ //~| expected u64, found u16
id_u64(b32);
//~^ ERROR mismatched types
- //~| expected `u64`
- //~| found `u32`
+ //~| expected u64, found u32
id_u64(b64); // ok
}
let mut x = 2;
x = 5.0;
//~^ ERROR mismatched types
- //~| expected `_`
- //~| found `_`
- //~| expected integral variable
- //~| found floating-point variable
+ //~| expected type `_`
+ //~| found type `_`
+ //~| expected integral variable, found floating-point variable
}
fn f() -> isize {
(return 1, return 2)
//~^ ERROR mismatched types
-//~| expected `isize`
-//~| found `(_, _)`
-//~| expected isize
-//~| found tuple
+//~| expected type `isize`
+//~| found type `(_, _)`
+//~| expected isize, found tuple
}
fn main() {}
fn main() {
match Some(10) {
- //~^ ERROR match arms have incompatible types:
- //~| expected `bool`
- //~| found `()`
- //~| expected bool
- //~| found ()
+ //~^ ERROR match arms have incompatible types
+ //~| expected type `bool`
+ //~| found type `()`
+ //~| expected bool, found ()
Some(5) => false,
Some(2) => true,
None => (), //~ NOTE match arm with an incompatible type
#[bench]
fn bar(x: isize) { }
//~^ ERROR mismatched types
-//~| expected `fn(&mut __test::test::Bencher)`
-//~| found `fn(isize) {bar}`
-//~| expected &-ptr
-//~| found isize
+//~| expected type `fn(&mut __test::test::Bencher)`
+//~| found type `fn(isize) {bar}`
+//~| expected &-ptr, found isize
fn main() {
foo(1*(1 as isize));
//~^ ERROR mismatched types
- //~| expected `i16`
- //~| found `isize`
+ //~| expected i16, found isize
bar(1*(1 as usize));
//~^ ERROR mismatched types
- //~| expected `u32`
- //~| found `usize`
+ //~| expected u32, found usize
}
let _x: usize = match Some(1) {
Ok(u) => u,
//~^ ERROR mismatched types
- //~| expected `std::option::Option<_>`
- //~| found `std::result::Result<_, _>`
- //~| expected enum `std::option::Option`
- //~| found enum `std::result::Result`
+ //~| expected type `std::option::Option<_>`
+ //~| found type `std::result::Result<_, _>`
+ //~| expected enum `std::option::Option`, found enum `std::result::Result`
Err(e) => panic!(e)
//~^ ERROR mismatched types
- //~| expected `std::option::Option<_>`
- //~| found `std::result::Result<_, _>`
- //~| expected enum `std::option::Option`
- //~| found enum `std::result::Result`
+ //~| expected type `std::option::Option<_>`
+ //~| found type `std::result::Result<_, _>`
+ //~| expected enum `std::option::Option`, found enum `std::result::Result`
};
}
let y = match x {
[] => None,
//~^ ERROR mismatched types
-//~| expected `[_#1i; 2]`
-//~| found `[_#7t; 0]`
-//~| expected an array with a fixed size of 2 elements
-//~| found one with 0 elements
+//~| expected type `[_#1i; 2]`
+//~| found type `[_#7t; 0]`
+//~| expected an array with a fixed size of 2 elements, found one with 0 elements
[a,_] => Some(a)
};
}
let y = match x {
[] => None,
//~^ ERROR mismatched types
- //~| expected `[_; 2]`
- //~| found `[_; 0]`
+ //~| expected type `[_; 2]`
+ //~| found type `[_; 0]`
//~| expected an array with a fixed size of 2 elements
[a,_] => Some(a)
};
pub fn get_enum_struct_variant() -> () {
Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `a::Enum`
- //~| expected ()
- //~| found enum `a::Enum`
+ //~| expected type `()`
+ //~| found type `a::Enum`
+ //~| expected (), found enum `a::Enum`
}
}
match enum_struct_variant {
a::Enum::EnumStructVariant { x, y, z } => {
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `a::Enum`
- //~| expected ()
- // found enum `a::Enum`
+ //~| expected type `()`
+ //~| found type `a::Enum`
+ //~| expected (), found enum `a::Enum`
}
}
}
// except according to those terms.
// error-pattern:mismatched types
-// error-pattern:expected `bool`
-// error-pattern:found `_`
-// error-pattern:expected bool
-// error-pattern:found integral variable
+// error-pattern:expected bool, found integral variable
+// error-pattern:expected type `bool`
+// error-pattern:found type `_`
fn main(){assert!(1,1);}
fn make(v: vec2) {
let vec3 { y: _, z: _ } = v;
//~^ ERROR mismatched types
- //~| expected `vec2`
- //~| found `vec3`
- //~| expected struct `vec2`
- //~| found struct `vec3`
+ //~| expected type `vec2`
+ //~| found type `vec3`
+ //~| expected struct `vec2`, found struct `vec3`
}
fn main() { }
let x = Some(&[name]);
let msg = foo(x);
//~^ ERROR mismatched types
-//~| expected `std::option::Option<&[&str]>`
-//~| found `std::option::Option<&[&str; 1]>`
-//~| expected slice
-//~| found array of 1 elements
+//~| expected type `std::option::Option<&[&str]>`
+//~| found type `std::option::Option<&[&str; 1]>`
+//~| expected slice, found array of 1 elements
assert_eq!(msg, 3);
}
E::B(
Tau{t: x},
//~^ ERROR mismatched types
- //~| expected `main::R`
- //~| found `main::Tau`
- //~| expected enum `main::R`
- //~| found struct `main::Tau`
+ //~| expected type `main::R`
+ //~| found type `main::Tau`
+ //~| expected enum `main::R`, found struct `main::Tau`
_) => x,
};
}
fn main() {
let Slice { data: data, len: len } = "foo";
//~^ ERROR mismatched types
- //~| expected `&str`
- //~| found `std::raw::Slice<_>`
- //~| expected &-ptr
- //~| found struct `std::raw::Slice`
+ //~| expected type `&str`
+ //~| found type `std::raw::Slice<_>`
+ //~| expected &-ptr, found struct `std::raw::Slice`
}
match () {
Slice { data: data, len: len } => (),
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `std::raw::Slice<_>`
- //~| expected ()
- //~| found struct `std::raw::Slice`
+ //~| expected type `()`
+ //~| found type `std::raw::Slice<_>`
+ //~| expected (), found struct `std::raw::Slice`
_ => unreachable!()
}
}
fn f<'r>(p: &'r mut fn(p: &mut ())) {
(*p)(()) //~ ERROR mismatched types
- //~| expected `&mut ()`
- //~| found `()`
- //~| expected &-ptr
- //~| found ()
+ //~| expected type `&mut ()`
+ //~| found type `()`
+ //~| expected &-ptr, found ()
}
fn main() {}
fn main() {
let mut x: Box<_> = box Foo { a: 1, b: 2 };
let (a, b) = (&mut x.a, &mut x.b);
- //~^ ERROR cannot borrow `x` (here through borrowing `x.b`) as mutable more than once at a time
- //~^^ NOTE previous borrow of `x` occurs here (through borrowing `x.a`)
+ //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
+ //~| NOTE first mutable borrow occurs here (via `x.a`)
+ //~| NOTE second mutable borrow occurs here (via `x.b`)
let mut foo: Box<_> = box Foo { a: 1, b: 2 };
let (c, d) = (&mut foo.a, &foo.b);
- //~^ ERROR cannot borrow `foo` (here through borrowing `foo.b`) as immutable
- //~^^ NOTE previous borrow of `foo` occurs here (through borrowing `foo.a`)
+ //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+ //~| NOTE mutable borrow occurs here (via `foo.a`)
+ //~| NOTE immutable borrow occurs here (via `foo.b`)
}
-//~^ NOTE previous borrow ends here
-//~^^ NOTE previous borrow ends here
+//~^ NOTE first borrow ends here
+//~^^ NOTE mutable borrow ends here
// `x { ... }` should not be interpreted as a struct literal here
if x = x {
//~^ ERROR mismatched types
- //~| expected `bool`
- //~| found `()`
- //~| expected bool
- //~| found ()
+ //~| expected type `bool`
+ //~| found type `()`
+ //~| expected bool, found ()
println!("{}", x);
}
// Explicit parentheses on the left should match behavior of above
if (x = x) {
//~^ ERROR mismatched types
- //~| expected `bool`
- //~| found `()`
- //~| expected bool
- //~| found ()
+ //~| expected type `bool`
+ //~| found type `()`
+ //~| expected bool, found ()
println!("{}", x);
}
// The struct literal interpretation is fine with explicit parentheses on the right
if y = (Foo { foo: x }) {
//~^ ERROR mismatched types
- //~| expected `bool`
- //~| found `()`
- //~| expected bool
- //~| found ()
+ //~| expected type `bool`
+ //~| found type `()`
+ //~| expected bool, found ()
println!("{}", x);
}
}
fn str_to_direction(to_parse: &str) -> RoomDirection {
match to_parse { //~ ERROR match arms have incompatible types
+ //~^ expected enum `RoomDirection`, found enum `std::option::Option`
+ //~| expected type `RoomDirection`
+ //~| found type `std::option::Option<_>`
"w" | "west" => RoomDirection::West,
"e" | "east" => RoomDirection::East,
"n" | "north" => RoomDirection::North,
impl <'a> Foo<'a>{
fn bar(self: &mut Foo) {
//~^ mismatched types
- //~| expected `&mut Foo<'a>`
- //~| found `&mut Foo<'_>`
+ //~| expected type `&mut Foo<'a>`
+ //~| found type `&mut Foo<'_>`
//~| lifetime mismatch
//~| mismatched types
- //~| expected `&mut Foo<'a>`
- //~| found `&mut Foo<'_>`
+ //~| expected type `&mut Foo<'a>`
+ //~| found type `&mut Foo<'_>`
//~| lifetime mismatch
}
}
fn function(t: &mut Trait) {
t as *mut Trait
- //~^ ERROR: mismatched types:
- //~| expected `()`,
- //~| found `*mut Trait`
- //~| (expected (),
- //~| found *-ptr) [E0308]
+ //~^ ERROR: mismatched types
+ //~| NOTE: expected type `()`
+ //~| NOTE: found type `*mut Trait`
+ //~| NOTE: expected (), found *-ptr
}
fn main() { }
fn main() {
if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
- //~| expected `()`
- //~| found `_`
- //~| expected ()
- //~| found integral variable
+ //~| expected type `()`
+ //~| found type `_`
+ //~| expected (), found integral variable
765
};
}
//~^ ERROR mismatched types
//~| NOTE no two closures, even if identical, have the same type
//~| HELP consider boxing your closure and/or using it as a trait object
+ //~| expected closure, found a different closure
+ //~| expected type `[closure
+ //~| found type `[closure
}
fn closure_from_match() {
//~^^^^^^ ERROR match arms have incompatible types
//~| NOTE no two closures, even if identical, have the same type
//~| HELP consider boxing your closure and/or using it as a trait object
+ //~| expected closure, found a different closure
+ //~| expected type `[closure
+ //~| found type `[closure
}
fn main() { }
fn main() {
let x = NoCopy;
let f = move || { let y = x; };
- //~^ NOTE `x` moved into closure environment here because it has type `NoCopy`
+ //~^ value moved (into closure) here
let z = x;
//~^ ERROR use of moved value: `x`
+ //~| value used here after move
+ //~| move occurs because `x` has type `NoCopy`
}
fn main() {
static foo: Fn() -> u32 = || -> u32 {
- //~^ ERROR: mismatched types:
+ //~^ ERROR: mismatched types
0
};
}
write(stdout, $arr.as_ptr() as *const i8,
$arr.len() * size_of($arr[0]));
//~^ ERROR mismatched types
+ //~| expected u64, found usize
}
}}
}
fn main() {
let b = [0; S];
//~^ ERROR mismatched types
- //~| expected `usize`
- //~| found `S`
- //~| expected usize
- //~| found struct `S`
+ //~| expected type `usize`
+ //~| found type `S`
+ //~| expected usize, found struct `S`
//~| ERROR expected positive integer for repeat count, found struct
}
fn bar(d: u8) { }
bar(&mut $d);
//~^ ERROR mismatched types
+ //~| expected u8, found &-ptr
+ //~| expected type `u8`
+ //~| found type `&mut u8`
}}
}
fn main() {
foo!(0u8);
- //~^ NOTE in this expansion of foo!
+ //~^ in this expansion of foo!
}
let mut xx = x;
xx = y;
//~^ ERROR mismatched types
- //~| expected `T`
- //~| found `U`
- //~| expected type parameter
- //~| found a different type parameter
+ //~| expected type `T`
+ //~| found type `U`
+ //~| expected type parameter, found a different type parameter
}
fn main() {
fn main() {
let _p: char = 100;
//~^ ERROR mismatched types
- //~| expected `char`
- //~| found `u8`
+ //~| expected char, found u8
}
match None {
Err(_) => ()
//~^ ERROR mismatched types
- //~| expected `std::option::Option<_>`
- //~| found `std::result::Result<_, _>`
- //~| expected enum `std::option::Option`
- //~| found enum `std::result::Result`
+ //~| expected type `std::option::Option<_>`
+ //~| found type `std::result::Result<_, _>`
+ //~| expected enum `std::option::Option`, found enum `std::result::Result`
}
}
0
} else if false {
//~^ ERROR if may be missing an else clause
-//~| expected `()`
-//~| found `_`
-//~| expected ()
-//~| found integral variable
+//~| expected type `()`
+//~| found type `_`
+//~| expected (), found integral variable
1
};
}
let foo: [u8; 4] = [1; 4];
bar(foo);
//~^ ERROR mismatched types
- //~| expected `usize`
- //~| found `[u8; 4]`
- //~| expected usize
- //~| found array of 4 elements
+ //~| expected type `usize`
+ //~| found type `[u8; 4]`
+ //~| expected usize, found array of 4 elements
}
fn main() {
match 42 { A => () }
//~^ ERROR mismatched types
- //~| expected `_`
- //~| found `(isize, isize)`
- //~| expected integral variable
- //~| found tuple
+ //~| expected type `_`
+ //~| found type `(isize, isize)`
+ //~| expected integral variable, found tuple
}
fn main() {
match (true, false) {
A::B => (),
-//~^ ERROR mismatched types:
-//~| expected `(bool, bool)`
-//~| found `A`
-//~| expected tuple
-//~| found enum `A`
+//~^ ERROR mismatched types
+//~| expected type `(bool, bool)`
+//~| found type `A`
+//~| expected tuple, found enum `A`
_ => ()
}
match (true, false) {
(true, false, false) => ()
//~^ ERROR mismatched types
-//~| expected `(bool, bool)`
-//~| found `(_, _, _)`
-//~| expected a tuple with 2 elements
-//~| found one with 3 elements
+//~| expected type `(bool, bool)`
+//~| found type `(_, _, _)`
+//~| expected a tuple with 2 elements, found one with 3 elements
}
match (true, false) {
(true, false, false) => ()
//~^ ERROR mismatched types
-//~| expected `(bool, bool)`
-//~| found `(_, _, _)`
-//~| expected a tuple with 2 elements
-//~| found one with 3 elements
+//~| expected type `(bool, bool)`
+//~| found type `(_, _, _)`
+//~| expected a tuple with 2 elements, found one with 3 elements
}
match (true, false) {
box (true, false) => ()
//~^ ERROR mismatched types
-//~| expected `(bool, bool)`
-//~| found `Box<_>`
-//~| expected tuple
-//~| found box
+//~| expected type `(bool, bool)`
+//~| found type `Box<_>`
+//~| expected tuple, found box
}
match (true, false) {
&(true, false) => ()
//~^ ERROR mismatched types
-//~| expected `(bool, bool)`
-//~| found `&_`
-//~| expected tuple
-//~| found &-ptr
+//~| expected type `(bool, bool)`
+//~| found type `&_`
+//~| expected tuple, found &-ptr
}
// Make sure none of the errors above were fatal
let x: char = true; //~ ERROR mismatched types
- //~| expected `char`
- //~| found `bool`
+ //~| expected char, found bool
}
match S(Either::Left(5)) {
Either::Right(_) => {}
//~^ ERROR mismatched types
- //~| expected `S`
- //~| found `Either<_, _>`
- //~| expected struct `S`
- //~| found enum `Either`
+ //~| expected type `S`
+ //~| found type `Either<_, _>`
+ //~| expected struct `S`, found enum `Either`
_ => {}
}
}
fn main() {
&panic!()
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `&_`
- //~| expected ()
- //~| found &-ptr
+ //~| expected type `()`
+ //~| found type `&_`
+ //~| expected (), found &-ptr
}
impl<'a> BarStruct {
fn foo(&'a mut self) -> Box<BarStruct> { self }
//~^ ERROR mismatched types
- //~| expected `Box<BarStruct>`
- //~| found `&'a mut BarStruct`
- //~| expected box
- //~| found &-ptr
+ //~| expected type `Box<BarStruct>`
+ //~| found type `&'a mut BarStruct`
+ //~| expected box, found &-ptr
}
fn main() {}
match x {
Some(field) =>
//~^ ERROR mismatched types
-//~| expected `Whatever`
-//~| found `std::option::Option<_>`
-//~| expected enum `Whatever`
-//~| found enum `std::option::Option`
- field.access(),
+//~| expected type `Whatever`
+//~| found type `std::option::Option<_>`
+//~| expected enum `Whatever`, found enum `std::option::Option`
+ field.access(),
}
}
match (true, false) {
A::B => (),
//~^ ERROR mismatched types
- //~| expected `(bool, bool)`
- //~| found `A`
- //~| expected tuple
- //~| found enum `A`
+ //~| expected type `(bool, bool)`
+ //~| found type `A`
+ //~| expected tuple, found enum `A`
_ => ()
}
match &Some(42) {
Some(x) => (),
//~^ ERROR mismatched types
- //~| expected `&std::option::Option<_>`
- //~| found `std::option::Option<_>`
- //~| expected &-ptr
- //~| found enum `std::option::Option`
+ //~| expected type `&std::option::Option<_>`
+ //~| found type `std::option::Option<_>`
+ //~| expected &-ptr, found enum `std::option::Option`
None => ()
//~^ ERROR mismatched types
- //~| expected `&std::option::Option<_>`
- //~| found `std::option::Option<_>`
- //~| expected &-ptr
- //~| found enum `std::option::Option`
+ //~| expected type `&std::option::Option<_>`
+ //~| found type `std::option::Option<_>`
+ //~| expected &-ptr, found enum `std::option::Option`
}
}
#[start]
fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize {
- //~^ ERROR incorrect number of function parameters
+ //~^ start function has wrong type
0
}
// except according to those terms.
fn main() -> char {
-//~^ ERROR: main function expects type
+//~^ ERROR: main function has wrong type
}
}
fn main(foo: S) {
-//~^ ERROR: main function expects type
+//~^ ERROR: main function has wrong type
}
_ => { }
};
//~^^^ ERROR mismatched types in range
- //~| expected char
- //~| found integral variable
+ //~| expected char, found integral variable
}
match (S { a: 1 }) {
E::C(_) => (),
//~^ ERROR mismatched types
- //~| expected `S`
- //~| found `E`
- //~| expected struct `S`
- //~| found enum `E`
+ //~| expected type `S`
+ //~| found type `E`
+ //~| expected struct `S`, found enum `E`
_ => ()
}
}
match () {
[()] => { }
//~^ ERROR mismatched types
- //~| expected `()`
- //~| found `&[_]`
- //~| expected ()
- //~| found &-ptr
+ //~| expected type `()`
+ //~| found type `&[_]`
+ //~| expected (), found &-ptr
}
}
fn main() {
let x = Foo;
Foo::bar(x); //~ ERROR mismatched types
- //~| expected `&Foo`
- //~| found `Foo`
- //~| expected &-ptr
- //~| found struct `Foo`
+ //~| expected type `&Foo`
+ //~| found type `Foo`
+ //~| expected &-ptr, found struct `Foo`
Foo::bar(&42); //~ ERROR mismatched types
- //~| expected `&Foo`
- //~| found `&_`
- //~| expected struct `Foo`
- //~| found integral variable
+ //~| expected type `&Foo`
+ //~| found type `&_`
+ //~| expected struct `Foo`, found integral variable
}
fn f00() {
let x = "hi".to_string();
- let _y = Foo { f:x }; //~ NOTE `x` moved here
+ let _y = Foo { f:x };
+ //~^ value moved here
touch(&x); //~ ERROR use of moved value: `x`
+ //~^ value used here after move
+ //~| move occurs because `x` has type `std::string::String`
}
fn f05() {
let x = "hi".to_string();
- let _y = Foo { f:(((x))) }; //~ NOTE `x` moved here
+ let _y = Foo { f:(((x))) };
+ //~^ value moved here
touch(&x); //~ ERROR use of moved value: `x`
}
};
touch(&x); //~ ERROR use of partially moved value: `x`
+ //~^ value used here after move
+ //~| move occurs because `x.f` has type `std::string::String`
}
fn main() {}
// (separate lines to ensure the spans are accurate)
let &_ //~ ERROR mismatched types
- //~| expected `&mut _`
- //~| found `&_`
+ //~| expected type `&mut _`
+ //~| found type `&_`
//~| values differ in mutability
= foo;
let &mut _ = foo;
let bar = &1;
let &_ = bar;
let &mut _ //~ ERROR mismatched types
- //~| expected `&_`
- //~| found `&mut _`
+ //~| expected type `&_`
+ //~| found type `&mut _`
//~| values differ in mutability
= bar;
}
// not convertible to a path.
let x: isize = noexporttypelib::foo();
//~^ ERROR mismatched types
- //~| expected `isize`
- //~| found `std::option::Option<isize>`
- //~| expected isize
- //~| found enum `std::option::Option`
+ //~| expected type `isize`
+ //~| found type `std::option::Option<isize>`
+ //~| expected isize, found enum `std::option::Option`
}
g = f;
f = box g;
//~^ ERROR mismatched types
- //~| expected `_`
- //~| found `Box<_>`
+ //~| expected type `_`
+ //~| found type `Box<_>`
//~| cyclic type of infinite size
}
let f;
f = box f;
//~^ ERROR mismatched types
- //~| expected `_`
- //~| found `Box<_>`
+ //~| expected type `_`
+ //~| found type `Box<_>`
//~| cyclic type of infinite size
}
match 'c' {
S { .. } => (),
//~^ ERROR mismatched types
- //~| expected `char`
- //~| found `S`
- //~| expected char
- //~| found struct `S`
+ //~| expected type `char`
+ //~| found type `S`
+ //~| expected char, found struct `S`
_ => ()
}
f(true);
//~^ ERROR mismatched types
- //~| expected `char`
- //~| found `bool`
+ //~| expected char, found bool
match () {
E::V => {} //~ ERROR failed to resolve. Use of undeclared type or module `E`
fn main() {
let_in(3u32, |i| { assert!(i == 3i32); });
//~^ ERROR mismatched types
- //~| expected `u32`
- //~| found `i32`
+ //~| expected u32, found i32
let_in(3i32, |i| { assert!(i == 3u32); });
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `u32`
+ //~| expected i32, found u32
}
// *const -> *mut
let x: *const isize = &42;
let x: *mut isize = x; //~ ERROR mismatched types
- //~| expected `*mut isize`
- //~| found `*const isize`
+ //~| expected type `*mut isize`
+ //~| found type `*const isize`
//~| values differ in mutability
// & -> *mut
let x: *mut isize = &42; //~ ERROR mismatched types
- //~| expected `*mut isize`
- //~| found `&isize`
+ //~| expected type `*mut isize`
+ //~| found type `&isize`
//~| values differ in mutability
let x: *const isize = &42;
let x: *mut isize = x; //~ ERROR mismatched types
- //~| expected `*mut isize`
- //~| found `*const isize`
+ //~| expected type `*mut isize`
+ //~| found type `*const isize`
//~| values differ in mutability
}
fn main() {
let x = vec![1];
let y = x;
- //~^ HELP use a `ref` binding as shown
- //~| SUGGESTION let ref y = x;
x; //~ ERROR use of moved value
let x = vec![1];
let mut y = x;
- //~^ HELP use a `ref` binding as shown
- //~| SUGGESTION let ref mut y = x;
x; //~ ERROR use of moved value
let x = (Some(vec![1]), ());
match x {
(Some(y), ()) => {},
- //~^ HELP use a `ref` binding as shown
- //~| SUGGESTION (Some(ref y), ()) => {},
_ => {},
}
x; //~ ERROR use of partially moved value
fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> {
return e; //~ ERROR mismatched types
- //~| expected `an_enum<'b>`
- //~| found `an_enum<'a>`
+ //~| expected type `an_enum<'b>`
+ //~| found type `an_enum<'a>`
//~| lifetime mismatch
}
fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
return e; //~ ERROR mismatched types
- //~| expected `a_class<'b>`
- //~| found `a_class<'a>`
+ //~| expected type `a_class<'b>`
+ //~| found type `a_class<'a>`
//~| lifetime mismatch
}
fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
g2.get()
//~^ ERROR mismatched types
- //~| expected `&'a isize`
- //~| found `&'b isize`
+ //~| expected type `&'a isize`
+ //~| found type `&'b isize`
//~| lifetime mismatch
}
want_G(bar);
want_G(baz);
//~^ ERROR mismatched types
- //~| expected `fn(&'cx S) -> &'static S`
- //~| found `fn(&S) -> &S {baz}`
- //~| expected concrete lifetime
- //~| found bound lifetime parameter 'cx
+ //~| expected type `fn(&'cx S) -> &'static S`
+ //~| found type `fn(&S) -> &S {baz}`
+ //~| expected concrete lifetime, found bound lifetime parameter 'cx
}
pub fn main() {
fn take_indirect1(p: indirect1) -> indirect1 { p }
fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
-//~| expected `indirect2<'b>`
-//~| found `indirect2<'a>`
+//~| expected type `indirect2<'b>`
+//~| found type `indirect2<'a>`
//~| ERROR mismatched types
-//~| expected `indirect2<'b>`
-//~| found `indirect2<'a>`
+//~| expected type `indirect2<'b>`
+//~| found type `indirect2<'a>`
fn main() {}
fn set_f_bad(&mut self, b: Box<b>) {
self.f = b;
//~^ ERROR mismatched types
- //~| expected `Box<Box<&'a isize>>`
- //~| found `Box<Box<&isize>>`
+ //~| expected type `Box<Box<&'a isize>>`
+ //~| found type `Box<Box<&isize>>`
//~| lifetime mismatch
}
}
impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT
//~^ ERROR mismatched types
-//~| expected `N<'n>`
-//~| found `N<'static>`
+//~| expected type `N<'n>`
+//~| found type `N<'static>`
impl<Cok_nobound> Drop for O<Cok_nobound> { fn drop(&mut self) { } } // ACCEPT
//~^ ERROR expected constant integer for repeat count, found variable [E0307]
let b = [0; ()];
//~^ ERROR mismatched types
- //~| expected `usize`
- //~| found `()`
- //~| expected usize
- //~| found ()) [E0308]
+ //~| expected type `usize`
+ //~| found type `()`
+ //~| expected usize, found ()
//~| ERROR expected positive integer for repeat count, found tuple [E0306]
let c = [0; true];
//~^ ERROR mismatched types
- //~| expected `usize`
- //~| found `bool`
+ //~| expected usize, found bool
//~| ERROR expected positive integer for repeat count, found boolean [E0306]
let d = [0; 0.5];
//~^ ERROR mismatched types
- //~| expected `usize`
- //~| found `_`
- //~| expected usize
- //~| found floating-point variable) [E0308]
+ //~| expected type `usize`
+ //~| found type `_`
+ //~| expected usize, found floating-point variable
//~| ERROR expected positive integer for repeat count, found float [E0306]
let e = [0; "foo"];
//~^ ERROR mismatched types
- //~| expected `usize`
- //~| found `&'static str`
- //~| expected usize
- //~| found &-ptr) [E0308]
+ //~| expected type `usize`
+ //~| found type `&'static str`
+ //~| expected usize, found &-ptr
//~| ERROR expected positive integer for repeat count, found string literal [E0306]
let f = [0; -4_isize];
//~^ ERROR mismatched types
//~| expected `usize`
- //~| found `isize` [E0308]
+ //~| found `isize`
//~| ERROR mismatched types:
- //~| expected `usize`,
- //~| found `isize` [E0307]
+ //~| expected usize, found isize
let f = [0_usize; -1_isize];
//~^ ERROR mismatched types
//~| expected `usize`
- //~| found `isize` [E0308]
+ //~| found `isize`
//~| ERROR mismatched types
- //~| expected `usize`
- //~| found `isize` [E0307]
+ //~| expected usize, found isize
struct G {
g: (),
}
let g = [0; G { g: () }];
//~^ ERROR mismatched types
- //~| expected `usize`
- //~| found `main::G`
- //~| expected usize
- //~| found struct `main::G`) [E0308]
+ //~| expected type `usize`
+ //~| found type `main::G`
+ //~| expected usize, found struct `main::G`
//~| ERROR expected positive integer for repeat count, found struct [E0306]
}
// Type of the result follows the LHS, not the RHS:
let _: i32 = 22_i64 >> 1_i32;
//~^ ERROR mismatched types
- //~| expected `i32`
- //~| found `i64`
+ //~| expected i32, found i64
}
fn main() {
let y: &mut[_] = &x[2..4];
//~^ ERROR mismatched types
- //~| expected `&mut [_]`
- //~| found `&[isize]`
+ //~| expected type `&mut [_]`
+ //~| found type `&[isize]`
//~| values differ in mutability
}
match Foo(1.1, marker::PhantomData) {
1 => {}
//~^ ERROR mismatched types
- //~| expected `Foo<_, _>`
- //~| found `_`
- //~| expected struct `Foo`
- //~| found integral variable
+ //~| expected type `Foo<_, _>`
+ //~| found type `_`
+ //~| expected struct `Foo`, found integral variable
}
}
fn main() {
let b = Bar { x: 5 };
let f = Foo { a: 2, ..b }; //~ ERROR mismatched types
- //~| expected `Foo`
- //~| found `Bar`
- //~| expected struct `Foo`
- //~| found struct `Bar`
+ //~| expected type `Foo`
+ //~| found type `Bar`
+ //~| expected struct `Foo`, found struct `Bar`
let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types
- //~| expected `Foo`
- //~| found `_`
- //~| expected struct `Foo`
- //~| found integral variable
+ //~| expected type `Foo`
+ //~| found type `_`
+ //~| expected struct `Foo`, found integral variable
}
static bar: Bar = Bar { x: 5 };
static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types
- //~| expected `Foo`
- //~| found `Bar`
- //~| expected struct `Foo`
- //~| found struct `Bar`
+ //~| expected type `Foo`
+ //~| found type `Bar`
+ //~| expected struct `Foo`, found struct `Bar`
static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types
- //~| expected `Foo`
- //~| found `_`
- //~| expected struct `Foo`
- //~| found integral variable
+ //~| expected type `Foo`
+ //~| found type `_`
+ //~| expected struct `Foo`, found integral variable
fn main() {
let b = Bar { x: 5 };
let pt = PointF {
x: 1,
//~^ ERROR mismatched types
- //~| expected f32
- //~| found integral variable
+ //~| expected f32, found integral variable
y: 2,
//~^ ERROR mismatched types
- //~| expected f32
- //~| found integral variable
+ //~| expected f32, found integral variable
};
let pt2 = Point::<f32> {
x: 3,
//~^ ERROR mismatched types
- //~| expected f32
- //~| found integral variable
+ //~| expected f32, found integral variable
y: 4,
//~^ ERROR mismatched types
- //~| expected f32
- //~| found integral variable
+ //~| expected f32, found integral variable
};
let pair = PairF {
x: 5,
//~^ ERROR mismatched types
- //~| expected f32
- //~| found integral variable
+ //~| expected f32, found integral variable
y: 6,
};
let pair2 = PairF::<i32> {
x: 7,
//~^ ERROR mismatched types
- //~| expected f32
- //~| found integral variable
+ //~| expected f32, found integral variable
y: 8,
};
fn foo<'z>() where &'z (): Sized {
let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
//[verbose]~^ ERROR mismatched types
- //[verbose]~| expected `()`
- //[verbose]~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
+ //[verbose]~| expected type `()`
+ //[verbose]~| found type `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
//[normal]~^^^^ ERROR mismatched types
- //[normal]~| expected `()`
- //[normal]~| found `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
+ //[normal]~| expected type `()`
+ //[normal]~| found type `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
//[verbose]~^ ERROR mismatched types
- //[verbose]~| expected `()`
- //[verbose]~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}`
+ //[verbose]~| expected type `()`
+ //[verbose]~| found type `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}`
//[normal]~^^^^ ERROR mismatched types
- //[normal]~| expected `()`
- //[normal]~| found `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
+ //[normal]~| expected type `()`
+ //[normal]~| found type `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
//[verbose]~^ ERROR mismatched types
- //[verbose]~| expected `()`
- //[verbose]~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
+ //[verbose]~| expected type `()`
+ //[verbose]~| found type `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
//[normal]~^^^^ ERROR mismatched types
- //[normal]~| expected `()`
- //[normal]~| found `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
+ //[normal]~| expected type `()`
+ //[normal]~| found type `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
let x: () = foo::<'static>;
//[verbose]~^ ERROR mismatched types
- //[verbose]~| expected `()`
- //[verbose]~| found `fn() {foo::<ReStatic>}`
+ //[verbose]~| expected type `()`
+ //[verbose]~| found type `fn() {foo::<ReStatic>}`
//[normal]~^^^^ ERROR mismatched types
- //[normal]~| expected `()`
- //[normal]~| found `fn() {foo::<'static>}`
+ //[normal]~| expected type `()`
+ //[normal]~| found type `fn() {foo::<'static>}`
<str as Foo<u8>>::bar;
//[verbose]~^ ERROR `str: std::marker::Sized` is not satisfied
fn main() {
let (x, y) = ();
//~^ ERROR mismatched types
-//~| expected `()`
-//~| found `(_, _)`
-//~| expected ()
-//~| found tuple
+//~| expected type `()`
+//~| found type `(_, _)`
+//~| expected (), found tuple
return x;
}
let y;
let x : char = last(y);
//~^ ERROR mismatched types
- //~| expected `char`
- //~| found `std::option::Option<_>`
- //~| expected char
- //~| found enum `std::option::Option`
+ //~| expected type `char`
+ //~| found type `std::option::Option<_>`
+ //~| expected char, found enum `std::option::Option`
}
fn want_foo(f: foo) {}
fn have_bar(b: bar) {
want_foo(b); //~ ERROR mismatched types
- //~| expected `foo`
- //~| found `bar`
- //~| expected struct `foo`
- //~| found struct `bar`
+ //~| expected type `foo`
+ //~| found type `bar`
+ //~| expected struct `foo`, found struct `bar`
}
fn main() {}
fn want_foo(f: foo) {}
fn have_bar(b: bar) {
want_foo(b); //~ ERROR mismatched types
- //~| expected `foo`
- //~| found `Box<foo>`
- //~| expected struct `foo`
- //~| found box
+ //~| expected type `foo`
+ //~| found type `Box<foo>`
+ //~| expected struct `foo`, found box
}
fn main() {}
callback(path.as_ref(); //~ NOTE: unclosed delimiter
//~^ ERROR: expected one of
fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
+ //~^ expected (), found enum `std::result::Result`
+ //~| expected type `()`
+ //~| found type `std::result::Result<bool, std::io::Error>`
} else { //~ ERROR: incorrect close delimiter: `}`
//~^ ERROR: expected one of
Ok(false);
fn d(x: Box<Foo>) {
a(x); //~ ERROR mismatched types
- //~| expected `Box<Foo + Send + 'static>`
- //~| found `Box<Foo + 'static>`
- //~| expected bounds `Send`
- //~| found no bounds
+ //~| expected type `Box<Foo + Send + 'static>`
+ //~| found type `Box<Foo + 'static>`
+ //~| expected bounds `Send`, found no bounds
}
fn main() { }
fn main() {
let y = first ((1,2.0,3));
//~^ ERROR mismatched types
- //~| expected `(isize, f64)`
- //~| found `(isize, f64, _)`
- //~| expected a tuple with 2 elements
- //~| found one with 3 elements
+ //~| expected type `(isize, f64)`
+ //~| found type `(isize, f64, _)`
+ //~| expected a tuple with 2 elements, found one with 3 elements
let y = first ((1,));
//~^ ERROR mismatched types
- //~| expected `(isize, f64)`
- //~| found `(isize,)`
- //~| expected a tuple with 2 elements
- //~| found one with 1 elements
+ //~| expected type `(isize, f64)`
+ //~| found type `(isize,)`
+ //~| expected a tuple with 2 elements, found one with 1 elements
}
identity_u8(x); // after this, `x` is assumed to have type `u8`
identity_u16(x);
//~^ ERROR mismatched types
- //~| expected `u16`
- //~| found `u8`
+ //~| expected u16, found u8
identity_u16(y);
//~^ ERROR mismatched types
- //~| expected `u16`
- //~| found `i32`
+ //~| expected u16, found i32
let a = 3;
identity_i(a); // ok
identity_u16(a);
//~^ ERROR mismatched types
- //~| expected `u16`
- //~| found `isize`
+ //~| expected u16, found isize
}
fn main() { let a: bool = 1; let b: i32 = true; }
//~^ ERROR mismatched types
-//~| expected `bool`
-//~| found `_`
-//~| expected bool
-//~| found integral variable
+//~| expected type `bool`
+//~| found type `_`
+//~| expected bool, found integral variable
//~| ERROR mismatched types
-//~| expected `i32`
-//~| found `bool`
+//~| expected i32, found bool
let bar2 = {extern crate crate_a2 as a; a::bar()};
{
extern crate crate_a1 as a;
- a::try_foo(foo2); //~ ERROR mismatched types
- //~^ NOTE Perhaps two different versions of crate `crate_a1`
- a::try_bar(bar2); //~ ERROR mismatched types
- //~^ NOTE Perhaps two different versions of crate `crate_a1`
+ a::try_foo(foo2);
+ //~^ ERROR mismatched types
+ //~| Perhaps two different versions of crate `crate_a1`
+ //~| expected struct `main::a::Foo`
+ //~| expected type `main::a::Foo`
+ //~| found type `main::a::Foo`
+ a::try_bar(bar2);
+ //~^ ERROR mismatched types
+ //~| Perhaps two different versions of crate `crate_a1`
+ //~| expected trait `main::a::Bar`
+ //~| expected type `Box<main::a::Bar + 'static>`
+ //~| found type `Box<main::a::Bar>`
}
}
fn foo<Foo, Bar>(x: Foo) -> Bar {
x
//~^ ERROR mismatched types
-//~| expected `Bar`
-//~| found `Foo`
-//~| expected type parameter
-//~| found a different type parameter
+//~| expected type `Bar`
+//~| found type `Foo`
+//~| expected type parameter, found a different type parameter
}
fn main() {}
trait BrokenAdd: Copy + Add<Output=Self> {
fn broken_add<T>(&self, rhs: T) -> Self {
*self + rhs //~ ERROR mismatched types
- //~| expected `Self`
- //~| found `T`
- //~| expected Self
- //~| found type parameter
+ //~| expected type `Self`
+ //~| found type `T`
+ //~| expected Self, found type parameter
}
}
fn test1() {
let x: Foo<_> = Bar::<usize>(PhantomData);
//~^ ERROR mismatched types
- //~| expected `Foo<_>`
- //~| found `Bar<usize>`
- //~| expected struct `Foo`
- //~| found struct `Bar`
+ //~| expected type `Foo<_>`
+ //~| found type `Bar<usize>`
+ //~| expected struct `Foo`, found struct `Bar`
let y: Foo<usize> = x;
}
fn test2() {
let x: Foo<_> = Bar::<usize>(PhantomData);
//~^ ERROR mismatched types
- //~| expected `Foo<_>`
- //~| found `Bar<usize>`
- //~| expected struct `Foo`
- //~| found struct `Bar`
+ //~| expected type `Foo<_>`
+ //~| found type `Bar<usize>`
+ //~| expected struct `Foo`, found struct `Bar`
}
//~^ ERROR mismatched types
fn dummy3(self: &&Bar<T>) {}
//~^ ERROR mismatched types
- //~| expected `&&'a Bar<T>`
- //~| found `&&Bar<T>`
+ //~| expected type `&&'a Bar<T>`
+ //~| found type `&&Bar<T>`
//~| lifetime mismatch
//~| ERROR mismatched types
- //~| expected `&&'a Bar<T>`
- //~| found `&&Bar<T>`
+ //~| expected type `&&'a Bar<T>`
+ //~| found type `&&Bar<T>`
//~| lifetime mismatch
}
let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
//~^ ERROR: mismatched types
- //~| expected `unsafe extern "C" fn(isize, u8)`
- //~| found `unsafe extern "C" fn(isize, u8, ...) {foo}`
- //~| expected non-variadic fn
- //~| found variadic function
+ //~| expected type `unsafe extern "C" fn(isize, u8)`
+ //~| found type `unsafe extern "C" fn(isize, u8, ...) {foo}`
+ //~| NOTE: expected non-variadic fn, found variadic function
let y: extern "C" fn(f: isize, x: u8, ...) = bar;
//~^ ERROR: mismatched types
- //~| expected `extern "C" fn(isize, u8, ...)`
- //~| found `extern "C" fn(isize, u8) {bar}`
- //~| expected variadic fn
- //~| found non-variadic function
+ //~| expected type `extern "C" fn(isize, u8, ...)`
+ //~| found type `extern "C" fn(isize, u8) {bar}`
+ //~| NOTE: expected variadic fn, found non-variadic function
foo(1, 2, 3f32); //~ ERROR: can't pass an `f32` to variadic function, cast to `c_double`
foo(1, 2, true); //~ ERROR: can't pass `bool` to variadic function, cast to `c_int`