@@ -46,6 +46,7 @@ pub(crate) fn provide(providers: &mut Providers<'_>) {
46
46
mir_const,
47
47
mir_const_qualif,
48
48
mir_validated,
49
+ mir_generator_interior,
49
50
optimized_mir,
50
51
is_mir_available,
51
52
promoted_mir,
@@ -98,7 +99,12 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
98
99
}
99
100
100
101
fn 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 ( ) ;
102
108
if let ty:: Generator ( ..) = tcx. type_of ( def_id) . kind {
103
109
let interior_types = generator:: generator_interior_tys ( tcx, def_id, & mir) ;
104
110
mir. generator_interior_tys = Some ( interior_types) ;
@@ -248,7 +254,7 @@ fn mir_validated(
248
254
// this point, before we steal the mir-const result.
249
255
let _ = tcx. mir_const_qualif ( def_id) ;
250
256
251
- let mut body = tcx. mir_const ( def_id) . steal ( ) ;
257
+ let mut body = tcx. mir_generator_interior ( def_id) . steal ( ) ;
252
258
let promote_pass = promote_consts:: PromoteTemps :: default ( ) ;
253
259
run_passes ( tcx, & mut body, InstanceDef :: Item ( def_id) , None , MirPhase :: Validated , & [
254
260
// What we need to run borrowck etc.
0 commit comments