Wrong discriminant read with uninhabited variants #110128
Labels
A-codegen
Area: Code generation
C-bug
Category: This is a bug.
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
P-critical
Critical priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code: tests/ui/issues/issue-61696.rs with
-Zmir-opt-level=0
I 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 ai8
layout. 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.
The text was updated successfully, but these errors were encountered: