@@ -8,8 +8,8 @@ use rustc_data_structures::{outline, sharded, sync};
88use rustc_errors:: FatalError ;
99use rustc_middle:: dep_graph:: { DepGraphData , DepNodeKey , SerializedDepNodeIndex } ;
1010use rustc_middle:: query:: {
11- ActiveKeyStatus , CycleError , EnsureMode , QueryCache , QueryJob , QueryJobId , QueryKey ,
12- QueryLatch , QueryMode , QueryState , QueryVTable ,
11+ ActiveKeyStatus , CycleError , QueryCache , QueryJob , QueryJobId , QueryKey , QueryLatch , QueryMode ,
12+ QueryState , QueryVTable ,
1313} ;
1414use rustc_middle:: ty:: TyCtxt ;
1515use rustc_middle:: verify_ich:: incremental_verify_ich;
@@ -18,7 +18,7 @@ use tracing::warn;
1818
1919use crate :: dep_graph:: { DepNode , DepNodeIndex } ;
2020use crate :: job:: { QueryJobInfo , QueryJobMap , find_cycle_in_stack, report_cycle} ;
21- use crate :: plumbing:: { current_query_job, loadable_from_disk , next_job_id, start_query} ;
21+ use crate :: plumbing:: { current_query_job, next_job_id, start_query} ;
2222use crate :: query_impl:: for_each_query_vtable;
2323
2424#[ inline]
@@ -546,15 +546,15 @@ fn load_from_disk_or_invoke_provider_green<'tcx, C: QueryCache>(
546546
547547/// Return value struct for [`check_if_ensure_can_skip_execution`].
548548struct EnsureCanSkip {
549- /// If true, the current `tcx.ensure_ok()` or `tcx.ensure_done()` query
549+ /// If true, the current `tcx.ensure_ok()` query
550550 /// can return early without actually trying to execute.
551551 skip_execution : bool ,
552552 /// A dep node that was prepared while checking whether execution can be
553553 /// skipped, to be reused by execution itself if _not_ skipped.
554554 dep_node : Option < DepNode > ,
555555}
556556
557- /// Checks whether a `tcx.ensure_ok()` or `tcx.ensure_done()` query call can
557+ /// Checks whether a `tcx.ensure_ok()` query call can
558558/// return early without actually trying to execute.
559559///
560560/// This only makes sense during incremental compilation, because it relies
@@ -565,7 +565,6 @@ fn check_if_ensure_can_skip_execution<'tcx, C: QueryCache>(
565565 query : & ' tcx QueryVTable < ' tcx , C > ,
566566 tcx : TyCtxt < ' tcx > ,
567567 key : C :: Key ,
568- ensure_mode : EnsureMode ,
569568) -> EnsureCanSkip {
570569 // Queries with `eval_always` should never skip execution.
571570 if query. eval_always {
@@ -574,38 +573,25 @@ fn check_if_ensure_can_skip_execution<'tcx, C: QueryCache>(
574573
575574 let dep_node = DepNode :: construct ( tcx, query. dep_kind , & key) ;
576575
577- let serialized_dep_node_index = match tcx. dep_graph . try_mark_green ( tcx, & dep_node) {
576+ match tcx. dep_graph . try_mark_green ( tcx, & dep_node) {
578577 None => {
579578 // A None return from `try_mark_green` means that this is either
580579 // a new dep node or that the dep node has already been marked red.
581580 // Either way, we can't call `dep_graph.read()` as we don't have the
582581 // DepNodeIndex. We must invoke the query itself. The performance cost
583582 // this introduces should be negligible as we'll immediately hit the
584583 // in-memory cache, or another query down the line will.
585- return EnsureCanSkip { skip_execution : false , dep_node : Some ( dep_node) } ;
584+ EnsureCanSkip { skip_execution : false , dep_node : Some ( dep_node) }
586585 }
587- Some ( ( serialized_dep_node_index , dep_node_index) ) => {
586+ Some ( ( _ , dep_node_index) ) => {
588587 tcx. dep_graph . read_index ( dep_node_index) ;
589588 tcx. prof . query_cache_hit ( dep_node_index. into ( ) ) ;
590- serialized_dep_node_index
591- }
592- } ;
593589
594- match ensure_mode {
595- EnsureMode :: Ok => {
596590 // In ensure-ok mode, we can skip execution for this key if the node
597591 // is green. It must have succeeded in the previous session, and
598592 // therefore would succeed in the current session if executed.
599593 EnsureCanSkip { skip_execution : true , dep_node : None }
600594 }
601- EnsureMode :: Done => {
602- // In ensure-done mode, we can only skip execution for this key if
603- // there's a disk-cached value available to load later if needed,
604- // which guarantees the query provider will never run for this key.
605- let is_loadable = ( query. will_cache_on_disk_for_key_fn ) ( tcx, key)
606- && loadable_from_disk ( tcx, serialized_dep_node_index) ;
607- EnsureCanSkip { skip_execution : is_loadable, dep_node : Some ( dep_node) }
608- }
609595 }
610596}
611597
@@ -635,13 +621,13 @@ pub(super) fn execute_query_incr_inner<'tcx, C: QueryCache>(
635621) -> Option < C :: Value > {
636622 debug_assert ! ( tcx. dep_graph. is_fully_enabled( ) ) ;
637623
638- // Check if query execution can be skipped, for `ensure_ok` or `ensure_done` .
624+ // Check if query execution can be skipped, for `ensure_ok`.
639625 // This might have the side-effect of creating a suitable DepNode, which
640626 // we should reuse for execution instead of creating a new one.
641627 let dep_node: Option < DepNode > = match mode {
642- QueryMode :: Ensure { ensure_mode } => {
628+ QueryMode :: Ensure => {
643629 let EnsureCanSkip { skip_execution, dep_node } =
644- check_if_ensure_can_skip_execution ( query, tcx, key, ensure_mode ) ;
630+ check_if_ensure_can_skip_execution ( query, tcx, key) ;
645631 if skip_execution {
646632 // Return early to skip execution.
647633 return None ;
0 commit comments