Skip to content

Commit fa02dca

Browse files
committed
Remove Q parameter from QueryCache::lookup.
1 parent a0f57e2 commit fa02dca

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/librustc/ty/query/caches.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::dep_graph::DepNodeIndex;
2-
use crate::ty::query::config::QueryAccessors;
3-
use crate::ty::query::plumbing::{QueryLookup, QueryState, QueryStateShard};
2+
use crate::ty::query::plumbing::{QueryLookupImpl, QueryStateImpl, QueryStateShardImpl};
43
use crate::ty::TyCtxt;
54

65
use rustc_data_structures::fx::FxHashMap;
@@ -19,20 +18,21 @@ pub(crate) trait QueryCache<K, V>: Default {
1918
/// It returns the shard index and a lock guard to the shard,
2019
/// which will be used if the query is not in the cache and we need
2120
/// to compute it.
22-
fn lookup<'tcx, R, GetCache, OnHit, OnMiss, Q>(
21+
fn lookup<'tcx, R, GetCache, OnHit, OnMiss>(
2322
&self,
24-
state: &'tcx QueryState<'tcx, Q>,
23+
state: &'tcx QueryStateImpl<'tcx, K, V, Self>,
2524
get_cache: GetCache,
2625
key: K,
2726
// `on_hit` can be called while holding a lock to the query state shard.
2827
on_hit: OnHit,
2928
on_miss: OnMiss,
3029
) -> R
3130
where
32-
Q: QueryAccessors<'tcx>,
33-
GetCache: for<'a> Fn(&'a mut QueryStateShard<'tcx, Q>) -> &'a mut Self::Sharded,
31+
GetCache: for<'a> Fn(
32+
&'a mut QueryStateShardImpl<'tcx, K, Self::Sharded>,
33+
) -> &'a mut Self::Sharded,
3434
OnHit: FnOnce(&V, DepNodeIndex) -> R,
35-
OnMiss: FnOnce(K, QueryLookup<'tcx, Q>) -> R;
35+
OnMiss: FnOnce(K, QueryLookupImpl<'tcx, QueryStateShardImpl<'tcx, K, Self::Sharded>>) -> R;
3636

3737
fn complete(
3838
&self,
@@ -64,19 +64,20 @@ impl<K: Eq + Hash, V: Clone> QueryCache<K, V> for DefaultCache {
6464
type Sharded = FxHashMap<K, (V, DepNodeIndex)>;
6565

6666
#[inline(always)]
67-
fn lookup<'tcx, R, GetCache, OnHit, OnMiss, Q>(
67+
fn lookup<'tcx, R, GetCache, OnHit, OnMiss>(
6868
&self,
69-
state: &'tcx QueryState<'tcx, Q>,
69+
state: &'tcx QueryStateImpl<'tcx, K, V, Self>,
7070
get_cache: GetCache,
7171
key: K,
7272
on_hit: OnHit,
7373
on_miss: OnMiss,
7474
) -> R
7575
where
76-
Q: QueryAccessors<'tcx>,
77-
GetCache: for<'a> Fn(&'a mut QueryStateShard<'tcx, Q>) -> &'a mut Self::Sharded,
76+
GetCache: for<'a> Fn(
77+
&'a mut QueryStateShardImpl<'tcx, K, Self::Sharded>,
78+
) -> &'a mut Self::Sharded,
7879
OnHit: FnOnce(&V, DepNodeIndex) -> R,
79-
OnMiss: FnOnce(K, QueryLookup<'tcx, Q>) -> R,
80+
OnMiss: FnOnce(K, QueryLookupImpl<'tcx, QueryStateShardImpl<'tcx, K, Self::Sharded>>) -> R,
8081
{
8182
let mut lookup = state.get_lookup(&key);
8283
let lock = &mut *lookup.lock;

src/librustc/ty/query/plumbing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ impl<'tcx> TyCtxt<'tcx> {
449449
{
450450
let state = Q::query_state(self);
451451

452-
state.cache.lookup::<_, _, _, _, Q>(
452+
state.cache.lookup(
453453
state,
454454
QueryStateShard::<Q>::get_cache,
455455
key,

0 commit comments

Comments
 (0)