@@ -439,12 +439,13 @@ where
439439 let marked = tcx. dep_graph ( ) . try_mark_green_and_read ( tcx, & dep_node) ;
440440 marked. map ( |( prev_dep_node_index, dep_node_index) | {
441441 (
442- load_from_disk_and_cache_in_memory :: < Q , _ > (
442+ load_from_disk_and_cache_in_memory (
443443 tcx,
444444 key. clone ( ) ,
445445 prev_dep_node_index,
446446 dep_node_index,
447447 & dep_node,
448+ & Q :: VTABLE ,
448449 ) ,
449450 dep_node_index,
450451 )
@@ -460,26 +461,26 @@ where
460461 result
461462}
462463
463- fn load_from_disk_and_cache_in_memory < Q , CTX > (
464+ fn load_from_disk_and_cache_in_memory < CTX , K , V > (
464465 tcx : CTX ,
465- key : Q :: Key ,
466+ key : K ,
466467 prev_dep_node_index : SerializedDepNodeIndex ,
467468 dep_node_index : DepNodeIndex ,
468469 dep_node : & DepNode < CTX :: DepKind > ,
469- ) -> Q :: Value
470+ query : & QueryVtable < CTX , K , V > ,
471+ ) -> V
470472where
471473 CTX : QueryContext ,
472- Q : QueryDescription < CTX > ,
473474{
474475 // Note this function can be called concurrently from the same query
475476 // We must ensure that this is handled correctly.
476477
477478 debug_assert ! ( tcx. dep_graph( ) . is_green( dep_node) ) ;
478479
479480 // First we try to load the result from the on-disk cache.
480- let result = if Q :: cache_on_disk ( tcx, key. clone ( ) , None ) {
481+ let result = if query . cache_on_disk ( tcx, & key, None ) {
481482 let prof_timer = tcx. profiler ( ) . incr_cache_loading ( ) ;
482- let result = Q :: try_load_from_disk ( tcx, prev_dep_node_index) ;
483+ let result = query . try_load_from_disk ( tcx, prev_dep_node_index) ;
483484 prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
484485
485486 // We always expect to find a cached result for things that
@@ -503,7 +504,7 @@ where
503504 let prof_timer = tcx. profiler ( ) . query_provider ( ) ;
504505
505506 // The dep-graph for this computation is already in-place.
506- let result = tcx. dep_graph ( ) . with_ignore ( || Q :: compute ( tcx, key) ) ;
507+ let result = tcx. dep_graph ( ) . with_ignore ( || query . compute ( tcx, key) ) ;
507508
508509 prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
509510
@@ -513,22 +514,22 @@ where
513514 // If `-Zincremental-verify-ich` is specified, re-hash results from
514515 // the cache and make sure that they have the expected fingerprint.
515516 if unlikely ! ( tcx. incremental_verify_ich( ) ) {
516- incremental_verify_ich :: < Q , _ > ( tcx, & result, dep_node, dep_node_index) ;
517+ incremental_verify_ich ( tcx, & result, dep_node, dep_node_index, query ) ;
517518 }
518519
519520 result
520521}
521522
522523#[ inline( never) ]
523524#[ cold]
524- fn incremental_verify_ich < Q , CTX > (
525+ fn incremental_verify_ich < CTX , K , V > (
525526 tcx : CTX ,
526- result : & Q :: Value ,
527+ result : & V ,
527528 dep_node : & DepNode < CTX :: DepKind > ,
528529 dep_node_index : DepNodeIndex ,
530+ query : & QueryVtable < CTX , K , V > ,
529531) where
530532 CTX : QueryContext ,
531- Q : QueryDescription < CTX > ,
532533{
533534 assert ! (
534535 Some ( tcx. dep_graph( ) . fingerprint_of( dep_node_index) )
@@ -540,7 +541,7 @@ fn incremental_verify_ich<Q, CTX>(
540541 debug ! ( "BEGIN verify_ich({:?})" , dep_node) ;
541542 let mut hcx = tcx. create_stable_hashing_context ( ) ;
542543
543- let new_hash = Q :: hash_result ( & mut hcx, result) . unwrap_or ( Fingerprint :: ZERO ) ;
544+ let new_hash = query . hash_result ( & mut hcx, result) . unwrap_or ( Fingerprint :: ZERO ) ;
544545 debug ! ( "END verify_ich({:?})" , dep_node) ;
545546
546547 let old_hash = tcx. dep_graph ( ) . fingerprint_of ( dep_node_index) ;
0 commit comments