@@ -30,11 +30,11 @@ use std::ptr;
30
30
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
31
31
32
32
pub ( crate ) struct QueryStateShard < ' tcx , K , C > {
33
- pub ( super ) cache : C ,
34
- pub ( super ) active : FxHashMap < K , QueryResult < ' tcx > > ,
33
+ cache : C ,
34
+ active : FxHashMap < K , QueryResult < ' tcx > > ,
35
35
36
36
/// Used to generate unique ids for active jobs.
37
- pub ( super ) jobs : u32 ,
37
+ jobs : u32 ,
38
38
}
39
39
40
40
impl < ' tcx , K , C > QueryStateShard < ' tcx , K , C > {
@@ -50,8 +50,8 @@ impl<'tcx, K, C: Default> Default for QueryStateShard<'tcx, K, C> {
50
50
}
51
51
52
52
pub ( crate ) struct QueryState < ' tcx , C : QueryCache > {
53
- pub ( super ) cache : C ,
54
- pub ( super ) shards : Sharded < QueryStateShard < ' tcx , C :: Key , C :: Sharded > > ,
53
+ cache : C ,
54
+ shards : Sharded < QueryStateShard < ' tcx , C :: Key , C :: Sharded > > ,
55
55
#[ cfg( debug_assertions) ]
56
56
pub ( super ) cache_hits : AtomicUsize ,
57
57
}
@@ -75,7 +75,7 @@ impl<'tcx, C: QueryCache> QueryState<'tcx, C> {
75
75
}
76
76
77
77
/// Indicates the state of a query for a given key in a query map.
78
- pub ( super ) enum QueryResult < ' tcx > {
78
+ enum QueryResult < ' tcx > {
79
79
/// An already executing query. The query job can be used to await for its completion.
80
80
Started ( QueryJob < ' tcx > ) ,
81
81
@@ -85,15 +85,15 @@ pub(super) enum QueryResult<'tcx> {
85
85
}
86
86
87
87
impl < ' tcx , C : QueryCache > QueryState < ' tcx , C > {
88
- pub fn iter_results < R > (
88
+ pub ( super ) fn iter_results < R > (
89
89
& self ,
90
90
f : impl for < ' a > FnOnce (
91
91
Box < dyn Iterator < Item = ( & ' a C :: Key , & ' a C :: Value , DepNodeIndex ) > + ' a > ,
92
92
) -> R ,
93
93
) -> R {
94
94
self . cache . iter ( & self . shards , |shard| & mut shard. cache , f)
95
95
}
96
- pub fn all_inactive ( & self ) -> bool {
96
+ pub ( super ) fn all_inactive ( & self ) -> bool {
97
97
let shards = self . shards . lock_shards ( ) ;
98
98
shards. iter ( ) . all ( |shard| shard. active . is_empty ( ) )
99
99
}
@@ -142,13 +142,13 @@ impl<'tcx, C: QueryCache> Default for QueryState<'tcx, C> {
142
142
/// Values used when checking a query cache which can be reused on a cache-miss to execute the query.
143
143
pub ( crate ) struct QueryLookup < ' tcx , K , C > {
144
144
pub ( super ) key_hash : u64 ,
145
- pub ( super ) shard : usize ,
145
+ shard : usize ,
146
146
pub ( super ) lock : LockGuard < ' tcx , QueryStateShard < ' tcx , K , C > > ,
147
147
}
148
148
149
149
/// A type representing the responsibility to execute the job in the `job` field.
150
150
/// This will poison the relevant query if dropped.
151
- pub ( super ) struct JobOwner < ' tcx , C >
151
+ struct JobOwner < ' tcx , C >
152
152
where
153
153
C : QueryCache ,
154
154
C :: Key : Eq + Hash + Clone + Debug ,
@@ -174,7 +174,7 @@ where
174
174
/// This function is inlined because that results in a noticeable speed-up
175
175
/// for some compile-time benchmarks.
176
176
#[ inline( always) ]
177
- pub ( super ) fn try_start < Q > (
177
+ fn try_start < Q > (
178
178
tcx : TyCtxt < ' tcx > ,
179
179
span : Span ,
180
180
key : & C :: Key ,
@@ -262,12 +262,7 @@ where
262
262
/// Completes the query by updating the query cache with the `result`,
263
263
/// signals the waiter and forgets the JobOwner, so it won't poison the query
264
264
#[ inline( always) ]
265
- pub ( super ) fn complete (
266
- self ,
267
- tcx : TyCtxt < ' tcx > ,
268
- result : & C :: Value ,
269
- dep_node_index : DepNodeIndex ,
270
- ) {
265
+ fn complete ( self , tcx : TyCtxt < ' tcx > , result : & C :: Value , dep_node_index : DepNodeIndex ) {
271
266
// We can move out of `self` here because we `mem::forget` it below
272
267
let key = unsafe { ptr:: read ( & self . key ) } ;
273
268
let state = self . state ;
@@ -327,14 +322,14 @@ where
327
322
}
328
323
329
324
#[ derive( Clone ) ]
330
- pub struct CycleError < ' tcx > {
325
+ pub ( crate ) struct CycleError < ' tcx > {
331
326
/// The query and related span that uses the cycle.
332
327
pub ( super ) usage : Option < ( Span , Query < ' tcx > ) > ,
333
328
pub ( super ) cycle : Vec < QueryInfo < ' tcx > > ,
334
329
}
335
330
336
331
/// The result of `try_start`.
337
- pub ( super ) enum TryGetJob < ' tcx , C : QueryCache >
332
+ enum TryGetJob < ' tcx , C : QueryCache >
338
333
where
339
334
C :: Key : Eq + Hash + Clone + Debug ,
340
335
C :: Value : Clone ,
@@ -357,7 +352,7 @@ impl<'tcx> TyCtxt<'tcx> {
357
352
/// new query job while it executes. It returns the diagnostics
358
353
/// captured during execution and the actual result.
359
354
#[ inline( always) ]
360
- pub ( super ) fn start_query < F , R > (
355
+ fn start_query < F , R > (
361
356
self ,
362
357
token : QueryJobId ,
363
358
diagnostics : Option < & Lock < ThinVec < Diagnostic > > > ,
@@ -529,7 +524,7 @@ impl<'tcx> TyCtxt<'tcx> {
529
524
}
530
525
531
526
#[ inline( always) ]
532
- pub ( super ) fn try_execute_query < Q : QueryDescription < ' tcx > + ' tcx > (
527
+ fn try_execute_query < Q : QueryDescription < ' tcx > + ' tcx > (
533
528
self ,
534
529
span : Span ,
535
530
key : Q :: Key ,
@@ -1136,7 +1131,7 @@ macro_rules! define_queries_struct {
1136
1131
}
1137
1132
1138
1133
impl <$tcx> Queries <$tcx> {
1139
- pub fn new(
1134
+ pub ( crate ) fn new(
1140
1135
providers: IndexVec <CrateNum , Providers <$tcx>>,
1141
1136
fallback_extern_providers: Providers <$tcx>,
1142
1137
on_disk_cache: OnDiskCache <' tcx>,
@@ -1149,7 +1144,7 @@ macro_rules! define_queries_struct {
1149
1144
}
1150
1145
}
1151
1146
1152
- pub fn try_collect_active_jobs(
1147
+ pub ( crate ) fn try_collect_active_jobs(
1153
1148
& self
1154
1149
) -> Option <FxHashMap <QueryJobId , QueryJobInfo <' tcx>>> {
1155
1150
let mut jobs = FxHashMap :: default ( ) ;
0 commit comments