@@ -236,7 +236,8 @@ where
236
236
return TryGetJob :: Cycle ( Q :: handle_cycle_error ( tcx, cycle) ) ;
237
237
}
238
238
239
- let cached = tcx. try_get_cached :: < Q , _ , _ , _ > (
239
+ let cached = tcx. try_get_cached (
240
+ Q :: query_state ( tcx) ,
240
241
( * key) . clone ( ) ,
241
242
|value, index| ( value. clone ( ) , index) ,
242
243
|_, _| panic ! ( "value must be in cache after waiting" ) ,
@@ -460,23 +461,22 @@ impl<'tcx> TyCtxt<'tcx> {
460
461
/// which will be used if the query is not in the cache and we need
461
462
/// to compute it.
462
463
#[ inline( always) ]
463
- fn try_get_cached < Q , R , OnHit , OnMiss > (
464
+ fn try_get_cached < K , V , C , R , OnHit , OnMiss > (
464
465
self ,
465
- key : Q :: Key ,
466
+ state : & ' tcx QueryStateImpl < ' tcx , K , V , C > ,
467
+ key : K ,
466
468
// `on_hit` can be called while holding a lock to the query cache
467
469
on_hit : OnHit ,
468
470
on_miss : OnMiss ,
469
471
) -> R
470
472
where
471
- Q : QueryDescription < ' tcx > + ' tcx ,
472
- OnHit : FnOnce ( & Q :: Value , DepNodeIndex ) -> R ,
473
- OnMiss : FnOnce ( Q :: Key , QueryLookup < ' tcx , Q > ) -> R ,
473
+ C : QueryCache < K , V > ,
474
+ OnHit : FnOnce ( & V , DepNodeIndex ) -> R ,
475
+ OnMiss : FnOnce ( K , QueryLookupImpl < ' tcx , QueryStateShardImpl < ' tcx , K , C :: Sharded > > ) -> R ,
474
476
{
475
- let state = Q :: query_state ( self ) ;
476
-
477
477
state. cache . lookup (
478
478
state,
479
- QueryStateShard :: < Q > :: get_cache,
479
+ QueryStateShardImpl :: < K , C :: Sharded > :: get_cache,
480
480
key,
481
481
|value, index| {
482
482
if unlikely ! ( self . prof. enabled( ) ) {
@@ -500,7 +500,8 @@ impl<'tcx> TyCtxt<'tcx> {
500
500
) -> Q :: Value {
501
501
debug ! ( "ty::query::get_query<{}>(key={:?}, span={:?})" , Q :: NAME , key, span) ;
502
502
503
- self . try_get_cached :: < Q , _ , _ , _ > (
503
+ self . try_get_cached (
504
+ Q :: query_state ( self ) ,
504
505
key,
505
506
|value, index| {
506
507
self . dep_graph . read_index ( index) ;
@@ -770,7 +771,8 @@ impl<'tcx> TyCtxt<'tcx> {
770
771
// We may be concurrently trying both execute and force a query.
771
772
// Ensure that only one of them runs the query.
772
773
773
- self . try_get_cached :: < Q , _ , _ , _ > (
774
+ self . try_get_cached (
775
+ Q :: query_state ( self ) ,
774
776
key,
775
777
|_, _| {
776
778
// Cache hit, do nothing
0 commit comments