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
{{ message }}
Repository navigation
Message reporting missing patterns for inexhaustive match is misleading #72377
If you add the suggested arms, it will in fact detect the other ones as missing. It is expected that (A, Some(A)) is detected as not covered since the match guard is not taken into account when checking exhaustiveness (and couldn't be, since it's an arbitrary expression).
It is expected that (A, Some(A)) is detected as not covered since the match guard is not taken into account when checking exhaustiveness
Wouldn't you then expect that it mentions (A, Some(A)), (B, Some(B)), (C, Some(C)), (A, Some(B)) and (C, Some(B)) as not covered? Or is the number of outputs always restricted to two? In that case, I think it would be useful to indicate that some patterns might be missing, e.g.:
error[E0004]: non-exhaustive patterns: at least `(A, Some(A))` and `(A, Some(B))` not covered
changed the title [-]Wrong match pattern is detected as not covered[/-][+]Message reporting missing patterns for inexhaustive match is misleading[/+]on May 30, 2020
Activity
jonas-schievink commentedon May 20, 2020
If you add the suggested arms, it will in fact detect the other ones as missing. It is expected that
(A, Some(A))is detected as not covered since the match guard is not taken into account when checking exhaustiveness (and couldn't be, since it's an arbitrary expression).jonas-schievink commentedon May 21, 2020
Closing as expected behavior.
vandenheuvel commentedon May 22, 2020
Wouldn't you then expect that it mentions
(A, Some(A)),(B, Some(B)),(C, Some(C)),(A, Some(B))and(C, Some(B))as not covered? Or is the number of outputs always restricted to two? In that case, I think it would be useful to indicate that some patterns might be missing, e.g.:jonas-schievink commentedon May 22, 2020
Yeah that's true
[-]Wrong match pattern is detected as not covered[/-][+]Message reporting missing patterns for inexhaustive match is misleading[/+]Rollup merge of rust-lang#81897 - vandenheuvel:match_exhaustive_diagn…
Rollup merge of rust-lang#81897 - vandenheuvel:match_exhaustive_diagn…