44
55use crate :: dep_graph:: { DepNode , DepNodeIndex , SerializedDepNodeIndex } ;
66use crate :: ty:: query:: caches:: QueryCache ;
7- use crate :: ty:: query:: config:: { QueryAccessors , QueryDescription } ;
7+ use crate :: ty:: query:: config:: { QueryAccessors , QueryConfig , QueryDescription } ;
88use crate :: ty:: query:: job:: { QueryInfo , QueryJob , QueryJobId , QueryShardJobId } ;
99use crate :: ty:: query:: Query ;
1010use crate :: ty:: tls;
@@ -27,25 +27,32 @@ use std::ptr;
2727#[ cfg( debug_assertions) ]
2828use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
2929
30- pub ( crate ) struct QueryStateShard < ' tcx , D : QueryAccessors < ' tcx > + ?Sized > {
31- pub ( super ) cache : <<D as QueryAccessors < ' tcx > >:: Cache as QueryCache < D :: Key , D :: Value > >:: Sharded ,
32- pub ( super ) active : FxHashMap < D :: Key , QueryResult < ' tcx > > ,
30+ pub ( crate ) type QueryStateShard < ' tcx , Q > = QueryStateShardImpl <
31+ ' tcx ,
32+ <Q as QueryConfig < ' tcx > >:: Key ,
33+ <<Q as QueryAccessors < ' tcx > >:: Cache as QueryCache <
34+ <Q as QueryConfig < ' tcx > >:: Key ,
35+ <Q as QueryConfig < ' tcx > >:: Value ,
36+ > >:: Sharded ,
37+ > ;
38+
39+ pub ( crate ) struct QueryStateShardImpl < ' tcx , K , C > {
40+ pub ( super ) cache : C ,
41+ pub ( super ) active : FxHashMap < K , QueryResult < ' tcx > > ,
3342
3443 /// Used to generate unique ids for active jobs.
3544 pub ( super ) jobs : u32 ,
3645}
3746
38- impl < ' tcx , Q : QueryAccessors < ' tcx > > QueryStateShard < ' tcx , Q > {
39- fn get_cache (
40- & mut self ,
41- ) -> & mut <<Q as QueryAccessors < ' tcx > >:: Cache as QueryCache < Q :: Key , Q :: Value > >:: Sharded {
47+ impl < ' tcx , K , C > QueryStateShardImpl < ' tcx , K , C > {
48+ fn get_cache ( & mut self ) -> & mut C {
4249 & mut self . cache
4350 }
4451}
4552
46- impl < ' tcx , Q : QueryAccessors < ' tcx > > Default for QueryStateShard < ' tcx , Q > {
47- fn default ( ) -> QueryStateShard < ' tcx , Q > {
48- QueryStateShard { cache : Default :: default ( ) , active : Default :: default ( ) , jobs : 0 }
53+ impl < ' tcx , K , C : Default > Default for QueryStateShardImpl < ' tcx , K , C > {
54+ fn default ( ) -> QueryStateShardImpl < ' tcx , K , C > {
55+ QueryStateShardImpl { cache : Default :: default ( ) , active : Default :: default ( ) , jobs : 0 }
4956 }
5057}
5158
0 commit comments