@@ -46,6 +46,7 @@ pub(crate) fn provide(providers: &mut Providers<'_>) {
4646 mir_const,
4747 mir_const_qualif,
4848 mir_validated,
49+ mir_generator_interior,
4950 optimized_mir,
5051 is_mir_available,
5152 promoted_mir,
@@ -98,7 +99,12 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
9899}
99100
100101fn mir_built ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> & Steal < BodyCache < ' _ > > {
101- let mut mir = build:: mir_build ( tcx, def_id) ;
102+ let mir = build:: mir_build ( tcx, def_id) ;
103+ tcx. alloc_steal_mir ( mir)
104+ }
105+
106+ fn mir_generator_interior ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> & Steal < BodyCache < ' _ > > {
107+ let mut mir = tcx. mir_const ( def_id) . steal ( ) ;
102108 if let ty:: Generator ( ..) = tcx. type_of ( def_id) . kind {
103109 let interior_types = generator:: generator_interior_tys ( tcx, def_id, & mir) ;
104110 mir. generator_interior_tys = Some ( interior_types) ;
@@ -248,7 +254,7 @@ fn mir_validated(
248254 // this point, before we steal the mir-const result.
249255 let _ = tcx. mir_const_qualif ( def_id) ;
250256
251- let mut body = tcx. mir_const ( def_id) . steal ( ) ;
257+ let mut body = tcx. mir_generator_interior ( def_id) . steal ( ) ;
252258 let promote_pass = promote_consts:: PromoteTemps :: default ( ) ;
253259 run_passes ( tcx, & mut body, InstanceDef :: Item ( def_id) , None , MirPhase :: Validated , & [
254260 // What we need to run borrowck etc.
0 commit comments