-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Less conservative uninhabitedness check #54125
Less conservative uninhabitedness check #54125
Conversation
This comment has been minimized.
This comment has been minimized.
I'm not sure I understand why places which checked Ideally we'd have some implication between them, e.g. we can make a query for |
It is also not clear to me if we should change this code, but I think a possible justification arises from this stuff I wrote earlier:
That said, I'm not entirely sure how to think about unions, and I'm wondering if what I wrote above is strictly correct. =) In particular, the compiler will (I think) get with you if you don't initialization the union somehow...? You might though be able to use a |
I'll admit I mostly copied these over from the original PR — and I think at the time they were made,
It's safer to treat them as possibly-inhabited for now. |
Uh, please don't. We want to have some proper discussion before we make any assumption about union contents. |
Ah, I removed the union handling, but forgot to update the comment. Unions are now currently never treated as uninhabited. |
Maybe you forgot to push? The code I am looking at doesn't seem to check for unions? |
It's just above the main ADT handling: |
@RalfJung that's just a helper - you can't always compute the layout, even in cases where you determine separately from the layout, that the type is uninhabited. |
The comment about |
I changed to S-waiting-on-author because we need to at minimum change that comment. Other than that, I don't remember if there are any blocking concerns here? |
75de30f
to
2ba3e66
Compare
I've added a mir-opt test, though with the reversion of the destination uninhabitedness checking (see below), they currently do result in slightly different MIR. Regarding the state of the PR, I think it's ready. I've reverted the change in |
📌 Commit 2ba3e66 has been approved by |
⌛ Testing commit 2ba3e66 with merge bb22fc863da8536d7f6c3a6b53eb0357d7384d0b... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The test
|
I've removed the @bors r=nikomatsakis |
📌 Commit 0a8b696 has been approved by |
That test was checking how gdb and debuginfo cope with UB, which does make some sense. |
…, r=nikomatsakis Less conservative uninhabitedness check Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays. Pulled out of #47291 and #50262. Fixes #54586. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays.
Pulled out of #47291 and #50262.
Fixes #54586.
r? @nikomatsakis