-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Attribute(?) to selectively disable "unreachable pattern" errors #4112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Nominating for milestone 3, feature-complete |
this would just be a scoped lint, right? |
I think this was never actually discussed, so, re-labelling it as "nominated". |
Still relevant. |
accepted for feature-complete milestone |
Not a 1.0 blocker, P-low. |
Triage, no change. |
Triage: no change |
To anyone needing this now: match 0 {
1 ... 3 => {}
x if true => {}
_ => {}
} |
There's an easy work-around, don't think an attribute is necessary here. |
Since new lints have a big impact on users of rustc, the policy is that they should go through the RFC process like other user-facing changes. As such, I'm going to give this one a close, but if anyone comes across this ticket and wants this lint, consider adding it to clippy and/or writing up an RFC. Thanks! |
Socket read/write cleanup
When writing macros that expand to "match" expressions, it can be hard to guarantee that all cases of the match will be necessary. Consider the following macro:
An example use of this macro would be
case!(some_expr, x where x > 3 => x, 3)
, which is equivalent tomax(3, some_expr)
(a silly example, but still).Unfortunately, this example fails to compile because it expands to
The last case of the match is redundant. However, there are also uses of the macro where the last case will not be redundant, eg.
case!(some_expr, [email protected] where x % 2 == 0 => true, false)
.It would be nice if there were some way to mark that a particular
match
expression is allowed to have unreachable cases, or (better yet) that a particular case was allowed to be unreachable.The text was updated successfully, but these errors were encountered: