1
1
use crate :: dep_graph:: DepNodeIndex ;
2
- use crate :: ty:: query:: config:: QueryAccessors ;
3
2
use crate :: ty:: query:: plumbing:: { QueryLookup , QueryState , QueryStateShard } ;
4
3
use crate :: ty:: TyCtxt ;
5
4
@@ -19,20 +18,20 @@ pub(crate) trait QueryCache<K, V>: Default {
19
18
/// It returns the shard index and a lock guard to the shard,
20
19
/// which will be used if the query is not in the cache and we need
21
20
/// to compute it.
22
- fn lookup < ' tcx , R , GetCache , OnHit , OnMiss , Q > (
21
+ fn lookup < ' tcx , R , GetCache , OnHit , OnMiss > (
23
22
& self ,
24
- state : & ' tcx QueryState < ' tcx , Q > ,
23
+ state : & ' tcx QueryState < ' tcx , K , V , Self > ,
25
24
get_cache : GetCache ,
26
25
key : K ,
27
26
// `on_hit` can be called while holding a lock to the query state shard.
28
27
on_hit : OnHit ,
29
28
on_miss : OnMiss ,
30
29
) -> R
31
30
where
32
- Q : QueryAccessors < ' tcx > ,
33
- GetCache : for < ' a > Fn ( & ' a mut QueryStateShard < ' tcx , Q > ) -> & ' a mut Self :: Sharded ,
31
+ GetCache :
32
+ for < ' a > Fn ( & ' a mut QueryStateShard < ' tcx , K , Self :: Sharded > ) -> & ' a mut Self :: Sharded ,
34
33
OnHit : FnOnce ( & V , DepNodeIndex ) -> R ,
35
- OnMiss : FnOnce ( K , QueryLookup < ' tcx , Q > ) -> R ;
34
+ OnMiss : FnOnce ( K , QueryLookup < ' tcx , K , Self :: Sharded > ) -> R ;
36
35
37
36
fn complete (
38
37
& self ,
@@ -64,19 +63,19 @@ impl<K: Eq + Hash, V: Clone> QueryCache<K, V> for DefaultCache {
64
63
type Sharded = FxHashMap < K , ( V , DepNodeIndex ) > ;
65
64
66
65
#[ inline( always) ]
67
- fn lookup < ' tcx , R , GetCache , OnHit , OnMiss , Q > (
66
+ fn lookup < ' tcx , R , GetCache , OnHit , OnMiss > (
68
67
& self ,
69
- state : & ' tcx QueryState < ' tcx , Q > ,
68
+ state : & ' tcx QueryState < ' tcx , K , V , Self > ,
70
69
get_cache : GetCache ,
71
70
key : K ,
72
71
on_hit : OnHit ,
73
72
on_miss : OnMiss ,
74
73
) -> R
75
74
where
76
- Q : QueryAccessors < ' tcx > ,
77
- GetCache : for < ' a > Fn ( & ' a mut QueryStateShard < ' tcx , Q > ) -> & ' a mut Self :: Sharded ,
75
+ GetCache :
76
+ for < ' a > Fn ( & ' a mut QueryStateShard < ' tcx , K , Self :: Sharded > ) -> & ' a mut Self :: Sharded ,
78
77
OnHit : FnOnce ( & V , DepNodeIndex ) -> R ,
79
- OnMiss : FnOnce ( K , QueryLookup < ' tcx , Q > ) -> R ,
78
+ OnMiss : FnOnce ( K , QueryLookup < ' tcx , K , Self :: Sharded > ) -> R ,
80
79
{
81
80
let mut lookup = state. get_lookup ( & key) ;
82
81
let lock = & mut * lookup. lock ;
0 commit comments