-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This however unearthed a bug, hence the FIXME and the workaround.
- Loading branch information
Showing
3 changed files
with
46 additions
and
35 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
22 changes: 22 additions & 0 deletions
22
src/test/ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs
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,22 @@ | ||
// check-pass | ||
|
||
// In PR 71930, it was discovered that the code to retrieve the inferred type of a match scrutinee | ||
// was incorrect. | ||
|
||
fn f() -> ! { | ||
panic!() | ||
} | ||
|
||
fn g() -> usize { | ||
match f() { // Should infer type `bool` | ||
false => 0, | ||
true => 1, | ||
} | ||
} | ||
|
||
fn h() -> usize { | ||
match f() { // Should infer type `!` | ||
} | ||
} | ||
|
||
fn main() {} |