update test cases to reflect new messages
This commit is contained in:
parent
d9a947ce8f
commit
e416518e68
121 changed files with 534 additions and 630 deletions
|
@ -11,16 +11,14 @@
|
|||
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
|
||||
}
|
||||
|
|
|
@ -32,10 +32,9 @@ fn foo1<I: Foo<A=Bar>>(x: I) {
|
|||
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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ pub fn f2<T: Foo>(a: T) -> T::A {
|
|||
pub fn f1_int_int() {
|
||||
f1(2i32, 4i32);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `u32`
|
||||
//~| found `i32`
|
||||
//~| expected u32, found i32
|
||||
}
|
||||
|
||||
pub fn f1_int_uint() {
|
||||
|
@ -49,8 +48,7 @@ pub fn f1_uint_int() {
|
|||
pub fn f2_int() {
|
||||
let _: i32 = f2(2i32);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `i32`
|
||||
//~| found `u32`
|
||||
//~| expected i32, found u32
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
|
|
|
@ -21,8 +21,10 @@ impl AddAssign for Int {
|
|||
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
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
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); }
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
// 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
|
||||
|
|
|
@ -62,6 +62,7 @@ fn mut_plus_immut() {
|
|||
&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() {
|
||||
|
@ -70,6 +71,7 @@ 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() {}
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
fn main() {
|
||||
while true {
|
||||
true //~ ERROR mismatched types
|
||||
//~| expected `()`
|
||||
//~| found `bool`
|
||||
//~| expected ()
|
||||
//~| found bool
|
||||
//~| expected type `()`
|
||||
//~| found type `bool`
|
||||
//~| expected (), found bool
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,22 +33,28 @@ struct D {
|
|||
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() {
|
||||
|
@ -75,44 +81,52 @@ fn move_after_mut_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
|
||||
}
|
||||
|
||||
|
@ -133,18 +147,20 @@ fn move_after_mut_borrow_nested() {
|
|||
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();
|
||||
|
|
|
@ -24,7 +24,7 @@ fn a(x: &isize) {
|
|||
//~^ 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() {
|
||||
|
|
|
@ -39,7 +39,7 @@ fn c(x: &mut isize) {
|
|||
|
||||
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) {
|
||||
|
|
|
@ -109,6 +109,7 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
|
|||
borrow(&*v); //~ ERROR cannot borrow
|
||||
if cond2 {
|
||||
x = &mut v; //~ ERROR cannot borrow
|
||||
//~^ ERROR cannot borrow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ fn main() {
|
|||
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; }
|
||||
|
|
|
@ -13,10 +13,11 @@ fn main() {
|
|||
// 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 {
|
||||
|
@ -24,10 +25,11 @@ fn foo() {
|
|||
// 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 => ()
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +39,9 @@ fn bar() {
|
|||
|| {
|
||||
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
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ fn bar<T: Fn(u32)>(_: T) {}
|
|||
|
||||
fn main() {
|
||||
let x = X;
|
||||
let closure = |_| foo(x); //~ ERROR E0524
|
||||
let closure = |_| foo(x); //~ ERROR E0525
|
||||
bar(closure);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
|||
let x = 0;
|
||||
f(&x);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&mut i32`
|
||||
//~| found `&_`
|
||||
//~| expected type `&mut i32`
|
||||
//~| found type `&_`
|
||||
//~| values differ in mutability
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
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
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ pub fn main() {
|
|||
// 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
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@ fn main() {
|
|||
// 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
|
||||
|
||||
|
|
|
@ -24,7 +24,11 @@ fn main() {
|
|||
//~^ 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`
|
||||
}
|
||||
|
|
|
@ -40,20 +40,17 @@ fn main() {
|
|||
// 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
|
||||
}
|
||||
|
|
|
@ -45,9 +45,8 @@ pub fn main() {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ pub fn main() {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ struct Foo<'a,'b> {
|
|||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
// 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
|
||||
|
|
|
@ -22,26 +22,22 @@ impl<T> Foo for T { /* `foo` is still default here */ }
|
|||
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
|
||||
}
|
||||
|
|
|
@ -16,22 +16,19 @@ fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
|||
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,)>`
|
||||
|
|
|
@ -14,8 +14,7 @@ fn main() {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -21,10 +21,9 @@ mod y {
|
|||
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() {
|
||||
|
|
|
@ -15,10 +15,9 @@ use std::option::Option;
|
|||
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() {
|
||||
|
|
|
@ -22,46 +22,40 @@ 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 ()
|
||||
}
|
||||
|
|
|
@ -11,6 +11,5 @@
|
|||
fn main() {
|
||||
let x = if true { 10i32 } else { 10u32 };
|
||||
//~^ ERROR if and else have incompatible types
|
||||
//~| expected `i32`
|
||||
//~| found `u32`
|
||||
//~| expected i32, found u32
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
|
||||
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
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -41,168 +41,132 @@ fn main() {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ fn main() {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
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() {}
|
||||
|
|
|
@ -10,11 +10,10 @@
|
|||
|
||||
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
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#[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
|
||||
|
|
|
@ -15,11 +15,9 @@ fn bar(_s: u32) { }
|
|||
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
|
||||
}
|
||||
|
|
|
@ -17,16 +17,14 @@ pub fn main() {
|
|||
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`
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,10 +17,9 @@ fn main() {
|
|||
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)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ fn main() {
|
|||
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)
|
||||
};
|
||||
|
|
|
@ -16,10 +16,9 @@ mod 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`
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,10 +31,9 @@ mod b {
|
|||
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`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
// 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);}
|
||||
|
|
|
@ -14,10 +14,9 @@ struct vec3 { y: f32, z: f32 }
|
|||
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() { }
|
||||
|
|
|
@ -17,9 +17,8 @@ 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);
|
||||
}
|
||||
|
|
|
@ -20,10 +20,9 @@ fn main() {
|
|||
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,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ use std::raw::Slice;
|
|||
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`
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@ fn main() {
|
|||
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!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
|
||||
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() {}
|
||||
|
|
|
@ -15,13 +15,15 @@ struct Foo { a: isize, b: isize }
|
|||
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
|
||||
|
|
|
@ -24,28 +24,25 @@ fn main() {
|
|||
// `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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,9 @@ impl Debug for Player {
|
|||
|
||||
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,
|
||||
|
|
|
@ -15,12 +15,12 @@ struct Foo<'a> {
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,10 @@ trait Trait { }
|
|||
|
||||
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() { }
|
||||
|
|
|
@ -13,10 +13,9 @@
|
|||
|
||||
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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ fn closure_to_loc() {
|
|||
//~^ 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() {
|
||||
|
@ -26,6 +29,9 @@ 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() { }
|
||||
|
|
|
@ -12,7 +12,9 @@ struct NoCopy;
|
|||
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`
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
fn main() {
|
||||
static foo: Fn() -> u32 = || -> u32 {
|
||||
//~^ ERROR: mismatched types:
|
||||
//~^ ERROR: mismatched types
|
||||
0
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ macro_rules! write {
|
|||
write(stdout, $arr.as_ptr() as *const i8,
|
||||
$arr.len() * size_of($arr[0]));
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u64, found usize
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,8 @@ struct S;
|
|||
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
|
||||
}
|
||||
|
|
|
@ -13,10 +13,13 @@ macro_rules! foo {
|
|||
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!
|
||||
}
|
||||
|
|
|
@ -12,10 +12,9 @@ fn foo<T, U>(x: T, y: U) {
|
|||
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() {
|
||||
|
|
|
@ -11,6 +11,5 @@
|
|||
fn main() {
|
||||
let _p: char = 100;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `char`
|
||||
//~| found `u8`
|
||||
//~| expected char, found u8
|
||||
}
|
||||
|
|
|
@ -12,9 +12,8 @@ fn main() {
|
|||
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`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,9 @@ fn main() {
|
|||
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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@ fn main() {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@ const A: (isize,isize) = (4,2);
|
|||
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
|
||||
}
|
||||
|
|
|
@ -16,48 +16,43 @@ enum A { B, C }
|
|||
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
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,6 +64,5 @@ fn main() {
|
|||
|
||||
// Make sure none of the errors above were fatal
|
||||
let x: char = true; //~ ERROR mismatched types
|
||||
//~| expected `char`
|
||||
//~| found `bool`
|
||||
//~| expected char, found bool
|
||||
}
|
||||
|
|
|
@ -15,10 +15,9 @@ fn main() {
|
|||
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`
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
fn main() {
|
||||
&panic!()
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`
|
||||
//~| found `&_`
|
||||
//~| expected ()
|
||||
//~| found &-ptr
|
||||
//~| expected type `()`
|
||||
//~| found type `&_`
|
||||
//~| expected (), found &-ptr
|
||||
}
|
||||
|
|
|
@ -13,10 +13,9 @@ struct BarStruct;
|
|||
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() {}
|
||||
|
|
|
@ -15,11 +15,10 @@ fn foo(x: Whatever) {
|
|||
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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,25 +16,22 @@ fn main() {
|
|||
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`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
|
||||
#[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
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() -> char {
|
||||
//~^ ERROR: main function expects type
|
||||
//~^ ERROR: main function has wrong type
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ struct S {
|
|||
}
|
||||
|
||||
fn main(foo: S) {
|
||||
//~^ ERROR: main function expects type
|
||||
//~^ ERROR: main function has wrong type
|
||||
}
|
||||
|
|
|
@ -28,6 +28,5 @@ fn main() {
|
|||
_ => { }
|
||||
};
|
||||
//~^^^ ERROR mismatched types in range
|
||||
//~| expected char
|
||||
//~| found integral variable
|
||||
//~| expected char, found integral variable
|
||||
}
|
||||
|
|
|
@ -16,10 +16,9 @@ fn main() {
|
|||
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`
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,8 @@ fn main() {
|
|||
match () {
|
||||
[()] => { }
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`
|
||||
//~| found `&[_]`
|
||||
//~| expected ()
|
||||
//~| found &-ptr
|
||||
//~| expected type `()`
|
||||
//~| found type `&[_]`
|
||||
//~| expected (), found &-ptr
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,11 @@ impl Foo {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -16,13 +16,17 @@ fn touch<A>(_a: &A) {}
|
|||
|
||||
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`
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ fn f10() {
|
|||
};
|
||||
|
||||
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() {}
|
||||
|
|
|
@ -14,8 +14,8 @@ 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;
|
||||
|
@ -23,8 +23,8 @@ fn main() {
|
|||
let bar = &1;
|
||||
let &_ = bar;
|
||||
let &mut _ //~ ERROR mismatched types
|
||||
//~| expected `&_`
|
||||
//~| found `&mut _`
|
||||
//~| expected type `&_`
|
||||
//~| found type `&mut _`
|
||||
//~| values differ in mutability
|
||||
= bar;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ fn main() {
|
|||
// 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`
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ fn main() {
|
|||
g = f;
|
||||
f = box g;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `_`
|
||||
//~| found `Box<_>`
|
||||
//~| expected type `_`
|
||||
//~| found type `Box<_>`
|
||||
//~| cyclic type of infinite size
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
|||
let f;
|
||||
f = box f;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `_`
|
||||
//~| found `Box<_>`
|
||||
//~| expected type `_`
|
||||
//~| found type `Box<_>`
|
||||
//~| cyclic type of infinite size
|
||||
}
|
||||
|
|
|
@ -31,17 +31,15 @@ fn main() {
|
|||
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`
|
||||
|
|
|
@ -13,11 +13,9 @@ fn let_in<T, F>(x: T, f: F) where F: FnOnce(T) {}
|
|||
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
|
||||
}
|
||||
|
|
|
@ -15,19 +15,19 @@ pub fn main() {
|
|||
// *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
|
||||
}
|
||||
|
|
|
@ -11,22 +11,16 @@
|
|||
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
|
||||
|
|
|
@ -17,15 +17,15 @@ struct a_class<'a> { x:&'a isize }
|
|||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ impl<'a> Box<'a> {
|
|||
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
|
||||
|
||||
}
|
||||
|
|
|
@ -55,10 +55,9 @@ fn supply_G() {
|
|||
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() {
|
||||
|
|
|
@ -27,10 +27,10 @@ fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched ty
|
|||
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() {}
|
||||
|
|
|
@ -32,8 +32,8 @@ impl<'a> set_f<'a> for c<'a> {
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ impl<'ml> Drop for M<'ml> { fn drop(&mut self) { } } // AC
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -16,52 +16,45 @@ fn main() {
|
|||
//~^ 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]
|
||||
}
|
||||
|
|
|
@ -34,8 +34,7 @@ fn foo(p: &Panolpy) {
|
|||
// 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() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue