Avoid ICE in arg mistmatch error for tuple variants

This commit is contained in:
Esteban Küber 2018-02-15 14:42:22 -08:00
parent 16362c737f
commit b9fa2dac25
3 changed files with 48 additions and 3 deletions

View file

@ -22,3 +22,18 @@ impl Foo {
}
//~^^ ERROR function is expected to take 1 argument, but it takes 2 arguments [E0593]
}
enum Qux {
Bar(i32),
}
fn foo<F>(f: F)
where
F: Fn(),
{
}
fn main() {
foo(Qux::Bar);
}
//~^^ ERROR function is expected to take 0 arguments, but it takes 1 argument [E0593]

View file

@ -1,5 +1,3 @@
error[E0601]: main function not found
error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
--> $DIR/issue-47706.rs:21:18
|
@ -9,5 +7,24 @@ error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
21 | self.foo.map(Foo::new)
| ^^^ expected function that takes 1 argument
error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
--> $DIR/issue-47706.rs:37:5
|
27 | Bar(i32),
| -------- takes 1 argument
...
37 | foo(Qux::Bar);
| ^^^ expected function that takes 0 arguments
|
note: required by `foo`
--> $DIR/issue-47706.rs:30:1
|
30 | / fn foo<F>(f: F)
31 | | where
32 | | F: Fn(),
33 | | {
34 | | }
| |_^
error: aborting due to 2 previous errors