-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Wrong discriminant read with uninhabited variants #110128
Copy link
Copy link
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code: tests/ui/issues/issue-61696.rs with
-Zmir-opt-level=0I expected to see this happen: run pass
Instead, this happened: "entered unreachable code"
Const-prop running by default on MIR was hiding the issue.
Meta
rustc --version --verbose: 131211aThis regressed in #104535
cc @mikebenfield @pnkfelix
My understanding is the following: as there are many uninhabited variants,
E2<Infallible>gets ai8layout. However, there are 257 discriminants, so discriminant arithmetic must be done after casting to ai64.I have a lot of trouble finding the proper logic between before and after #104535.