From e5a2cd526a6ad92b90dda81104abc7adf4c83495 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 9 May 2020 13:46:05 +0100 Subject: We don't use tyerr anymore This however unearthed a bug, hence the FIXME and the workaround. --- .../issue-71930-type-of-match-scrutinee.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs (limited to 'src/test/ui/pattern') 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 00000000000..e2ff9ac87ef --- /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() {} -- cgit 1.4.1-3-g733a5