@@ -240,13 +240,13 @@ fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
240
240
241
241
fn mir_validated (
242
242
tcx : TyCtxt < ' tcx > ,
243
- def_id : DefId ,
243
+ def_id : LocalDefId ,
244
244
) -> ( & ' tcx Steal < Body < ' tcx > > , & ' tcx Steal < IndexVec < Promoted , Body < ' tcx > > > ) {
245
245
// Ensure that we compute the `mir_const_qualif` for constants at
246
246
// 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 ( ) ) ;
248
248
249
- let mut body = tcx. mir_const ( def_id) . steal ( ) ;
249
+ let mut body = tcx. mir_const ( def_id. to_def_id ( ) ) . steal ( ) ;
250
250
251
251
let mut required_consts = Vec :: new ( ) ;
252
252
let mut required_consts_visitor = RequiredConstsVisitor :: new ( & mut required_consts) ;
@@ -259,7 +259,7 @@ fn mir_validated(
259
259
run_passes (
260
260
tcx,
261
261
& mut body,
262
- InstanceDef :: Item ( def_id) ,
262
+ InstanceDef :: Item ( def_id. to_def_id ( ) ) ,
263
263
None ,
264
264
MirPhase :: Validated ,
265
265
& [ & [
@@ -276,7 +276,7 @@ fn mir_validated(
276
276
fn run_optimization_passes < ' tcx > (
277
277
tcx : TyCtxt < ' tcx > ,
278
278
body : & mut Body < ' tcx > ,
279
- def_id : DefId ,
279
+ def_id : LocalDefId ,
280
280
promoted : Option < Promoted > ,
281
281
) {
282
282
let post_borrowck_cleanup: & [ & dyn MirPass < ' tcx > ] = & [
@@ -349,7 +349,7 @@ fn run_optimization_passes<'tcx>(
349
349
run_passes (
350
350
tcx,
351
351
body,
352
- InstanceDef :: Item ( def_id) ,
352
+ InstanceDef :: Item ( def_id. to_def_id ( ) ) ,
353
353
promoted,
354
354
MirPhase :: Optimized ,
355
355
& [
@@ -369,9 +369,11 @@ fn optimized_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
369
369
return shim:: build_adt_ctor ( tcx, def_id) ;
370
370
}
371
371
372
+ let def_id = def_id. expect_local ( ) ;
373
+
372
374
// (Mir-)Borrowck uses `mir_validated`, so we have to force it to
373
375
// execute before we can steal.
374
- tcx. ensure ( ) . mir_borrowck ( def_id. expect_local ( ) ) ;
376
+ tcx. ensure ( ) . mir_borrowck ( def_id) ;
375
377
376
378
let ( body, _) = tcx. mir_validated ( def_id) ;
377
379
let mut body = body. steal ( ) ;
@@ -387,7 +389,9 @@ fn promoted_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &IndexVec<Promoted, Body<'_>>
387
389
return tcx. intern_promoted ( IndexVec :: new ( ) ) ;
388
390
}
389
391
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) ;
391
395
let ( _, promoted) = tcx. mir_validated ( def_id) ;
392
396
let mut promoted = promoted. steal ( ) ;
393
397
0 commit comments