44
55use crate :: dep_graph:: { DepKind , DepNode , DepNodeIndex , SerializedDepNodeIndex } ;
66use crate :: ty:: query:: caches:: QueryCache ;
7- use crate :: ty:: query:: config:: QueryDescription ;
7+ use crate :: ty:: query:: config:: { QueryDescription , QueryVtable } ;
88use crate :: ty:: query:: job:: { QueryInfo , QueryJob , QueryJobId , QueryJobInfo , QueryShardJobId } ;
99use crate :: ty:: query:: Query ;
1010use crate :: ty:: tls;
@@ -160,7 +160,7 @@ where
160160 id : QueryJobId ,
161161}
162162
163- impl < ' tcx , C : QueryCache > JobOwner < ' tcx , C >
163+ impl < ' tcx , C > JobOwner < ' tcx , C >
164164where
165165 C : QueryCache ,
166166 C :: Key : Eq + Hash + Clone + Debug ,
@@ -545,7 +545,7 @@ impl<'tcx> TyCtxt<'tcx> {
545545 // expensive for some `DepKind`s.
546546 if !self . dep_graph . is_fully_enabled ( ) {
547547 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 ;
549549 }
550550
551551 if Q :: ANON {
@@ -598,7 +598,7 @@ impl<'tcx> TyCtxt<'tcx> {
598598 }
599599 }
600600
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 ( ) ) ;
602602 self . dep_graph . read_index ( dep_node_index) ;
603603 result
604604 }
@@ -689,12 +689,18 @@ impl<'tcx> TyCtxt<'tcx> {
689689 }
690690
691691 #[ inline( always) ]
692- fn force_query_with_job < Q : QueryDescription < ' tcx > > (
692+ fn force_query_with_job < C > (
693693 self ,
694- key : Q :: Key ,
695- job : JobOwner < ' tcx , Q :: Cache > ,
694+ key : C :: Key ,
695+ job : JobOwner < ' tcx , C > ,
696696 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+ {
698704 // If the following assertion triggers, it can have two reasons:
699705 // 1. Something is wrong with DepNode creation, either here or
700706 // in `DepGraph::try_mark_green()`.
@@ -713,16 +719,16 @@ impl<'tcx> TyCtxt<'tcx> {
713719
714720 let ( ( result, dep_node_index) , diagnostics) = with_diagnostics ( |diagnostics| {
715721 self . start_query ( job. id , diagnostics, |tcx| {
716- if Q :: EVAL_ALWAYS {
722+ if query . eval_always {
717723 tcx. dep_graph . with_eval_always_task (
718724 dep_node,
719725 tcx,
720726 key,
721- Q :: compute,
722- Q :: hash_result,
727+ query . compute ,
728+ query . hash_result ,
723729 )
724730 } 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 )
726732 }
727733 } )
728734 } ) ;
@@ -797,7 +803,7 @@ impl<'tcx> TyCtxt<'tcx> {
797803 #[ cfg( parallel_compiler) ]
798804 TryGetJob :: JobCompleted ( _) => return ,
799805 } ;
800- self . force_query_with_job :: < Q > ( key, job, dep_node) ;
806+ self . force_query_with_job ( key, job, dep_node, & Q :: reify ( ) ) ;
801807 } ,
802808 ) ;
803809 }
0 commit comments