Skip to content

Commit b10e293

Browse files
committed
Move cfail tests to ui
1 parent b52c8c2 commit b10e293

8 files changed

+100
-0
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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
2+
--> $DIR/E0281.rs:14:5
3+
|
4+
14 | foo(|y: String| { });
5+
| ^^^ --------------- implements `std::ops::Fn<(std::string::String,)>`
6+
| |
7+
| requires `std::ops::Fn<(usize,)>`
8+
| expected usize, found struct `std::string::String`
9+
|
10+
= note: required by `foo`
11+
12+
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
13+
--> $DIR/E0281.rs:14:5
14+
|
15+
14 | foo(|y: String| { });
16+
| ^^^ --------------- implements `std::ops::FnOnce<(std::string::String,)>`
17+
| |
18+
| requires `std::ops::FnOnce<(usize,)>`
19+
| expected usize, found struct `std::string::String`
20+
|
21+
= note: required by `foo`
22+
23+
error: aborting due to 2 previous errors
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
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
2+
--> $DIR/fn-variance-1.rs:21:5
3+
|
4+
21 | apply(&3, takes_mut);
5+
| ^^^^^ types differ in mutability
6+
|
7+
= note: required by `apply`
8+
9+
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
10+
--> $DIR/fn-variance-1.rs:27:5
11+
|
12+
27 | apply(&mut 3, takes_imm);
13+
| ^^^^^ types differ in mutability
14+
|
15+
= note: required by `apply`
16+
17+
error: aborting due to 2 previous errors
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
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
2+
--> $DIR/issue-36053-2.rs:17:55
3+
|
4+
17 | once::<&str>("str").fuse().filter(|a: &str| true).count();
5+
| ^^^^^
6+
|
7+
= 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`
8+
9+
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
10+
--> $DIR/issue-36053-2.rs:17:32
11+
|
12+
17 | once::<&str>("str").fuse().filter(|a: &str| true).count();
13+
| ^^^^^^ -------------- implements `for<'r> std::ops::FnMut<(&'r str,)>`
14+
| |
15+
| requires `for<'r> std::ops::FnMut<(&'r &str,)>`
16+
| expected &str, found str
17+
18+
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
19+
--> $DIR/issue-36053-2.rs:17:32
20+
|
21+
17 | once::<&str>("str").fuse().filter(|a: &str| true).count();
22+
| ^^^^^^ -------------- implements `for<'r> std::ops::FnOnce<(&'r str,)>`
23+
| |
24+
| requires `for<'r> std::ops::FnOnce<(&'r &str,)>`
25+
| expected &str, found str
26+
27+
error: aborting due to 3 previous errors
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
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
2+
--> $DIR/unboxed-closures-vtable-mismatch.rs:25:13
3+
|
4+
22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
5+
| -------------------------------------------------- implements `std::ops::FnMut<(usize, isize)>`
6+
...
7+
25 | let z = call_it(3, f);
8+
| ^^^^^^^
9+
| |
10+
| requires `std::ops::FnMut<(isize, isize)>`
11+
| expected isize, found usize
12+
|
13+
= note: required by `call_it`
14+
15+
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
16+
--> $DIR/unboxed-closures-vtable-mismatch.rs:25:13
17+
|
18+
22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
19+
| -------------------------------------------------- implements `std::ops::FnOnce<(usize, isize)>`
20+
...
21+
25 | let z = call_it(3, f);
22+
| ^^^^^^^
23+
| |
24+
| requires `std::ops::FnOnce<(isize, isize)>`
25+
| expected isize, found usize
26+
|
27+
= note: required by `call_it`
28+
29+
error: aborting due to 2 previous errors
30+

0 commit comments

Comments
 (0)