Always report reachability for user-supplied patterns
This commit is contained in:
parent
2bf6e7880d
commit
003bbcb799
@ -434,14 +434,9 @@ fn check_let_reachability<'p, 'tcx>(
|
|||||||
let arms = [MatchArm { pat, hir_id: pat_id, has_guard: false }];
|
let arms = [MatchArm { pat, hir_id: pat_id, has_guard: false }];
|
||||||
let report = compute_match_usefulness(&cx, &arms, pat_id, pat.ty);
|
let report = compute_match_usefulness(&cx, &arms, pat_id, pat.ty);
|
||||||
|
|
||||||
match let_source(cx.tcx, pat_id) {
|
report_arm_reachability(&cx, &report, |arm_span, arm_hir_id, _| {
|
||||||
LetSource::IfLet | LetSource::WhileLet | LetSource::IfLetGuard => {
|
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() {
|
if report.non_exhaustiveness_witnesses.is_empty() {
|
||||||
// The match is exhaustive, i.e. the `if let` pattern is irrefutable.
|
// The match is exhaustive, i.e. the `if let` pattern is irrefutable.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user