@@ -559,24 +559,8 @@ impl<'tcx> TyCtxt<'tcx> {
559559 let dep_node = Q :: to_dep_node ( self , & key) ;
560560
561561 if !Q :: EVAL_ALWAYS {
562- // The diagnostics for this query will be
563- // promoted to the current session during
564- // `try_mark_green()`, so we can ignore them here.
565- let loaded = self . start_query ( job. id , None , |tcx| {
566- let marked = tcx. dep_graph . try_mark_green_and_read ( tcx, & dep_node) ;
567- marked. map ( |( prev_dep_node_index, dep_node_index) | {
568- (
569- tcx. load_from_disk_and_cache_in_memory (
570- key. clone ( ) ,
571- prev_dep_node_index,
572- dep_node_index,
573- & dep_node,
574- & Q :: reify ( ) ,
575- ) ,
576- dep_node_index,
577- )
578- } )
579- } ) ;
562+ let loaded = self . start_incremental_query ( key. clone ( ) , & dep_node, job. id , & Q :: reify ( ) ) ;
563+
580564 if let Some ( ( result, dep_node_index) ) = loaded {
581565 job. complete ( & result, dep_node_index) ;
582566 return result;
@@ -616,6 +600,36 @@ impl<'tcx> TyCtxt<'tcx> {
616600 return ( result, dep_node_index) ;
617601 }
618602
603+ #[ inline( always) ]
604+ fn start_incremental_query < K : Clone , V > (
605+ self ,
606+ key : K ,
607+ dep_node : & DepNode ,
608+ job_id : QueryJobId ,
609+ query : & QueryVtable < ' tcx , K , V > ,
610+ ) -> Option < ( V , DepNodeIndex ) > {
611+ assert ! ( !query. eval_always) ;
612+
613+ // The diagnostics for this query will be
614+ // promoted to the current session during
615+ // `try_mark_green()`, so we can ignore them here.
616+ self . start_query ( job_id, None , |tcx| {
617+ let marked = tcx. dep_graph . try_mark_green_and_read ( tcx, & dep_node) ;
618+ marked. map ( |( prev_dep_node_index, dep_node_index) | {
619+ (
620+ tcx. load_from_disk_and_cache_in_memory (
621+ key,
622+ prev_dep_node_index,
623+ dep_node_index,
624+ & dep_node,
625+ query,
626+ ) ,
627+ dep_node_index,
628+ )
629+ } )
630+ } )
631+ }
632+
619633 fn load_from_disk_and_cache_in_memory < K : Clone , V > (
620634 self ,
621635 key : K ,
0 commit comments