-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Allow explicit matches on ! without warning #55119
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
What about this? I think it should get the warning. fn foo(x: !) {
return;
match x {}
} Somehow it "manages" to not warn about |
I've spotted that this the root cause here is actually different than I originally thought; the fix should be simpler and address those other cases. |
This comment has been minimized.
This comment has been minimized.
48e1851
to
3b88a54
Compare
Turns out |
3b88a54
to
fe09dbf
Compare
This comment has been minimized.
This comment has been minimized.
LGTM :) Except of course that the test is failing...? |
This comment has been minimized.
This comment has been minimized.
d1433ef
to
0982be7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with new test
|
||
fn main() { | ||
return; | ||
match () { //~ ERROR: unreachable expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to test
fn main() {
match (return) {
() => ()
}
}
too (this should warn, I think, on the arm?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, this won't warn at all. I'll try to get the arms warning.
The arm warning message could be improved in the future, but this is definitely an uncommon case, so the new warning should suffice for now. @bors r=nikomatsakis |
📌 Commit 2634646 has been approved by |
Allow explicit matches on ! without warning It's now possible to explicitly match on `!` without an unreachable code warning. This seems desirable as promoting explicitness. Fixes #55116.
☀️ Test successful - status-appveyor, status-travis |
It's now possible to explicitly match on
!
without an unreachable code warning. This seems desirable as promoting explicitness.Fixes #55116.