@@ -240,13 +240,13 @@ fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
240240
241241fn mir_validated (
242242 tcx : TyCtxt < ' tcx > ,
243- def_id : DefId ,
243+ def_id : LocalDefId ,
244244) -> ( & ' tcx Steal < Body < ' tcx > > , & ' tcx Steal < IndexVec < Promoted , Body < ' tcx > > > ) {
245245 // Ensure that we compute the `mir_const_qualif` for constants at
246246 // this point, before we steal the mir-const result.
247- let _ = tcx. mir_const_qualif ( def_id) ;
247+ let _ = tcx. mir_const_qualif ( def_id. to_def_id ( ) ) ;
248248
249- let mut body = tcx. mir_const ( def_id) . steal ( ) ;
249+ let mut body = tcx. mir_const ( def_id. to_def_id ( ) ) . steal ( ) ;
250250
251251 let mut required_consts = Vec :: new ( ) ;
252252 let mut required_consts_visitor = RequiredConstsVisitor :: new ( & mut required_consts) ;
@@ -259,7 +259,7 @@ fn mir_validated(
259259 run_passes (
260260 tcx,
261261 & mut body,
262- InstanceDef :: Item ( def_id) ,
262+ InstanceDef :: Item ( def_id. to_def_id ( ) ) ,
263263 None ,
264264 MirPhase :: Validated ,
265265 & [ & [
@@ -276,7 +276,7 @@ fn mir_validated(
276276fn run_optimization_passes < ' tcx > (
277277 tcx : TyCtxt < ' tcx > ,
278278 body : & mut Body < ' tcx > ,
279- def_id : DefId ,
279+ def_id : LocalDefId ,
280280 promoted : Option < Promoted > ,
281281) {
282282 let post_borrowck_cleanup: & [ & dyn MirPass < ' tcx > ] = & [
@@ -349,7 +349,7 @@ fn run_optimization_passes<'tcx>(
349349 run_passes (
350350 tcx,
351351 body,
352- InstanceDef :: Item ( def_id) ,
352+ InstanceDef :: Item ( def_id. to_def_id ( ) ) ,
353353 promoted,
354354 MirPhase :: Optimized ,
355355 & [
@@ -369,9 +369,11 @@ fn optimized_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
369369 return shim:: build_adt_ctor ( tcx, def_id) ;
370370 }
371371
372+ let def_id = def_id. expect_local ( ) ;
373+
372374 // (Mir-)Borrowck uses `mir_validated`, so we have to force it to
373375 // execute before we can steal.
374- tcx. ensure ( ) . mir_borrowck ( def_id. expect_local ( ) ) ;
376+ tcx. ensure ( ) . mir_borrowck ( def_id) ;
375377
376378 let ( body, _) = tcx. mir_validated ( def_id) ;
377379 let mut body = body. steal ( ) ;
@@ -387,7 +389,9 @@ fn promoted_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &IndexVec<Promoted, Body<'_>>
387389 return tcx. intern_promoted ( IndexVec :: new ( ) ) ;
388390 }
389391
390- tcx. ensure ( ) . mir_borrowck ( def_id. expect_local ( ) ) ;
392+ let def_id = def_id. expect_local ( ) ;
393+
394+ tcx. ensure ( ) . mir_borrowck ( def_id) ;
391395 let ( _, promoted) = tcx. mir_validated ( def_id) ;
392396 let mut promoted = promoted. steal ( ) ;
393397
0 commit comments