@@ -536,24 +536,20 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
536
536
local : mir:: Local ,
537
537
layout : Option < TyAndLayout < ' tcx > > ,
538
538
) -> InterpResult < ' tcx , TyAndLayout < ' tcx > > {
539
- // `const_prop` runs into this with an invalid (empty) frame, so we
540
- // have to support that case (mostly by skipping all caching).
541
- match frame. locals . get ( local) . and_then ( |state| state. layout . get ( ) ) {
542
- None => {
543
- let layout = from_known_layout ( self . tcx , self . param_env , layout, || {
544
- let local_ty = frame. body . local_decls [ local] . ty ;
545
- let local_ty =
546
- self . subst_from_frame_and_normalize_erasing_regions ( frame, local_ty) ?;
547
- self . layout_of ( local_ty)
548
- } ) ?;
549
- if let Some ( state) = frame. locals . get ( local) {
550
- // Layouts of locals are requested a lot, so we cache them.
551
- state. layout . set ( Some ( layout) ) ;
552
- }
553
- Ok ( layout)
554
- }
555
- Some ( layout) => Ok ( layout) ,
539
+ let state = & frame. locals [ local] ;
540
+ if let Some ( layout) = state. layout . get ( ) {
541
+ return Ok ( layout) ;
556
542
}
543
+
544
+ let layout = from_known_layout ( self . tcx , self . param_env , layout, || {
545
+ let local_ty = frame. body . local_decls [ local] . ty ;
546
+ let local_ty = self . subst_from_frame_and_normalize_erasing_regions ( frame, local_ty) ?;
547
+ self . layout_of ( local_ty)
548
+ } ) ?;
549
+
550
+ // Layouts of locals are requested a lot, so we cache them.
551
+ state. layout . set ( Some ( layout) ) ;
552
+ Ok ( layout)
557
553
}
558
554
559
555
/// Returns the actual dynamic size and alignment of the place at the given type.
0 commit comments