about summary refs log tree commit diff
path: root/compiler/rustc_query_system/src/query
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2020-12-26 16:36:55 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-02-20 22:53:46 +0100
commit0144d6a3b7e2f2bba4c7cc9adc04c2b6e4e01b93 (patch)
tree4c62d947153b9d07ab6891cdc4c37d50129d021e /compiler/rustc_query_system/src/query
parentf96e960ccfa92895217562ede43043405194eab0 (diff)
downloadrust-0144d6a3b7e2f2bba4c7cc9adc04c2b6e4e01b93.tar.gz
rust-0144d6a3b7e2f2bba4c7cc9adc04c2b6e4e01b93.zip
Do not hold query key in Query.
Diffstat (limited to 'compiler/rustc_query_system/src/query')
-rw-r--r--compiler/rustc_query_system/src/query/config.rs4
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs7
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_query_system/src/query/config.rs b/compiler/rustc_query_system/src/query/config.rs
index 3873b47d4d4..8239f347923 100644
--- a/compiler/rustc_query_system/src/query/config.rs
+++ b/compiler/rustc_query_system/src/query/config.rs
@@ -73,7 +73,9 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
     type Cache: QueryCache<Key = Self::Key, Stored = Self::Stored, Value = Self::Value>;
 
     // Don't use this method to access query results, instead use the methods on TyCtxt
-    fn query_state<'a>(tcx: CTX) -> &'a QueryState<CTX::DepKind, CTX::Query, Self::Key>;
+    fn query_state<'a>(tcx: CTX) -> &'a QueryState<CTX::DepKind, CTX::Query, Self::Key>
+    where
+        CTX: 'a;
 
     // Don't use this method to access query results, instead use the methods on TyCtxt
     fn query_cache<'a>(tcx: CTX) -> &'a QueryCacheStore<Self::Cache>
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index fdc73dcc540..dbe7c4c2320 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -119,10 +119,11 @@ where
         shards.iter().all(|shard| shard.active.is_empty())
     }
 
-    pub fn try_collect_active_jobs(
+    pub fn try_collect_active_jobs<CTX: Copy>(
         &self,
+        tcx: CTX,
         kind: D,
-        make_query: fn(K) -> Q,
+        make_query: fn(CTX, K) -> Q,
         jobs: &mut QueryMap<D, Q>,
     ) -> Option<()> {
         // We use try_lock_shards here since we are called from the
@@ -133,7 +134,7 @@ where
             shard.active.iter().filter_map(move |(k, v)| {
                 if let QueryResult::Started(ref job) = *v {
                     let id = QueryJobId::new(job.id, shard_id, kind);
-                    let info = QueryInfo { span: job.span, query: make_query(k.clone()) };
+                    let info = QueryInfo { span: job.span, query: make_query(tcx, k.clone()) };
                     Some((id, QueryJobInfo { info, job: job.clone() }))
                 } else {
                     None