11use 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 } ;
43use crate :: ty:: TyCtxt ;
54
65use 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 ;
0 commit comments