44
55use crate :: dep_graph:: { DepKind , DepNode , DepNodeIndex , SerializedDepNodeIndex } ;
66use crate :: ty:: query:: caches:: QueryCache ;
7- use crate :: ty:: query:: config:: { QueryAccessors , QueryDescription } ;
7+ use crate :: ty:: query:: config:: QueryDescription ;
88use crate :: ty:: query:: job:: { QueryInfo , QueryJob , QueryJobId , QueryJobInfo , QueryShardJobId } ;
99use crate :: ty:: query:: Query ;
1010use crate :: ty:: tls;
@@ -49,16 +49,14 @@ impl<'tcx, K, C: Default> Default for QueryStateShard<'tcx, K, C> {
4949 }
5050}
5151
52- pub ( crate ) type QueryState < ' tcx , Q > = QueryStateImpl < ' tcx , <Q as QueryAccessors < ' tcx > >:: Cache > ;
53-
54- pub ( crate ) struct QueryStateImpl < ' tcx , C : QueryCache > {
52+ pub ( crate ) struct QueryState < ' tcx , C : QueryCache > {
5553 pub ( super ) cache : C ,
5654 pub ( super ) shards : Sharded < QueryStateShard < ' tcx , C :: Key , C :: Sharded > > ,
5755 #[ cfg( debug_assertions) ]
5856 pub ( super ) cache_hits : AtomicUsize ,
5957}
6058
61- impl < ' tcx , C : QueryCache > QueryStateImpl < ' tcx , C > {
59+ impl < ' tcx , C : QueryCache > QueryState < ' tcx , C > {
6260 pub ( super ) fn get_lookup < K2 : Hash > (
6361 & ' tcx self ,
6462 key : & K2 ,
@@ -86,7 +84,7 @@ pub(super) enum QueryResult<'tcx> {
8684 Poisoned ,
8785}
8886
89- impl < ' tcx , C : QueryCache > QueryStateImpl < ' tcx , C > {
87+ impl < ' tcx , C : QueryCache > QueryState < ' tcx , C > {
9088 pub fn iter_results < R > (
9189 & self ,
9290 f : impl for < ' a > FnOnce (
@@ -131,9 +129,9 @@ impl<'tcx, C: QueryCache> QueryStateImpl<'tcx, C> {
131129 }
132130}
133131
134- impl < ' tcx , C : QueryCache > Default for QueryStateImpl < ' tcx , C > {
135- fn default ( ) -> QueryStateImpl < ' tcx , C > {
136- QueryStateImpl {
132+ impl < ' tcx , C : QueryCache > Default for QueryState < ' tcx , C > {
133+ fn default ( ) -> QueryState < ' tcx , C > {
134+ QueryState {
137135 cache : C :: default ( ) ,
138136 shards : Default :: default ( ) ,
139137 #[ cfg( debug_assertions) ]
@@ -157,7 +155,7 @@ where
157155 C :: Key : Eq + Hash + Clone + Debug ,
158156 C :: Value : Clone ,
159157{
160- state : & ' tcx QueryStateImpl < ' tcx , C > ,
158+ state : & ' tcx QueryState < ' tcx , C > ,
161159 key : C :: Key ,
162160 id : QueryJobId ,
163161}
@@ -478,7 +476,7 @@ impl<'tcx> TyCtxt<'tcx> {
478476 #[ inline( always) ]
479477 fn try_get_cached < C , R , OnHit , OnMiss > (
480478 self ,
481- state : & ' tcx QueryStateImpl < ' tcx , C > ,
479+ state : & ' tcx QueryState < ' tcx , C > ,
482480 key : C :: Key ,
483481 // `on_hit` can be called while holding a lock to the query cache
484482 on_hit : OnHit ,
@@ -994,7 +992,7 @@ macro_rules! define_queries_inner {
994992 type Cache = query_storage!( [ $( $modifiers) * ] [ $K, $V] ) ;
995993
996994 #[ inline( always) ]
997- fn query_state<' a>( tcx: TyCtxt <$tcx>) -> & ' a QueryState <$tcx, Self > {
995+ fn query_state<' a>( tcx: TyCtxt <$tcx>) -> & ' a QueryState <$tcx, Self :: Cache > {
998996 & tcx. queries. $name
999997 }
1000998
@@ -1139,7 +1137,10 @@ macro_rules! define_queries_struct {
11391137 providers: IndexVec <CrateNum , Providers <$tcx>>,
11401138 fallback_extern_providers: Box <Providers <$tcx>>,
11411139
1142- $( $( #[ $attr] ) * $name: QueryState <$tcx, queries:: $name<$tcx>>, ) *
1140+ $( $( #[ $attr] ) * $name: QueryState <
1141+ $tcx,
1142+ <queries:: $name<$tcx> as QueryAccessors <' tcx>>:: Cache ,
1143+ >, ) *
11431144 }
11441145
11451146 impl <$tcx> Queries <$tcx> {
0 commit comments