File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -825,17 +825,13 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
825825 } ) ;
826826 ( present_variants. next ( ) , present_variants. next ( ) )
827827 } ;
828- let present_first = if present_first. is_none ( ) {
829- if def. is_enum ( ) {
830- // Uninhabited because it has no variants, or only absent ones.
831- return tcx. layout_raw ( param_env. and ( tcx. types . never ) ) ;
832- } else {
833- // if it's a struct, still compute a layout so that we can still compute the
834- // field offsets
835- Some ( VariantIdx :: new ( 0 ) )
836- }
837- } else {
838- present_first
828+ let present_first = match present_first {
829+ present_first @ Some ( _) => present_first,
830+ // Uninhabited because it has no variants, or only absent ones.
831+ None if def. is_enum ( ) => return tcx. layout_raw ( param_env. and ( tcx. types . never ) ) ,
832+ // if it's a struct, still compute a layout so that we can still compute the
833+ // field offsets
834+ None => Some ( VariantIdx :: new ( 0 ) ) ,
839835 } ;
840836
841837 let is_struct = !def. is_enum ( ) ||
You can’t perform that action at this time.
0 commit comments