Do not hold query key in Query.

This commit is contained in:
Camille GILLOT 2020-12-26 16:36:55 +01:00
parent f96e960ccf
commit 0144d6a3b7
4 changed files with 70 additions and 59 deletions

View file

@ -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>

View file

@ -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