diff options
Diffstat (limited to 'src/test/ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs')
-rw-r--r-- | src/test/ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs b/src/test/ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs new file mode 100644 index 000000000..e2ff9ac87 --- /dev/null +++ b/src/test/ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs @@ -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() {} |