-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
error: no method named `count` found for type `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [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<std::iter::Fuse<std::iter::Once<&str>>, [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 | ||
|
File renamed without changes.
30 changes: 30 additions & 0 deletions
30
src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|