add note for non-exhaustive matches with guards
This commit is contained in:
parent
6b46c996e1
commit
fbd1e0252f
8 changed files with 60 additions and 24 deletions
|
@ -830,6 +830,11 @@ fn non_exhaustive_match<'p, 'tcx>(
|
|||
_ => " or multiple match arms",
|
||||
},
|
||||
);
|
||||
|
||||
let all_arms_have_guards = arms.iter().all(|arm_id| thir[*arm_id].guard.is_some());
|
||||
if !is_empty_match && all_arms_have_guards {
|
||||
err.note("match arms with guards don't count towards exhaustivity");
|
||||
}
|
||||
if let Some((span, sugg)) = suggestion {
|
||||
err.span_suggestion_verbose(span, msg, sugg, Applicability::HasPlaceholders);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue