diff --git a/src/test/compile-fail/E0281.rs b/src/test/ui/mismatched_types/E0281.rs similarity index 100% rename from src/test/compile-fail/E0281.rs rename to src/test/ui/mismatched_types/E0281.rs diff --git a/src/test/ui/mismatched_types/E0281.stderr b/src/test/ui/mismatched_types/E0281.stderr new file mode 100644 index 00000000000..28a649d4c91 --- /dev/null +++ b/src/test/ui/mismatched_types/E0281.stderr @@ -0,0 +1,24 @@ +error[E0281]: type mismatch: `[closure@$DIR/E0281.rs:14:9: 14:24]` implements the trait `std::ops::Fn<(std::string::String,)>`, but the trait `std::ops::Fn<(usize,)>` is required + --> $DIR/E0281.rs:14:5 + | +14 | foo(|y: String| { }); + | ^^^ --------------- implements `std::ops::Fn<(std::string::String,)>` + | | + | requires `std::ops::Fn<(usize,)>` + | expected usize, found struct `std::string::String` + | + = note: required by `foo` + +error[E0281]: type mismatch: `[closure@$DIR/E0281.rs:14:9: 14:24]` implements the trait `std::ops::FnOnce<(std::string::String,)>`, but the trait `std::ops::FnOnce<(usize,)>` is required + --> $DIR/E0281.rs:14:5 + | +14 | foo(|y: String| { }); + | ^^^ --------------- implements `std::ops::FnOnce<(std::string::String,)>` + | | + | requires `std::ops::FnOnce<(usize,)>` + | expected usize, found struct `std::string::String` + | + = note: required by `foo` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/fn-variance-1.rs b/src/test/ui/mismatched_types/fn-variance-1.rs similarity index 100% rename from src/test/compile-fail/fn-variance-1.rs rename to src/test/ui/mismatched_types/fn-variance-1.rs diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr new file mode 100644 index 00000000000..120fb87cdc8 --- /dev/null +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -0,0 +1,18 @@ +error[E0281]: type mismatch: `fn(&mut isize) {takes_mut}` implements the trait `for<'r> std::ops::FnOnce<(&'r mut isize,)>`, but the trait `std::ops::FnOnce<(&{integer},)>` is required + --> $DIR/fn-variance-1.rs:21:5 + | +21 | apply(&3, takes_mut); + | ^^^^^ types differ in mutability + | + = note: required by `apply` + +error[E0281]: type mismatch: `fn(&isize) {takes_imm}` implements the trait `for<'r> std::ops::FnOnce<(&'r isize,)>`, but the trait `std::ops::FnOnce<(&mut {integer},)>` is required + --> $DIR/fn-variance-1.rs:27:5 + | +27 | apply(&mut 3, takes_imm); + | ^^^^^ types differ in mutability + | + = note: required by `apply` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-36053-2.rs b/src/test/ui/mismatched_types/issue-36053-2.rs similarity index 100% rename from src/test/compile-fail/issue-36053-2.rs rename to src/test/ui/mismatched_types/issue-36053-2.rs diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr new file mode 100644 index 00000000000..adc229aaacc --- /dev/null +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -0,0 +1,28 @@ +error: no method named `count` found for type `std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]>` in the current scope + --> $DIR/issue-36053-2.rs:17:55 + | +17 | once::<&str>("str").fuse().filter(|a: &str| true).count(); + | ^^^^^ + | + = note: the method `count` exists but the following trait bounds were not satisfied: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`, `std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator` + +error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnMut<(&'r str,)>`, but the trait `for<'r> std::ops::FnMut<(&'r &str,)>` is required + --> $DIR/issue-36053-2.rs:17:32 + | +17 | once::<&str>("str").fuse().filter(|a: &str| true).count(); + | ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>` + | | + | requires `for<'r> std::ops::FnMut<(&'r &str,)>` + | expected &str, found str + +error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnOnce<(&'r str,)>`, but the trait `for<'r> std::ops::FnOnce<(&'r &str,)>` is required + --> $DIR/issue-36053-2.rs:17:32 + | +17 | once::<&str>("str").fuse().filter(|a: &str| true).count(); + | ^^^^^^ -------------- implements `for<'r> std::ops::FnOnce<(&'r str,)>` + | | + | requires `for<'r> std::ops::FnOnce<(&'r &str,)>` + | expected &str, found str + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs similarity index 100% rename from src/test/compile-fail/unboxed-closures-vtable-mismatch.rs rename to src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr new file mode 100644 index 00000000000..e100520e561 --- /dev/null +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -0,0 +1,30 @@ +error[E0281]: type mismatch: `[closure@$DIR/unboxed-closures-vtable-mismatch.rs:22:23: 22:73]` implements the trait `std::ops::FnMut<(usize, isize)>`, but the trait `std::ops::FnMut<(isize, isize)>` is required + --> $DIR/unboxed-closures-vtable-mismatch.rs:25:13 + | +22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); + | -------------------------------------------------- implements `std::ops::FnMut<(usize, isize)>` +... +25 | let z = call_it(3, f); + | ^^^^^^^ + | | + | requires `std::ops::FnMut<(isize, isize)>` + | expected isize, found usize + | + = note: required by `call_it` + +error[E0281]: type mismatch: `[closure@$DIR/unboxed-closures-vtable-mismatch.rs:22:23: 22:73]` implements the trait `std::ops::FnOnce<(usize, isize)>`, but the trait `std::ops::FnOnce<(isize, isize)>` is required + --> $DIR/unboxed-closures-vtable-mismatch.rs:25:13 + | +22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); + | -------------------------------------------------- implements `std::ops::FnOnce<(usize, isize)>` +... +25 | let z = call_it(3, f); + | ^^^^^^^ + | | + | requires `std::ops::FnOnce<(isize, isize)>` + | expected isize, found usize + | + = note: required by `call_it` + +error: aborting due to 2 previous errors +