Variants::Single: do not use invalid VariantIdx for uninhabited enums
This commit is contained in:
parent
37e74596c0
commit
21de42bf8d
47 changed files with 549 additions and 281 deletions
|
@ -244,6 +244,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
|
|||
}
|
||||
let (tag_scalar, tag_encoding, tag_field) = match self.layout.variants {
|
||||
Variants::Single { index } => {
|
||||
let index = index.unwrap(); // we already checked `is_uninhabited`
|
||||
let discr_val = self
|
||||
.layout
|
||||
.ty
|
||||
|
@ -366,7 +367,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
|
|||
}
|
||||
match self.layout.variants {
|
||||
Variants::Single { index } => {
|
||||
assert_eq!(index, variant_index);
|
||||
assert_eq!(index.unwrap(), variant_index);
|
||||
}
|
||||
Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } => {
|
||||
let ptr = self.project_field(bx, tag_field);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue