@@ -528,7 +528,8 @@ where
528
528
debug_assert ! ( tcx. dep_context( ) . dep_graph( ) . is_green( dep_node) ) ;
529
529
530
530
// First we try to load the result from the on-disk cache.
531
- let result = if query. cache_on_disk ( tcx, key, None ) {
531
+ // Some things are never cached on disk.
532
+ if query. cache_on_disk ( tcx, key, None ) {
532
533
let prof_timer = tcx. dep_context ( ) . profiler ( ) . incr_cache_loading ( ) ;
533
534
let result = query. try_load_from_disk ( tcx, prev_dep_node_index) ;
534
535
prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
@@ -540,44 +541,38 @@ where
540
541
"missing on-disk cache entry for {:?}" ,
541
542
dep_node
542
543
) ;
543
- result
544
- } else {
545
- // Some things are never cached on disk.
546
- None
547
- } ;
548
544
549
- let result = if let Some ( result) = result {
550
- // If `-Zincremental-verify-ich` is specified, re-hash results from
551
- // the cache and make sure that they have the expected fingerprint.
552
- if unlikely ! ( tcx. dep_context( ) . sess( ) . opts. debugging_opts. incremental_verify_ich) {
553
- incremental_verify_ich ( * tcx. dep_context ( ) , & result, dep_node, query) ;
554
- }
545
+ if let Some ( result) = result {
546
+ // If `-Zincremental-verify-ich` is specified, re-hash results from
547
+ // the cache and make sure that they have the expected fingerprint.
548
+ if unlikely ! ( tcx. dep_context( ) . sess( ) . opts. debugging_opts. incremental_verify_ich) {
549
+ incremental_verify_ich ( * tcx. dep_context ( ) , & result, dep_node, query) ;
550
+ }
555
551
556
- result
557
- } else {
558
- // We could not load a result from the on-disk cache, so
559
- // recompute.
560
- let prof_timer = tcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
552
+ return Some ( ( result, dep_node_index) ) ;
553
+ }
554
+ }
561
555
562
- // The dep-graph for this computation is already in-place.
563
- let result =
564
- tcx. dep_context ( ) . dep_graph ( ) . with_ignore ( || compute ( * tcx . dep_context ( ) , key . clone ( ) ) ) ;
556
+ // We could not load a result from the on-disk cache, so
557
+ // recompute.
558
+ let prof_timer = tcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
565
559
566
- prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
560
+ // The dep-graph for this computation is already in-place.
561
+ let result =
562
+ tcx. dep_context ( ) . dep_graph ( ) . with_ignore ( || compute ( * tcx. dep_context ( ) , key. clone ( ) ) ) ;
567
563
568
- // Verify that re-running the query produced a result with the expected hash
569
- // This catches bugs in query implementations, turning them into ICEs.
570
- // For example, a query might sort its result by `DefId` - since `DefId`s are
571
- // not stable across compilation sessions, the result could get up getting sorted
572
- // in a different order when the query is re-run, even though all of the inputs
573
- // (e.g. `DefPathHash` values) were green.
574
- //
575
- // See issue #82920 for an example of a miscompilation that would get turned into
576
- // an ICE by this check
577
- incremental_verify_ich ( * tcx. dep_context ( ) , & result, dep_node, query) ;
564
+ prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
578
565
579
- result
580
- } ;
566
+ // Verify that re-running the query produced a result with the expected hash
567
+ // This catches bugs in query implementations, turning them into ICEs.
568
+ // For example, a query might sort its result by `DefId` - since `DefId`s are
569
+ // not stable across compilation sessions, the result could get up getting sorted
570
+ // in a different order when the query is re-run, even though all of the inputs
571
+ // (e.g. `DefPathHash` values) were green.
572
+ //
573
+ // See issue #82920 for an example of a miscompilation that would get turned into
574
+ // an ICE by this check
575
+ incremental_verify_ich ( * tcx. dep_context ( ) , & result, dep_node, query) ;
581
576
582
577
Some ( ( result, dep_node_index) )
583
578
}
0 commit comments