@@ -582,11 +582,12 @@ impl<'tcx> TyCtxt<'tcx> {
582
582
let marked = tcx. dep_graph . try_mark_green_and_read ( tcx, & dep_node) ;
583
583
marked. map ( |( prev_dep_node_index, dep_node_index) | {
584
584
(
585
- tcx. load_from_disk_and_cache_in_memory :: < Q > (
585
+ tcx. load_from_disk_and_cache_in_memory (
586
586
key. clone ( ) ,
587
587
prev_dep_node_index,
588
588
dep_node_index,
589
589
& dep_node,
590
+ & Q :: reify ( ) ,
590
591
) ,
591
592
dep_node_index,
592
593
)
@@ -603,24 +604,25 @@ impl<'tcx> TyCtxt<'tcx> {
603
604
result
604
605
}
605
606
606
- fn load_from_disk_and_cache_in_memory < Q : QueryDescription < ' tcx > > (
607
+ fn load_from_disk_and_cache_in_memory < K : Clone , V > (
607
608
self ,
608
- key : Q :: Key ,
609
+ key : K ,
609
610
prev_dep_node_index : SerializedDepNodeIndex ,
610
611
dep_node_index : DepNodeIndex ,
611
612
dep_node : & DepNode ,
612
- ) -> Q :: Value {
613
+ query : & QueryVtable < ' tcx , K , V > ,
614
+ ) -> V {
613
615
// Note this function can be called concurrently from the same query
614
616
// We must ensure that this is handled correctly.
615
617
616
618
debug_assert ! ( self . dep_graph. is_green( dep_node) ) ;
617
619
618
620
// First we try to load the result from the on-disk cache.
619
- let result = if Q :: cache_on_disk ( self , key. clone ( ) , None )
621
+ let result = if query . cache_on_disk ( self , key. clone ( ) , None )
620
622
&& self . sess . opts . debugging_opts . incremental_queries
621
623
{
622
624
let prof_timer = self . prof . incr_cache_loading ( ) ;
623
- let result = Q :: try_load_from_disk ( self , prev_dep_node_index) ;
625
+ let result = query . try_load_from_disk ( self , prev_dep_node_index) ;
624
626
prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
625
627
626
628
// We always expect to find a cached result for things that
@@ -644,7 +646,7 @@ impl<'tcx> TyCtxt<'tcx> {
644
646
let prof_timer = self . prof . query_provider ( ) ;
645
647
646
648
// The dep-graph for this computation is already in-place.
647
- let result = self . dep_graph . with_ignore ( || Q :: compute ( self , key) ) ;
649
+ let result = self . dep_graph . with_ignore ( || query . compute ( self , key) ) ;
648
650
649
651
prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
650
652
@@ -654,19 +656,20 @@ impl<'tcx> TyCtxt<'tcx> {
654
656
// If `-Zincremental-verify-ich` is specified, re-hash results from
655
657
// the cache and make sure that they have the expected fingerprint.
656
658
if unlikely ! ( self . sess. opts. debugging_opts. incremental_verify_ich) {
657
- self . incremental_verify_ich :: < Q > ( & result, dep_node, dep_node_index) ;
659
+ self . incremental_verify_ich ( & result, dep_node, dep_node_index, query ) ;
658
660
}
659
661
660
662
result
661
663
}
662
664
663
665
#[ inline( never) ]
664
666
#[ cold]
665
- fn incremental_verify_ich < Q : QueryDescription < ' tcx > > (
667
+ fn incremental_verify_ich < K , V > (
666
668
self ,
667
- result : & Q :: Value ,
669
+ result : & V ,
668
670
dep_node : & DepNode ,
669
671
dep_node_index : DepNodeIndex ,
672
+ query : & QueryVtable < ' tcx , K , V > ,
670
673
) {
671
674
use crate :: ich:: Fingerprint ;
672
675
@@ -680,7 +683,7 @@ impl<'tcx> TyCtxt<'tcx> {
680
683
debug ! ( "BEGIN verify_ich({:?})" , dep_node) ;
681
684
let mut hcx = self . create_stable_hashing_context ( ) ;
682
685
683
- let new_hash = Q :: hash_result ( & mut hcx, result) . unwrap_or ( Fingerprint :: ZERO ) ;
686
+ let new_hash = query . hash_result ( & mut hcx, result) . unwrap_or ( Fingerprint :: ZERO ) ;
684
687
debug ! ( "END verify_ich({:?})" , dep_node) ;
685
688
686
689
let old_hash = self . dep_graph . fingerprint_of ( dep_node_index) ;
0 commit comments