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 (
@@ -130,9 +128,9 @@ impl<'tcx, C: QueryCache> QueryStateImpl<'tcx, C> {
130128 }
131129}
132130
133- impl < ' tcx , C : QueryCache > Default for QueryStateImpl < ' tcx , C > {
134- fn default ( ) -> QueryStateImpl < ' tcx , C > {
135- QueryStateImpl {
131+ impl < ' tcx , C : QueryCache > Default for QueryState < ' tcx , C > {
132+ fn default ( ) -> QueryState < ' tcx , C > {
133+ QueryState {
136134 cache : C :: default ( ) ,
137135 shards : Default :: default ( ) ,
138136 #[ cfg( debug_assertions) ]
@@ -156,7 +154,7 @@ where
156154 C :: Key : Eq + Hash + Clone + Debug ,
157155 C :: Value : Clone ,
158156{
159- state : & ' tcx QueryStateImpl < ' tcx , C > ,
157+ state : & ' tcx QueryState < ' tcx , C > ,
160158 key : C :: Key ,
161159 id : QueryJobId ,
162160}
@@ -482,7 +480,7 @@ impl<'tcx> TyCtxt<'tcx> {
482480 #[ inline( always) ]
483481 fn try_get_cached < C , R , OnHit , OnMiss > (
484482 self ,
485- state : & ' tcx QueryStateImpl < ' tcx , C > ,
483+ state : & ' tcx QueryState < ' tcx , C > ,
486484 key : C :: Key ,
487485 // `on_hit` can be called while holding a lock to the query cache
488486 on_hit : OnHit ,
@@ -979,7 +977,7 @@ macro_rules! define_queries_inner {
979977 type Cache = query_storage!( [ $( $modifiers) * ] [ $K, $V] ) ;
980978
981979 #[ inline( always) ]
982- fn query_state<' a>( tcx: TyCtxt <$tcx>) -> & ' a QueryState <$tcx, Self > {
980+ fn query_state<' a>( tcx: TyCtxt <$tcx>) -> & ' a QueryState <$tcx, Self :: Cache > {
983981 & tcx. queries. $name
984982 }
985983
@@ -1131,7 +1129,10 @@ macro_rules! define_queries_struct {
11311129 providers: IndexVec <CrateNum , Providers <$tcx>>,
11321130 fallback_extern_providers: Box <Providers <$tcx>>,
11331131
1134- $( $( #[ $attr] ) * $name: QueryState <$tcx, queries:: $name<$tcx>>, ) *
1132+ $( $( #[ $attr] ) * $name: QueryState <
1133+ $tcx,
1134+ <queries:: $name<$tcx> as QueryAccessors <' tcx>>:: Cache ,
1135+ >, ) *
11351136 }
11361137
11371138 impl <$tcx> Queries <$tcx> {
0 commit comments