Rollup merge of #55742 - F001:fix-55718, r=petrochenkov
Avoid panic when matching function call Fix #55718 This bug is introduced by #53751. The original code checked `Def::AssociatedConst(..) | Def::Method(..)` before `pat_ty.no_bound_vars().expect("expected fn type")`. But somehow I exchanged the sequence carelessly. Sorry about that. r? @petrochenkov
This commit is contained in:
commit
792476516f
3 changed files with 34 additions and 5 deletions
12
src/test/ui/match/match-fn-call.rs
Normal file
12
src/test/ui/match/match-fn-call.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
let path = Path::new("foo");
|
||||
match path {
|
||||
Path::new("foo") => println!("foo"),
|
||||
//~^ ERROR expected tuple struct/variant
|
||||
Path::new("bar") => println!("bar"),
|
||||
//~^ ERROR expected tuple struct/variant
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
15
src/test/ui/match/match-fn-call.stderr
Normal file
15
src/test/ui/match/match-fn-call.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
error[E0164]: expected tuple struct/variant, found method `<Path>::new`
|
||||
--> $DIR/match-fn-call.rs:6:9
|
||||
|
|
||||
LL | Path::new("foo") => println!("foo"),
|
||||
| ^^^^^^^^^^^^^^^^ not a tuple variant or struct
|
||||
|
||||
error[E0164]: expected tuple struct/variant, found method `<Path>::new`
|
||||
--> $DIR/match-fn-call.rs:8:9
|
||||
|
|
||||
LL | Path::new("bar") => println!("bar"),
|
||||
| ^^^^^^^^^^^^^^^^ not a tuple variant or struct
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0164`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue