You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #113019 - ericmarkmartin:warning-for-guard-non-exhaustion, r=fee1-dead
add note for non-exhaustive matches with guards
Associated issue: #92197
When a match statement includes guards on every match arm (and is therefore necessarily non-exhaustive), add a note to the error E0004 diagnostic noting this.
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
@@ -291,14 +297,15 @@ LL | Foo(bool),
291
297
LL | Bar,
292
298
| ^^^ not covered
293
299
= note: the matched value is of type `NonEmptyEnum2`
300
+
= note: match arms with guards don't count towards exhaustivity
294
301
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
@@ -290,14 +296,15 @@ LL | Foo(bool),
290
296
LL | Bar,
291
297
| ^^^ not covered
292
298
= note: the matched value is of type `NonEmptyEnum2`
299
+
= note: match arms with guards don't count towards exhaustivity
293
300
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
0 commit comments