Skip to content

Commit

Permalink
Rollup merge of #133702 - RalfJung:single-variant, r=oli-obk
Browse files Browse the repository at this point in the history
Variants::Single: do not use invalid VariantIdx for uninhabited enums

~~Stacked on top of rust-lang/rust#133681, only the last commit is new.~~

Currently, `Variants::Single` for an empty enum contains a `VariantIdx` of 0; looking that up in the enum variant list will ICE. That's quite confusing. So let's fix that by adding a new `Variants::Empty` case for types that have 0 variants.

try-job: i686-msvc
  • Loading branch information
jieyouxu authored Dec 19, 2024
2 parents 52d7e45 + 35395af commit b4e7064
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// `UnsafeCell` action.
(self.unsafe_cell_action)(v)
}
Variants::Single { .. } => {
Variants::Single { .. } | Variants::Empty => {
// Proceed further, try to find where exactly that `UnsafeCell`
// is hiding.
self.walk_value(v)
Expand Down

0 comments on commit b4e7064

Please sign in to comment.