@@ -916,7 +916,15 @@ fn compute_layout<'tcx>(
916
916
let mut tys = IndexVec :: < GeneratorSavedLocal , _ > :: new ( ) ;
917
917
for ( saved_local, local) in saved_locals. iter_enumerated ( ) {
918
918
locals. push ( local) ;
919
- tys. push ( body. local_decls [ local] . ty ) ;
919
+ let decl = & body. local_decls [ local] ;
920
+ let decl = GeneratorSavedTy {
921
+ ty : decl. ty ,
922
+ source_info : decl. source_info ,
923
+ is_static_ptr : decl. internal
924
+ && decl. ty . is_unsafe_ptr ( )
925
+ && matches ! ( decl. local_info. as_deref( ) , Some ( LocalInfo :: StaticRef { .. } ) ) ,
926
+ } ;
927
+ tys. push ( decl) ;
920
928
debug ! ( "generator saved local {:?} => {:?}" , saved_local, local) ;
921
929
}
922
930
@@ -947,7 +955,7 @@ fn compute_layout<'tcx>(
947
955
// just use the first one here. That's fine; fields do not move
948
956
// around inside generators, so it doesn't matter which variant
949
957
// index we access them by.
950
- remap. entry ( locals[ saved_local] ) . or_insert ( ( tys[ saved_local] , variant_index, idx) ) ;
958
+ remap. entry ( locals[ saved_local] ) . or_insert ( ( tys[ saved_local] . ty , variant_index, idx) ) ;
951
959
}
952
960
variant_fields. push ( fields) ;
953
961
variant_source_info. push ( source_info_at_suspension_points[ suspension_point_idx] ) ;
@@ -957,6 +965,7 @@ fn compute_layout<'tcx>(
957
965
958
966
let layout =
959
967
GeneratorLayout { field_tys : tys, variant_fields, variant_source_info, storage_conflicts } ;
968
+ debug ! ( ?layout) ;
960
969
961
970
( remap, layout, storage_liveness)
962
971
}
0 commit comments