@@ -238,13 +238,13 @@ fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
238238
239239fn mir_validated (
240240 tcx : TyCtxt < ' tcx > ,
241- def_id : DefId ,
241+ def_id : LocalDefId ,
242242) -> ( & ' tcx Steal < Body < ' tcx > > , & ' tcx Steal < IndexVec < Promoted , Body < ' tcx > > > ) {
243243 // Ensure that we compute the `mir_const_qualif` for constants at
244244 // this point, before we steal the mir-const result.
245- let _ = tcx. mir_const_qualif ( def_id) ;
245+ let _ = tcx. mir_const_qualif ( def_id. to_def_id ( ) ) ;
246246
247- let mut body = tcx. mir_const ( def_id) . steal ( ) ;
247+ let mut body = tcx. mir_const ( def_id. to_def_id ( ) ) . steal ( ) ;
248248
249249 let mut required_consts = Vec :: new ( ) ;
250250 let mut required_consts_visitor = RequiredConstsVisitor :: new ( & mut required_consts) ;
@@ -257,7 +257,7 @@ fn mir_validated(
257257 run_passes (
258258 tcx,
259259 & mut body,
260- InstanceDef :: Item ( def_id) ,
260+ InstanceDef :: Item ( def_id. to_def_id ( ) ) ,
261261 None ,
262262 MirPhase :: Validated ,
263263 & [
@@ -274,13 +274,13 @@ fn mir_validated(
274274fn run_optimization_passes < ' tcx > (
275275 tcx : TyCtxt < ' tcx > ,
276276 body : & mut Body < ' tcx > ,
277- def_id : DefId ,
277+ def_id : LocalDefId ,
278278 promoted : Option < Promoted > ,
279279) {
280280 run_passes (
281281 tcx,
282282 body,
283- InstanceDef :: Item ( def_id) ,
283+ InstanceDef :: Item ( def_id. to_def_id ( ) ) ,
284284 promoted,
285285 MirPhase :: Optimized ,
286286 & [
@@ -338,9 +338,11 @@ fn optimized_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
338338 return shim:: build_adt_ctor ( tcx, def_id) ;
339339 }
340340
341+ let def_id = def_id. expect_local ( ) ;
342+
341343 // (Mir-)Borrowck uses `mir_validated`, so we have to force it to
342344 // execute before we can steal.
343- tcx. ensure ( ) . mir_borrowck ( def_id. expect_local ( ) ) ;
345+ tcx. ensure ( ) . mir_borrowck ( def_id) ;
344346
345347 let ( body, _) = tcx. mir_validated ( def_id) ;
346348 let mut body = body. steal ( ) ;
@@ -356,7 +358,9 @@ fn promoted_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &IndexVec<Promoted, Body<'_>>
356358 return tcx. intern_promoted ( IndexVec :: new ( ) ) ;
357359 }
358360
359- tcx. ensure ( ) . mir_borrowck ( def_id. expect_local ( ) ) ;
361+ let def_id = def_id. expect_local ( ) ;
362+
363+ tcx. ensure ( ) . mir_borrowck ( def_id) ;
360364 let ( _, promoted) = tcx. mir_validated ( def_id) ;
361365 let mut promoted = promoted. steal ( ) ;
362366
0 commit comments