summary refs log tree commit diff
path: root/compiler/rustc_query_system/src/cache.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2020-10-11 10:34:50 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2021-02-19 17:51:49 +0100
commit211b05aef3d71fab0df7aa2f9616286a693a5cd7 (patch)
treee94d4e8bf3a054b84b4eba96c0724cb025c24ee1 /compiler/rustc_query_system/src/cache.rs
parent7794fbb47839ed0749647be343c4e52e6564123b (diff)
downloadrust-211b05aef3d71fab0df7aa2f9616286a693a5cd7.tar.gz
rust-211b05aef3d71fab0df7aa2f9616286a693a5cd7.zip
Don't require a QueryContext to access the DepGraph.
Diffstat (limited to 'compiler/rustc_query_system/src/cache.rs')
-rw-r--r--compiler/rustc_query_system/src/cache.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_query_system/src/cache.rs b/compiler/rustc_query_system/src/cache.rs
index be3d3607728..c6dc7b4fe28 100644
--- a/compiler/rustc_query_system/src/cache.rs
+++ b/compiler/rustc_query_system/src/cache.rs
@@ -1,7 +1,6 @@
 //! Cache for candidate selection.
 
-use crate::dep_graph::DepNodeIndex;
-use crate::query::QueryContext;
+use crate::dep_graph::{DepContext, DepNodeIndex};
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::sync::HashMapExt;
@@ -28,7 +27,7 @@ impl<Key, Value> Cache<Key, Value> {
 }
 
 impl<Key: Eq + Hash, Value: Clone> Cache<Key, Value> {
-    pub fn get<CTX: QueryContext>(&self, key: &Key, tcx: CTX) -> Option<Value> {
+    pub fn get<CTX: DepContext>(&self, key: &Key, tcx: CTX) -> Option<Value> {
         Some(self.hashmap.borrow().get(key)?.get(tcx))
     }
 
@@ -55,7 +54,7 @@ impl<T: Clone> WithDepNode<T> {
         WithDepNode { dep_node, cached_value }
     }
 
-    pub fn get<CTX: QueryContext>(&self, tcx: CTX) -> T {
+    pub fn get<CTX: DepContext>(&self, tcx: CTX) -> T {
         tcx.dep_graph().read_index(self.dep_node);
         self.cached_value.clone()
     }