about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-01-19 18:24:08 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-02-19 17:51:56 +0100
commit1ac21e4571320c24e62044fabbcdb8886f45e375 (patch)
treeb211fec03f3962fa62f26435320ea69fd6658ff1
parentb27266fdb20dd6f6d58428bcf15771dbaeb18d01 (diff)
downloadrust-1ac21e4571320c24e62044fabbcdb8886f45e375.tar.gz
rust-1ac21e4571320c24e62044fabbcdb8886f45e375.zip
Use QueryCtxt in DepKindStruct.
-rw-r--r--compiler/rustc_middle/src/dep_graph/dep_node.rs13
-rw-r--r--compiler/rustc_middle/src/ty/query/plumbing.rs4
2 files changed, 6 insertions, 11 deletions
diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs
index 823bcebe23b..063a57e484f 100644
--- a/compiler/rustc_middle/src/dep_graph/dep_node.rs
+++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs
@@ -135,7 +135,7 @@ pub struct DepKindStruct {
     /// then `force_from_dep_node()` should not fail for it. Otherwise, you can just
     /// add it to the "We don't have enough information to reconstruct..." group in
     /// the match below.
-    pub(crate) force_from_dep_node: fn(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool,
+    pub(crate) force_from_dep_node: fn(tcx: QueryCtxt<'_>, dep_node: &DepNode) -> bool,
 
     /// Invoke a query to put the on-disk cached value in memory.
     pub(crate) try_load_from_on_disk_cache: fn(QueryCtxt<'_>, &DepNode),
@@ -251,7 +251,7 @@ pub mod dep_kind {
                     <query_keys::$variant<'_> as DepNodeParams<TyCtxt<'_>>>::recover(tcx, dep_node)
                 }
 
-                fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool {
+                fn force_from_dep_node(tcx: QueryCtxt<'_>, dep_node: &DepNode) -> bool {
                     if is_anon {
                         return false;
                     }
@@ -260,13 +260,8 @@ pub mod dep_kind {
                         return false;
                     }
 
-                    if let Some(key) = recover(tcx, dep_node) {
-                        force_query::<queries::$variant<'_>, _>(
-                            QueryCtxt { tcx, queries: tcx.queries },
-                            key,
-                            DUMMY_SP,
-                            *dep_node
-                        );
+                    if let Some(key) = recover(*tcx, dep_node) {
+                        force_query::<queries::$variant<'_>, _>(tcx, key, DUMMY_SP, *dep_node);
                         return true;
                     }
 
diff --git a/compiler/rustc_middle/src/ty/query/plumbing.rs b/compiler/rustc_middle/src/ty/query/plumbing.rs
index 23eb7ce3248..66ed3adb65a 100644
--- a/compiler/rustc_middle/src/ty/query/plumbing.rs
+++ b/compiler/rustc_middle/src/ty/query/plumbing.rs
@@ -68,7 +68,7 @@ impl QueryContext for QueryCtxt<'tcx> {
         self.queries.try_collect_active_jobs()
     }
 
-    fn try_load_from_on_disk_cache(&self, dep_node: &dep_graph::DepNode) {
+    fn try_load_from_on_disk_cache(&self, dep_node: &DepNode) {
         (dep_node.kind.try_load_from_on_disk_cache)(*self, dep_node)
     }
 
@@ -126,7 +126,7 @@ impl QueryContext for QueryCtxt<'tcx> {
             "calling force_from_dep_node() on DepKind::codegen_unit"
         );
 
-        (dep_node.kind.force_from_dep_node)(**self, dep_node)
+        (dep_node.kind.force_from_dep_node)(*self, dep_node)
     }
 
     fn has_errors_or_delayed_span_bugs(&self) -> bool {