@@ -168,14 +168,15 @@ where
168168 /// This function is inlined because that results in a noticeable speed-up
169169 /// for some compile-time benchmarks.
170170 #[ inline( always) ]
171- fn try_start < ' a , ' b , Q > (
171+ fn try_start < ' a , ' b > (
172172 tcx : CTX ,
173+ state : & ' b QueryState < CTX , C > ,
173174 span : Span ,
174175 key : & C :: Key ,
175176 mut lookup : QueryLookup < ' a , CTX , C :: Key , C :: Sharded > ,
177+ query : & QueryVtable < CTX , C :: Key , C :: Value > ,
176178 ) -> TryGetJob < ' b , CTX , C >
177179 where
178- Q : QueryDescription < CTX , Key = C :: Key , Stored = C :: Stored , Value = C :: Value , Cache = C > ,
179180 CTX : QueryContext ,
180181 {
181182 let lock = & mut * lookup. lock ;
@@ -194,7 +195,7 @@ where
194195 } ;
195196
196197 // Create the id of the job we're waiting for
197- let id = QueryJobId :: new ( job. id , lookup. shard , Q :: DEP_KIND ) ;
198+ let id = QueryJobId :: new ( job. id , lookup. shard , query . dep_kind ) ;
198199
199200 ( job. latch ( id) , _query_blocked_prof_timer)
200201 }
@@ -209,15 +210,14 @@ where
209210 lock. jobs = id;
210211 let id = QueryShardJobId ( NonZeroU32 :: new ( id) . unwrap ( ) ) ;
211212
212- let global_id = QueryJobId :: new ( id, lookup. shard , Q :: DEP_KIND ) ;
213+ let global_id = QueryJobId :: new ( id, lookup. shard , query . dep_kind ) ;
213214
214215 let job = tcx. current_query_job ( ) ;
215216 let job = QueryJob :: new ( id, span, job) ;
216217
217218 entry. insert ( QueryResult :: Started ( job) ) ;
218219
219- let owner =
220- JobOwner { state : Q :: query_state ( tcx) , id : global_id, key : ( * key) . clone ( ) } ;
220+ let owner = JobOwner { state, id : global_id, key : ( * key) . clone ( ) } ;
221221 return TryGetJob :: NotYetStarted ( owner) ;
222222 }
223223 } ;
@@ -227,8 +227,8 @@ where
227227 // so we just return the error.
228228 #[ cfg( not( parallel_compiler) ) ]
229229 return TryGetJob :: Cycle ( cold_path ( || {
230- let value = Q :: handle_cycle_error ( tcx, latch. find_cycle_in_stack ( tcx, span) ) ;
231- Q :: query_state ( tcx ) . cache . store_nocache ( value)
230+ let value = query . handle_cycle_error ( tcx, latch. find_cycle_in_stack ( tcx, span) ) ;
231+ state . cache . store_nocache ( value)
232232 } ) ) ;
233233
234234 // With parallel queries we might just have to wait on some other
@@ -238,14 +238,14 @@ where
238238 let result = latch. wait_on ( tcx, span) ;
239239
240240 if let Err ( cycle) = result {
241- let value = Q :: handle_cycle_error ( tcx, cycle) ;
242- let value = Q :: query_state ( tcx ) . cache . store_nocache ( value) ;
241+ let value = query . handle_cycle_error ( tcx, cycle) ;
242+ let value = state . cache . store_nocache ( value) ;
243243 return TryGetJob :: Cycle ( value) ;
244244 }
245245
246246 let cached = try_get_cached (
247247 tcx,
248- Q :: query_state ( tcx ) ,
248+ state ,
249249 ( * key) . clone ( ) ,
250250 |value, index| ( value. clone ( ) , index) ,
251251 |_, _| panic ! ( "value must be in cache after waiting" ) ,
@@ -392,7 +392,7 @@ where
392392 Q : QueryDescription < CTX > ,
393393 CTX : QueryContext ,
394394{
395- let job = match JobOwner :: try_start :: < Q > ( tcx, span, & key, lookup) {
395+ let job = match JobOwner :: try_start ( tcx , Q :: query_state ( tcx) , span, & key, lookup, & Q :: VTABLE ) {
396396 TryGetJob :: NotYetStarted ( job) => job,
397397 TryGetJob :: Cycle ( result) => return result,
398398 #[ cfg( parallel_compiler) ]
@@ -697,12 +697,14 @@ where
697697 // Cache hit, do nothing
698698 } ,
699699 |key, lookup| {
700- let job = match JobOwner :: try_start :: < Q > ( tcx, span, & key, lookup) {
701- TryGetJob :: NotYetStarted ( job) => job,
702- TryGetJob :: Cycle ( _) => return ,
703- #[ cfg( parallel_compiler) ]
704- TryGetJob :: JobCompleted ( _) => return ,
705- } ;
700+ let job =
701+ match JobOwner :: try_start ( tcx, Q :: query_state ( tcx) , span, & key, lookup, & Q :: VTABLE )
702+ {
703+ TryGetJob :: NotYetStarted ( job) => job,
704+ TryGetJob :: Cycle ( _) => return ,
705+ #[ cfg( parallel_compiler) ]
706+ TryGetJob :: JobCompleted ( _) => return ,
707+ } ;
706708 force_query_with_job ( tcx, key, job, dep_node, & Q :: VTABLE ) ;
707709 } ,
708710 ) ;
0 commit comments