4
4
5
5
use crate :: dep_graph:: { DepKind , DepNode , DepNodeIndex , SerializedDepNodeIndex } ;
6
6
use crate :: ty:: query:: caches:: QueryCache ;
7
- use crate :: ty:: query:: config:: { QueryAccessors , QueryDescription } ;
7
+ use crate :: ty:: query:: config:: QueryDescription ;
8
8
use crate :: ty:: query:: job:: { QueryInfo , QueryJob , QueryJobId , QueryJobInfo , QueryShardJobId } ;
9
9
use crate :: ty:: query:: Query ;
10
10
use crate :: ty:: tls;
@@ -49,16 +49,14 @@ impl<'tcx, K, C: Default> Default for QueryStateShard<'tcx, K, C> {
49
49
}
50
50
}
51
51
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 > {
55
53
pub ( super ) cache : C ,
56
54
pub ( super ) shards : Sharded < QueryStateShard < ' tcx , C :: Key , C :: Sharded > > ,
57
55
#[ cfg( debug_assertions) ]
58
56
pub ( super ) cache_hits : AtomicUsize ,
59
57
}
60
58
61
- impl < ' tcx , C : QueryCache > QueryStateImpl < ' tcx , C > {
59
+ impl < ' tcx , C : QueryCache > QueryState < ' tcx , C > {
62
60
pub ( super ) fn get_lookup < K2 : Hash > (
63
61
& ' tcx self ,
64
62
key : & K2 ,
@@ -86,7 +84,7 @@ pub(super) enum QueryResult<'tcx> {
86
84
Poisoned ,
87
85
}
88
86
89
- impl < ' tcx , C : QueryCache > QueryStateImpl < ' tcx , C > {
87
+ impl < ' tcx , C : QueryCache > QueryState < ' tcx , C > {
90
88
pub fn iter_results < R > (
91
89
& self ,
92
90
f : impl for < ' a > FnOnce (
@@ -131,9 +129,9 @@ impl<'tcx, C: QueryCache> QueryStateImpl<'tcx, C> {
131
129
}
132
130
}
133
131
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 {
137
135
cache : C :: default ( ) ,
138
136
shards : Default :: default ( ) ,
139
137
#[ cfg( debug_assertions) ]
@@ -157,7 +155,7 @@ where
157
155
C :: Key : Eq + Hash + Clone + Debug ,
158
156
C :: Value : Clone ,
159
157
{
160
- state : & ' tcx QueryStateImpl < ' tcx , C > ,
158
+ state : & ' tcx QueryState < ' tcx , C > ,
161
159
key : C :: Key ,
162
160
id : QueryJobId ,
163
161
}
@@ -478,7 +476,7 @@ impl<'tcx> TyCtxt<'tcx> {
478
476
#[ inline( always) ]
479
477
fn try_get_cached < C , R , OnHit , OnMiss > (
480
478
self ,
481
- state : & ' tcx QueryStateImpl < ' tcx , C > ,
479
+ state : & ' tcx QueryState < ' tcx , C > ,
482
480
key : C :: Key ,
483
481
// `on_hit` can be called while holding a lock to the query cache
484
482
on_hit : OnHit ,
@@ -994,7 +992,7 @@ macro_rules! define_queries_inner {
994
992
type Cache = query_storage!( [ $( $modifiers) * ] [ $K, $V] ) ;
995
993
996
994
#[ 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 > {
998
996
& tcx. queries. $name
999
997
}
1000
998
@@ -1139,7 +1137,10 @@ macro_rules! define_queries_struct {
1139
1137
providers: IndexVec <CrateNum , Providers <$tcx>>,
1140
1138
fallback_extern_providers: Box <Providers <$tcx>>,
1141
1139
1142
- $( $( #[ $attr] ) * $name: QueryState <$tcx, queries:: $name<$tcx>>, ) *
1140
+ $( $( #[ $attr] ) * $name: QueryState <
1141
+ $tcx,
1142
+ <queries:: $name<$tcx> as QueryAccessors <' tcx>>:: Cache ,
1143
+ >, ) *
1143
1144
}
1144
1145
1145
1146
impl <$tcx> Queries <$tcx> {
0 commit comments