Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 003bbcb

Browse files
committed
Always report reachability for user-supplied patterns
1 parent 2bf6e78 commit 003bbcb

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,9 @@ fn check_let_reachability<'p, 'tcx>(
434434
let arms = [MatchArm { pat, hir_id: pat_id, has_guard: false }];
435435
let report = compute_match_usefulness(&cx, &arms, pat_id, pat.ty);
436436

437-
match let_source(cx.tcx, pat_id) {
438-
LetSource::IfLet | LetSource::WhileLet | LetSource::IfLetGuard => {
439-
report_arm_reachability(&cx, &report, |arm_span, arm_hir_id, _| {
440-
unreachable_pattern(cx.tcx, arm_span, arm_hir_id, None)
441-
});
442-
}
443-
_ => {}
444-
}
437+
report_arm_reachability(&cx, &report, |arm_span, arm_hir_id, _| {
438+
unreachable_pattern(cx.tcx, arm_span, arm_hir_id, None)
439+
});
445440

446441
if report.non_exhaustiveness_witnesses.is_empty() {
447442
// The match is exhaustive, i.e. the `if let` pattern is irrefutable.

0 commit comments

Comments
 (0)