diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2021-09-13 15:47:24 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2021-09-26 00:05:52 +0100 |
| commit | 003bbcb799c147ce004c597f77853155cee8a2be (patch) | |
| tree | 297091b78015784f73614edc66d6323f2850b413 | |
| parent | 2bf6e7880ddab107219ec493952dc8d74c749a5b (diff) | |
| download | rust-003bbcb799c147ce004c597f77853155cee8a2be.tar.gz rust-003bbcb799c147ce004c597f77853155cee8a2be.zip | |
Always report reachability for user-supplied patterns
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/check_match.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 724ac545315..d04d3261a26 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -434,14 +434,9 @@ fn check_let_reachability<'p, 'tcx>( let arms = [MatchArm { pat, hir_id: pat_id, has_guard: false }]; let report = compute_match_usefulness(&cx, &arms, pat_id, pat.ty); - match let_source(cx.tcx, pat_id) { - LetSource::IfLet | LetSource::WhileLet | LetSource::IfLetGuard => { - report_arm_reachability(&cx, &report, |arm_span, arm_hir_id, _| { - unreachable_pattern(cx.tcx, arm_span, arm_hir_id, None) - }); - } - _ => {} - } + report_arm_reachability(&cx, &report, |arm_span, arm_hir_id, _| { + unreachable_pattern(cx.tcx, arm_span, arm_hir_id, None) + }); if report.non_exhaustiveness_witnesses.is_empty() { // The match is exhaustive, i.e. the `if let` pattern is irrefutable. |
