Instead of ICEing on incorrect pattern, use delay_span_bug

This commit is contained in:
Esteban Küber 2019-05-08 10:23:55 -07:00
parent 33cde4aac2
commit cc40f41ee5
3 changed files with 35 additions and 2 deletions

16
src/test/ui/fn-in-pat.rs Normal file
View file

@ -0,0 +1,16 @@
struct A {}
impl A {
fn new() {}
}
fn hof<F>(_: F) where F: FnMut(()) {}
fn ice() {
hof(|c| match c {
A::new() => (), //~ ERROR expected tuple struct/variant, found method
_ => ()
})
}
fn main() {}

View file

@ -0,0 +1,9 @@
error[E0164]: expected tuple struct/variant, found method `<A>::new`
--> $DIR/fn-in-pat.rs:11:9
|
LL | A::new() => (),
| ^^^^^^^^ not a tuple variant or struct
error: aborting due to previous error
For more information about this error, try `rustc --explain E0164`.