1
1
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 } ;
4
3
use crate :: ty:: TyCtxt ;
5
4
6
5
use rustc_data_structures:: fx:: FxHashMap ;
@@ -19,20 +18,21 @@ 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 QueryStateImpl < ' 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 : for < ' a > Fn (
32
+ & ' a mut QueryStateShardImpl < ' tcx , K , Self :: Sharded > ,
33
+ ) -> & ' a mut Self :: Sharded ,
34
34
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 ;
36
36
37
37
fn complete (
38
38
& self ,
@@ -64,19 +64,20 @@ impl<K: Eq + Hash, V: Clone> QueryCache<K, V> for DefaultCache {
64
64
type Sharded = FxHashMap < K , ( V , DepNodeIndex ) > ;
65
65
66
66
#[ inline( always) ]
67
- fn lookup < ' tcx , R , GetCache , OnHit , OnMiss , Q > (
67
+ fn lookup < ' tcx , R , GetCache , OnHit , OnMiss > (
68
68
& self ,
69
- state : & ' tcx QueryState < ' tcx , Q > ,
69
+ state : & ' tcx QueryStateImpl < ' tcx , K , V , Self > ,
70
70
get_cache : GetCache ,
71
71
key : K ,
72
72
on_hit : OnHit ,
73
73
on_miss : OnMiss ,
74
74
) -> R
75
75
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 ,
78
79
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 ,
80
81
{
81
82
let mut lookup = state. get_lookup ( & key) ;
82
83
let lock = & mut * lookup. lock ;
0 commit comments