4
4
5
5
use crate :: dep_graph:: { DepKind , DepNode , DepNodeIndex , SerializedDepNodeIndex } ;
6
6
use crate :: ty:: query:: caches:: QueryCache ;
7
- use crate :: ty:: query:: config:: QueryDescription ;
7
+ use crate :: ty:: query:: config:: { QueryDescription , QueryVtable } ;
8
8
use crate :: ty:: query:: job:: { QueryInfo , QueryJob , QueryJobId , QueryJobInfo , QueryShardJobId } ;
9
9
use crate :: ty:: query:: Query ;
10
10
use crate :: ty:: tls;
@@ -160,7 +160,7 @@ where
160
160
id : QueryJobId ,
161
161
}
162
162
163
- impl < ' tcx , C : QueryCache > JobOwner < ' tcx , C >
163
+ impl < ' tcx , C > JobOwner < ' tcx , C >
164
164
where
165
165
C : QueryCache ,
166
166
C :: Key : Eq + Hash + Clone + Debug ,
@@ -545,7 +545,7 @@ impl<'tcx> TyCtxt<'tcx> {
545
545
// expensive for some `DepKind`s.
546
546
if !self . dep_graph . is_fully_enabled ( ) {
547
547
let null_dep_node = DepNode :: new_no_params ( crate :: dep_graph:: DepKind :: Null ) ;
548
- return self . force_query_with_job :: < Q > ( key, job, null_dep_node) . 0 ;
548
+ return self . force_query_with_job ( key, job, null_dep_node, & Q :: reify ( ) ) . 0 ;
549
549
}
550
550
551
551
if Q :: ANON {
@@ -598,7 +598,7 @@ impl<'tcx> TyCtxt<'tcx> {
598
598
}
599
599
}
600
600
601
- let ( result, dep_node_index) = self . force_query_with_job :: < Q > ( key, job, dep_node) ;
601
+ let ( result, dep_node_index) = self . force_query_with_job ( key, job, dep_node, & Q :: reify ( ) ) ;
602
602
self . dep_graph . read_index ( dep_node_index) ;
603
603
result
604
604
}
@@ -689,12 +689,18 @@ impl<'tcx> TyCtxt<'tcx> {
689
689
}
690
690
691
691
#[ inline( always) ]
692
- fn force_query_with_job < Q : QueryDescription < ' tcx > > (
692
+ fn force_query_with_job < C > (
693
693
self ,
694
- key : Q :: Key ,
695
- job : JobOwner < ' tcx , Q :: Cache > ,
694
+ key : C :: Key ,
695
+ job : JobOwner < ' tcx , C > ,
696
696
dep_node : DepNode ,
697
- ) -> ( Q :: Value , DepNodeIndex ) {
697
+ query : & QueryVtable < ' tcx , C :: Key , C :: Value > ,
698
+ ) -> ( C :: Value , DepNodeIndex )
699
+ where
700
+ C : QueryCache ,
701
+ C :: Key : Eq + Hash + Clone + Debug ,
702
+ C :: Value : Clone ,
703
+ {
698
704
// If the following assertion triggers, it can have two reasons:
699
705
// 1. Something is wrong with DepNode creation, either here or
700
706
// in `DepGraph::try_mark_green()`.
@@ -713,16 +719,16 @@ impl<'tcx> TyCtxt<'tcx> {
713
719
714
720
let ( ( result, dep_node_index) , diagnostics) = with_diagnostics ( |diagnostics| {
715
721
self . start_query ( job. id , diagnostics, |tcx| {
716
- if Q :: EVAL_ALWAYS {
722
+ if query . eval_always {
717
723
tcx. dep_graph . with_eval_always_task (
718
724
dep_node,
719
725
tcx,
720
726
key,
721
- Q :: compute,
722
- Q :: hash_result,
727
+ query . compute ,
728
+ query . hash_result ,
723
729
)
724
730
} else {
725
- tcx. dep_graph . with_task ( dep_node, tcx, key, Q :: compute, Q :: hash_result)
731
+ tcx. dep_graph . with_task ( dep_node, tcx, key, query . compute , query . hash_result )
726
732
}
727
733
} )
728
734
} ) ;
@@ -797,7 +803,7 @@ impl<'tcx> TyCtxt<'tcx> {
797
803
#[ cfg( parallel_compiler) ]
798
804
TryGetJob :: JobCompleted ( _) => return ,
799
805
} ;
800
- self . force_query_with_job :: < Q > ( key, job, dep_node) ;
806
+ self . force_query_with_job ( key, job, dep_node, & Q :: reify ( ) ) ;
801
807
} ,
802
808
) ;
803
809
}
0 commit comments