-
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
Do not ICE when matching an uninhabited enum's field #69753
Do not ICE when matching an uninhabited enum's field #69753
Conversation
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
cc @RalfJung |
The reason the test is written in that manner is that I had played with a few other methods of fixing this bug; one in particular messed around with the logic here: rust/src/librustc/ty/layout.rs Lines 781 to 795 in b818ccc
where I was trying to replace the Long story short, that approach didn't work; but when I was working on it, I was worried enough about the handling of |
(also, the reason that the code doesn't just unconditionally I'm sure there is a better solution to this problem, in terms of handling the scenario in a more disciplined manner. I laid out three different choices on zulip, but this is the one I felt most confident about being good enough to backport to beta in the short term. (Because all it does it injects a |
@bors r+ |
📌 Commit 9712fa4 has been approved by |
FWIW, I don't think this is the right fix. At the very least we should add a comment saying In other words, I consider it quite reasonable to ICE when MIR building says "get field 0 of that variant", but consulting that variant's layout says "nope there are no fields here". This also has to cause issues in codegen, which likely already carries a comparable hack. So is every backend supposed to separately carry hacks working around what is ultimately an issue in the middle-end? |
It is not the correct fix, I agree, but this is getting into stable soon. I am opening a workspace locally later today to start working on a real fix |
@bors r+ |
📌 Commit 40809b0 has been approved by |
…ited-enum-field, r=oli-obk Do not ICE when matching an uninhabited enum's field Fix rust-lang#69191
This comment has been minimized.
This comment has been minimized.
@bors rollup=never (just to make it easier to cancel this PR if we get a different fix going) |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit b4422fb has been approved by |
🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened |
Also, assuming this does end up in nightly, its fine for it to be part of a rollup. |
@bors rollup+ |
@bors p=9 |
Discussed in today's design meeting, decided to accept this change for beta backport. |
@bors treeclosed- |
⌛ Testing commit b4422fb with merge 24b67c42c7ed3b589eb21be5d8ead7f646a16038... |
Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. 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 |
💔 Test failed - checks-azure |
@bors retry |
☀️ Test successful - checks-azure |
[stable] Release 1.42.0 This PR prepares the release artifacts of Rust 1.42.0, and cherry-picks the following PRs: * #69754: Update deprecation version to 1.42 for Error::description * #69753: Do not ICE when matching an uninhabited enum's field * #69522 / #69853: error_derive_forbidden_on_non_adt: be more graceful * #68598: Fix null synthetic_implementors error In addition, the release notes are updated to include the remaining compatibility notes. r? @Centril
[stable] Release 1.42.0 This PR prepares the release artifacts of Rust 1.42.0, and cherry-picks the following PRs: * #69754: Update deprecation version to 1.42 for Error::description * #69753: Do not ICE when matching an uninhabited enum's field * #69522 / #69853: error_derive_forbidden_on_non_adt: be more graceful * #68598: Fix null synthetic_implementors error In addition, the release notes are updated to include the remaining compatibility notes. r? @Centril
Fix #69191