@@ -382,7 +382,7 @@ pub trait LayoutCalculator {
382
382
* offset += this_offset;
383
383
}
384
384
}
385
- _ => {
385
+ FieldsShape :: Primitive | FieldsShape :: Array { .. } | FieldsShape :: Union ( .. ) => {
386
386
panic ! ( "Layout of fields should be Arbitrary for variants" )
387
387
}
388
388
}
@@ -600,7 +600,9 @@ pub trait LayoutCalculator {
600
600
variant. size = new_ity_size;
601
601
}
602
602
}
603
- _ => panic ! ( ) ,
603
+ FieldsShape :: Primitive | FieldsShape :: Array { .. } | FieldsShape :: Union ( ..) => {
604
+ panic ! ( "encountered a non-arbitrary layout during enum layout" )
605
+ }
604
606
}
605
607
}
606
608
}
@@ -628,7 +630,7 @@ pub trait LayoutCalculator {
628
630
let mut common_prim_initialized_in_all_variants = true ;
629
631
for ( field_layouts, layout_variant) in iter:: zip ( variants, & layout_variants) {
630
632
let FieldsShape :: Arbitrary { ref offsets, .. } = layout_variant. fields else {
631
- panic ! ( ) ;
633
+ panic ! ( "encountered a non-arbitrary layout during enum layout" ) ;
632
634
} ;
633
635
// We skip *all* ZST here and later check if we are good in terms of alignment.
634
636
// This lets us handle some cases involving aligned ZST.
@@ -681,7 +683,7 @@ pub trait LayoutCalculator {
681
683
assert_eq ! ( memory_index. raw, [ 0 , 1 ] ) ;
682
684
offsets
683
685
}
684
- _ => panic ! ( ) ,
686
+ _ => panic ! ( "encountered a non-arbitrary layout during enum layout" ) ,
685
687
} ;
686
688
if pair_offsets[ FieldIdx :: new ( 0 ) ] == Size :: ZERO
687
689
&& pair_offsets[ FieldIdx :: new ( 1 ) ] == * offset
@@ -758,7 +760,9 @@ pub trait LayoutCalculator {
758
760
Variants :: Multiple { tag, tag_encoding, tag_field, .. } => {
759
761
Variants :: Multiple { tag, tag_encoding, tag_field, variants : best_layout. variants }
760
762
}
761
- _ => panic ! ( ) ,
763
+ Variants :: Single { .. } => {
764
+ panic ! ( "encountered a single-variant enum during multi-variant layout" )
765
+ }
762
766
} ;
763
767
Some ( best_layout. layout )
764
768
}
@@ -1154,7 +1158,11 @@ fn univariant<
1154
1158
assert_eq ! ( memory_index. raw, [ 0 , 1 ] ) ;
1155
1159
offsets
1156
1160
}
1157
- _ => panic ! ( ) ,
1161
+ FieldsShape :: Primitive
1162
+ | FieldsShape :: Array { .. }
1163
+ | FieldsShape :: Union ( ..) => {
1164
+ panic ! ( "encountered a non-arbitrary layout during enum layout" )
1165
+ }
1158
1166
} ;
1159
1167
if offsets[ i] == pair_offsets[ FieldIdx :: new ( 0 ) ]
1160
1168
&& offsets[ j] == pair_offsets[ FieldIdx :: new ( 1 ) ]
0 commit comments