about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-03-09 07:30:15 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-03-09 08:00:40 +0100
commit62e4bcb168b354b5780e2a0abc02b61e6a4efee3 (patch)
treea0c0edb857bbf3d978362e5552069e6f721c30a7
parent60ed37c2e16a9b426f84501a9ae4a5f22741816c (diff)
downloadrust-62e4bcb168b354b5780e2a0abc02b61e6a4efee3.tar.gz
rust-62e4bcb168b354b5780e2a0abc02b61e6a4efee3.zip
Address comments
-rw-r--r--compiler/rustc_query_system/src/dep_graph/graph.rs4
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs26
2 files changed, 14 insertions, 16 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs
index 2c5f84b2c5c..0fe1ddc1235 100644
--- a/compiler/rustc_query_system/src/dep_graph/graph.rs
+++ b/compiler/rustc_query_system/src/dep_graph/graph.rs
@@ -250,7 +250,7 @@ impl<K: DepKind> DepGraph<K> {
     /// in the query infrastructure, and is not currently needed by the
     /// decoding of any query results. Should the need arise in the future,
     /// we should consider extending the query system with this functionality.
-    pub fn with_query_deserialization<OP, R>(op: OP) -> R
+    pub fn with_query_deserialization<OP, R>(&self, op: OP) -> R
     where
         OP: FnOnce() -> R,
     {
@@ -881,7 +881,7 @@ impl<K: DepKind> DepGraphData<K> {
         );
 
         if !side_effects.is_empty() {
-            DepGraph::<K>::with_query_deserialization(|| {
+            qcx.dep_context().dep_graph().with_query_deserialization(|| {
                 self.emit_side_effects(qcx, dep_node_index, side_effects)
             });
         }
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index 87648180690..7b9e0c3a0a6 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -2,9 +2,7 @@
 //! generate the actual methods on tcx which find and execute the provider,
 //! manage the caches, and so forth.
 
-use crate::dep_graph::{
-    DepContext, DepGraph, DepKind, DepNode, DepNodeIndex, DepNodeParams, TaskDepsRef,
-};
+use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeIndex, DepNodeParams};
 use crate::dep_graph::{DepGraphData, HasDepContext};
 use crate::ich::StableHashingContext;
 use crate::query::caches::QueryCache;
@@ -430,13 +428,12 @@ where
 
             // Similarly, fingerprint the result to assert that
             // it doesn't have anything not considered hashable.
-            if cfg!(debug_assertions)
-            && let Some(hash_result) = query.hash_result()
-          {
-            qcx.dep_context().with_stable_hashing_context(|mut hcx| {
-                hash_result(&mut hcx, &result);
-            });
-        }
+            if cfg!(debug_assertions) && let Some(hash_result) = query.hash_result()
+            {
+                qcx.dep_context().with_stable_hashing_context(|mut hcx| {
+                    hash_result(&mut hcx, &result);
+                });
+            }
 
             return (result, dep_node_index);
         }
@@ -524,9 +521,10 @@ where
         // The call to `with_query_deserialization` enforces that no new `DepNodes`
         // are created during deserialization. See the docs of that method for more
         // details.
-        let result = DepGraph::<Qcx::DepKind>::with_query_deserialization(|| {
-            try_load_from_disk(qcx, prev_dep_node_index)
-        });
+        let result = qcx
+            .dep_context()
+            .dep_graph()
+            .with_query_deserialization(|| try_load_from_disk(qcx, prev_dep_node_index));
 
         prof_timer.finish_with_query_invocation_id(dep_node_index.into());
 
@@ -575,7 +573,7 @@ where
     let prof_timer = qcx.dep_context().profiler().query_provider();
 
     // The dep-graph for this computation is already in-place.
-    let result = Qcx::DepKind::with_deps(TaskDepsRef::Ignore, || query.compute(qcx, *key));
+    let result = qcx.dep_context().dep_graph().with_ignore(|| query.compute(qcx, *key));
 
     prof_timer.finish_with_query_invocation_id(dep_node_index.into());