Skip to content

Commit

Permalink
Move cfail tests to ui
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Apr 26, 2017
1 parent b52c8c2 commit b10e293
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 0 deletions.
File renamed without changes.
24 changes: 24 additions & 0 deletions src/test/ui/mismatched_types/E0281.stderr
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.
18 changes: 18 additions & 0 deletions src/test/ui/mismatched_types/fn-variance-1.stderr
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.
28 changes: 28 additions & 0 deletions src/test/ui/mismatched_types/issue-36053-2.stderr
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

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

0 comments on commit b10e293

Please sign in to comment.