diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2020-05-09 13:46:05 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2020-05-17 17:38:23 +0100 |
| commit | e5a2cd526a6ad92b90dda81104abc7adf4c83495 (patch) | |
| tree | a2db8e413c45f97ac473d18d3998584274810cf3 /src/test/ui | |
| parent | 8f08b16c030d89049e0633ced8665c317db83f03 (diff) | |
| download | rust-e5a2cd526a6ad92b90dda81104abc7adf4c83495.tar.gz rust-e5a2cd526a6ad92b90dda81104abc7adf4c83495.zip | |
We don't use tyerr anymore
This however unearthed a bug, hence the FIXME and the workaround.
Diffstat (limited to 'src/test/ui')
| -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 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() {} |
