File tree 1 file changed +14
-1
lines changed
compiler/rustc_query_system/src/query
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -520,7 +520,20 @@ where
520
520
if let Some ( result) = result {
521
521
// If `-Zincremental-verify-ich` is specified, re-hash results from
522
522
// the cache and make sure that they have the expected fingerprint.
523
- if unlikely ! ( tcx. dep_context( ) . sess( ) . opts. debugging_opts. incremental_verify_ich) {
523
+ let prev_fingerprint = tcx
524
+ . dep_context ( )
525
+ . dep_graph ( )
526
+ . prev_fingerprint_of ( dep_node)
527
+ . unwrap_or ( Fingerprint :: ZERO ) ;
528
+ // A fingerprint is 128 bits, and this checks if 5 of those bits are
529
+ // zero. If the fingerprint is fully random (as we hope for), this
530
+ // should limit us to checking every `2^5`th hash. This reduces the
531
+ // number of hashes we check low enough that the overhead of
532
+ // verification is acceptable to always enable.
533
+ let try_verify = prev_fingerprint. as_value ( ) . 1 & 0x1f == 0 ;
534
+ if try_verify
535
+ || unlikely ! ( tcx. dep_context( ) . sess( ) . opts. debugging_opts. incremental_verify_ich)
536
+ {
524
537
incremental_verify_ich ( * tcx. dep_context ( ) , & result, dep_node, query) ;
525
538
}
526
539
You can’t perform that action at this time.
0 commit comments