@@ -162,9 +162,9 @@ where
162
162
id : QueryJobId < CTX :: DepKind > ,
163
163
}
164
164
165
- impl < ' tcx , C > JobOwner < ' tcx , TyCtxt < ' tcx > , C >
165
+ impl < ' tcx , CTX : QueryContext , C > JobOwner < ' tcx , CTX , C >
166
166
where
167
- C : QueryCache < TyCtxt < ' tcx > > + ' tcx ,
167
+ C : QueryCache < CTX > ,
168
168
C :: Key : Eq + Hash + Clone + Debug ,
169
169
C :: Value : Clone ,
170
170
{
@@ -177,14 +177,16 @@ where
177
177
/// This function is inlined because that results in a noticeable speed-up
178
178
/// for some compile-time benchmarks.
179
179
#[ inline( always) ]
180
- fn try_start < ' a , ' b , Q > (
181
- tcx : TyCtxt < ' tcx > ,
180
+ fn try_start < ' a , ' b , Q , K > (
181
+ tcx : CTX ,
182
182
span : Span ,
183
183
key : & C :: Key ,
184
- mut lookup : QueryLookup < ' a , TyCtxt < ' tcx > , C :: Key , C :: Sharded > ,
185
- ) -> TryGetJob < ' b , TyCtxt < ' tcx > , C >
184
+ mut lookup : QueryLookup < ' a , CTX , C :: Key , C :: Sharded > ,
185
+ ) -> TryGetJob < ' b , CTX , C >
186
186
where
187
- Q : QueryDescription < TyCtxt < ' tcx > , Key = C :: Key , Value = C :: Value , Cache = C > ,
187
+ K : DepKind ,
188
+ Q : QueryDescription < CTX , Key = C :: Key , Value = C :: Value , Cache = C > ,
189
+ CTX : QueryContext < DepKind = K > ,
188
190
{
189
191
let lock = & mut * lookup. lock ;
190
192
@@ -196,7 +198,7 @@ where
196
198
// in another thread has completed. Record how long we wait in the
197
199
// self-profiler.
198
200
let _query_blocked_prof_timer = if cfg ! ( parallel_compiler) {
199
- Some ( tcx. prof . query_blocked ( ) )
201
+ Some ( tcx. profiler ( ) . query_blocked ( ) )
200
202
} else {
201
203
None
202
204
} ;
@@ -219,7 +221,7 @@ where
219
221
220
222
let global_id = QueryJobId :: new ( id, lookup. shard , Q :: DEP_KIND ) ;
221
223
222
- let job = tls :: with_related_context ( tcx, |icx | QueryJob :: new ( id, span, icx . query ) ) ;
224
+ let job = tcx. read_query_job ( |query | QueryJob :: new ( id, span, query) ) ;
223
225
224
226
entry. insert ( QueryResult :: Started ( job) ) ;
225
227
@@ -262,14 +264,7 @@ where
262
264
return TryGetJob :: JobCompleted ( cached) ;
263
265
}
264
266
}
265
- }
266
267
267
- impl < ' tcx , CTX : QueryContext , C > JobOwner < ' tcx , CTX , C >
268
- where
269
- C : QueryCache < CTX > ,
270
- C :: Key : Eq + Hash + Clone + Debug ,
271
- C :: Value : Clone ,
272
- {
273
268
/// Completes the query by updating the query cache with the `result`,
274
269
/// signals the waiter and forgets the JobOwner, so it won't poison the query
275
270
#[ inline( always) ]
@@ -573,7 +568,7 @@ impl<'tcx> TyCtxt<'tcx> {
573
568
<Q :: Cache as QueryCache < TyCtxt < ' tcx > > >:: Sharded ,
574
569
> ,
575
570
) -> Q :: Value {
576
- let job = match JobOwner :: try_start :: < Q > ( self , span, & key, lookup) {
571
+ let job = match JobOwner :: try_start :: < Q , _ > ( self , span, & key, lookup) {
577
572
TryGetJob :: NotYetStarted ( job) => job,
578
573
TryGetJob :: Cycle ( result) => return result,
579
574
#[ cfg( parallel_compiler) ]
@@ -832,7 +827,7 @@ impl<'tcx> TyCtxt<'tcx> {
832
827
// Cache hit, do nothing
833
828
} ,
834
829
|key, lookup| {
835
- let job = match JobOwner :: try_start :: < Q > ( self , span, & key, lookup) {
830
+ let job = match JobOwner :: try_start :: < Q , _ > ( self , span, & key, lookup) {
836
831
TryGetJob :: NotYetStarted ( job) => job,
837
832
TryGetJob :: Cycle ( _) => return ,
838
833
#[ cfg( parallel_compiler) ]
0 commit comments