about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_middle/query/mod.rs3
-rw-r--r--src/librustc_mir/borrow_check/mod.rs2
-rw-r--r--src/librustc_mir/transform/mod.rs20
3 files changed, 15 insertions, 10 deletions
diff --git a/src/librustc_middle/query/mod.rs b/src/librustc_middle/query/mod.rs
index 23a83a7a7e6..fbacda50b97 100644
--- a/src/librustc_middle/query/mod.rs
+++ b/src/librustc_middle/query/mod.rs
@@ -182,12 +182,13 @@ rustc_queries! {
             no_hash
         }
 
-        query mir_validated(_: DefId) ->
+        query mir_validated(key: LocalDefId) ->
             (
                 &'tcx Steal<mir::Body<'tcx>>,
                 &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
             ) {
             no_hash
+            desc { |tcx| "processing `{}`", tcx.def_path_str(key.to_def_id()) }
         }
 
         /// MIR after our optimization passes have run. This is MIR that is ready
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 21f988c9f3b..af5c392aa98 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -93,7 +93,7 @@ pub fn provide(providers: &mut Providers<'_>) {
 }
 
 fn mir_borrowck(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &BorrowCheckResult<'_> {
-    let (input_body, promoted) = tcx.mir_validated(def_id.to_def_id());
+    let (input_body, promoted) = tcx.mir_validated(def_id);
     debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id.to_def_id()));
 
     let opt_closure_req = tcx.infer_ctxt().enter(|infcx| {
diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs
index 17fbbbfdab7..9f63340065f 100644
--- a/src/librustc_mir/transform/mod.rs
+++ b/src/librustc_mir/transform/mod.rs
@@ -240,13 +240,13 @@ fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
 
 fn mir_validated(
     tcx: TyCtxt<'tcx>,
-    def_id: DefId,
+    def_id: LocalDefId,
 ) -> (&'tcx Steal<Body<'tcx>>, &'tcx Steal<IndexVec<Promoted, Body<'tcx>>>) {
     // Ensure that we compute the `mir_const_qualif` for constants at
     // this point, before we steal the mir-const result.
-    let _ = tcx.mir_const_qualif(def_id);
+    let _ = tcx.mir_const_qualif(def_id.to_def_id());
 
-    let mut body = tcx.mir_const(def_id).steal();
+    let mut body = tcx.mir_const(def_id.to_def_id()).steal();
 
     let mut required_consts = Vec::new();
     let mut required_consts_visitor = RequiredConstsVisitor::new(&mut required_consts);
@@ -259,7 +259,7 @@ fn mir_validated(
     run_passes(
         tcx,
         &mut body,
-        InstanceDef::Item(def_id),
+        InstanceDef::Item(def_id.to_def_id()),
         None,
         MirPhase::Validated,
         &[&[
@@ -276,7 +276,7 @@ fn mir_validated(
 fn run_optimization_passes<'tcx>(
     tcx: TyCtxt<'tcx>,
     body: &mut Body<'tcx>,
-    def_id: DefId,
+    def_id: LocalDefId,
     promoted: Option<Promoted>,
 ) {
     let post_borrowck_cleanup: &[&dyn MirPass<'tcx>] = &[
@@ -349,7 +349,7 @@ fn run_optimization_passes<'tcx>(
     run_passes(
         tcx,
         body,
-        InstanceDef::Item(def_id),
+        InstanceDef::Item(def_id.to_def_id()),
         promoted,
         MirPhase::Optimized,
         &[
@@ -369,9 +369,11 @@ fn optimized_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
         return shim::build_adt_ctor(tcx, def_id);
     }
 
+    let def_id = def_id.expect_local();
+
     // (Mir-)Borrowck uses `mir_validated`, so we have to force it to
     // execute before we can steal.
-    tcx.ensure().mir_borrowck(def_id.expect_local());
+    tcx.ensure().mir_borrowck(def_id);
 
     let (body, _) = tcx.mir_validated(def_id);
     let mut body = body.steal();
@@ -387,7 +389,9 @@ fn promoted_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &IndexVec<Promoted, Body<'_>>
         return tcx.intern_promoted(IndexVec::new());
     }
 
-    tcx.ensure().mir_borrowck(def_id.expect_local());
+    let def_id = def_id.expect_local();
+
+    tcx.ensure().mir_borrowck(def_id);
     let (_, promoted) = tcx.mir_validated(def_id);
     let mut promoted = promoted.steal();