@@ -30,11 +30,11 @@ use std::ptr;
3030use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
3131
3232pub ( 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 > > ,
3535
3636 /// Used to generate unique ids for active jobs.
37- pub ( super ) jobs : u32 ,
37+ jobs : u32 ,
3838}
3939
4040impl < ' tcx , K , C > QueryStateShard < ' tcx , K , C > {
@@ -50,8 +50,8 @@ impl<'tcx, K, C: Default> Default for QueryStateShard<'tcx, K, C> {
5050}
5151
5252pub ( 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 > > ,
5555 #[ cfg( debug_assertions) ]
5656 pub ( super ) cache_hits : AtomicUsize ,
5757}
@@ -75,7 +75,7 @@ impl<'tcx, C: QueryCache> QueryState<'tcx, C> {
7575}
7676
7777/// Indicates the state of a query for a given key in a query map.
78- pub ( super ) enum QueryResult < ' tcx > {
78+ enum QueryResult < ' tcx > {
7979 /// An already executing query. The query job can be used to await for its completion.
8080 Started ( QueryJob < ' tcx > ) ,
8181
@@ -85,15 +85,15 @@ pub(super) enum QueryResult<'tcx> {
8585}
8686
8787impl < ' tcx , C : QueryCache > QueryState < ' tcx , C > {
88- pub fn iter_results < R > (
88+ pub ( super ) fn iter_results < R > (
8989 & self ,
9090 f : impl for < ' a > FnOnce (
9191 Box < dyn Iterator < Item = ( & ' a C :: Key , & ' a C :: Value , DepNodeIndex ) > + ' a > ,
9292 ) -> R ,
9393 ) -> R {
9494 self . cache . iter ( & self . shards , |shard| & mut shard. cache , f)
9595 }
96- pub fn all_inactive ( & self ) -> bool {
96+ pub ( super ) fn all_inactive ( & self ) -> bool {
9797 let shards = self . shards . lock_shards ( ) ;
9898 shards. iter ( ) . all ( |shard| shard. active . is_empty ( ) )
9999 }
@@ -142,13 +142,13 @@ impl<'tcx, C: QueryCache> Default for QueryState<'tcx, C> {
142142/// Values used when checking a query cache which can be reused on a cache-miss to execute the query.
143143pub ( crate ) struct QueryLookup < ' tcx , K , C > {
144144 pub ( super ) key_hash : u64 ,
145- pub ( super ) shard : usize ,
145+ shard : usize ,
146146 pub ( super ) lock : LockGuard < ' tcx , QueryStateShard < ' tcx , K , C > > ,
147147}
148148
149149/// A type representing the responsibility to execute the job in the `job` field.
150150/// This will poison the relevant query if dropped.
151- pub ( super ) struct JobOwner < ' tcx , C >
151+ struct JobOwner < ' tcx , C >
152152where
153153 C : QueryCache ,
154154 C :: Key : Eq + Hash + Clone + Debug ,
@@ -174,7 +174,7 @@ where
174174 /// This function is inlined because that results in a noticeable speed-up
175175 /// for some compile-time benchmarks.
176176 #[ inline( always) ]
177- pub ( super ) fn try_start < Q > (
177+ fn try_start < Q > (
178178 tcx : TyCtxt < ' tcx > ,
179179 span : Span ,
180180 key : & C :: Key ,
@@ -262,12 +262,7 @@ where
262262 /// Completes the query by updating the query cache with the `result`,
263263 /// signals the waiter and forgets the JobOwner, so it won't poison the query
264264 #[ 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 ) {
271266 // We can move out of `self` here because we `mem::forget` it below
272267 let key = unsafe { ptr:: read ( & self . key ) } ;
273268 let state = self . state ;
@@ -327,14 +322,14 @@ where
327322}
328323
329324#[ derive( Clone ) ]
330- pub struct CycleError < ' tcx > {
325+ pub ( crate ) struct CycleError < ' tcx > {
331326 /// The query and related span that uses the cycle.
332327 pub ( super ) usage : Option < ( Span , Query < ' tcx > ) > ,
333328 pub ( super ) cycle : Vec < QueryInfo < ' tcx > > ,
334329}
335330
336331/// The result of `try_start`.
337- pub ( super ) enum TryGetJob < ' tcx , C : QueryCache >
332+ enum TryGetJob < ' tcx , C : QueryCache >
338333where
339334 C :: Key : Eq + Hash + Clone + Debug ,
340335 C :: Value : Clone ,
@@ -357,7 +352,7 @@ impl<'tcx> TyCtxt<'tcx> {
357352 /// new query job while it executes. It returns the diagnostics
358353 /// captured during execution and the actual result.
359354 #[ inline( always) ]
360- pub ( super ) fn start_query < F , R > (
355+ fn start_query < F , R > (
361356 self ,
362357 token : QueryJobId ,
363358 diagnostics : Option < & Lock < ThinVec < Diagnostic > > > ,
@@ -529,7 +524,7 @@ impl<'tcx> TyCtxt<'tcx> {
529524 }
530525
531526 #[ inline( always) ]
532- pub ( super ) fn try_execute_query < Q : QueryDescription < ' tcx > + ' tcx > (
527+ fn try_execute_query < Q : QueryDescription < ' tcx > + ' tcx > (
533528 self ,
534529 span : Span ,
535530 key : Q :: Key ,
@@ -1136,7 +1131,7 @@ macro_rules! define_queries_struct {
11361131 }
11371132
11381133 impl <$tcx> Queries <$tcx> {
1139- pub fn new(
1134+ pub ( crate ) fn new(
11401135 providers: IndexVec <CrateNum , Providers <$tcx>>,
11411136 fallback_extern_providers: Providers <$tcx>,
11421137 on_disk_cache: OnDiskCache <' tcx>,
@@ -1149,7 +1144,7 @@ macro_rules! define_queries_struct {
11491144 }
11501145 }
11511146
1152- pub fn try_collect_active_jobs(
1147+ pub ( crate ) fn try_collect_active_jobs(
11531148 & self
11541149 ) -> Option <FxHashMap <QueryJobId , QueryJobInfo <' tcx>>> {
11551150 let mut jobs = FxHashMap :: default ( ) ;
0 commit comments