forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#55742 - F001:fix-55718, r=petrochenkov
Avoid panic when matching function call Fix rust-lang#55718 This bug is introduced by rust-lang#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
- Loading branch information
Showing
3 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
_ => (), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |