diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-10-26 22:13:23 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-10-28 09:57:31 -0400 |
| commit | 49e7c993ee4ab98f53898685394e9c2b3fa954dc (patch) | |
| tree | aa2786825c14c3bd3a299ab05602ada9c4b67ce4 /compiler | |
| parent | c7a30c8b6860d1f3459086f7a91074db1b54bc37 (diff) | |
| download | rust-49e7c993ee4ab98f53898685394e9c2b3fa954dc.tar.gz rust-49e7c993ee4ab98f53898685394e9c2b3fa954dc.zip | |
Enable verification for 1/32th of queries loaded from disk
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_query_system/src/query/plumbing.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 238b92a6134..9703f0c3d96 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -518,9 +518,22 @@ where prof_timer.finish_with_query_invocation_id(dep_node_index.into()); if let Some(result) = result { + let prev_fingerprint = tcx + .dep_context() + .dep_graph() + .prev_fingerprint_of(dep_node) + .unwrap_or(Fingerprint::ZERO); // If `-Zincremental-verify-ich` is specified, re-hash results from // the cache and make sure that they have the expected fingerprint. - if unlikely!(tcx.dep_context().sess().opts.debugging_opts.incremental_verify_ich) { + // + // If not, we still seek to verify a subset of fingerprints loaded + // from disk. Re-hashing results is fairly expensive, so we can't + // currently afford to verify every hash. This subset should still + // give us some coverage of potential bugs though. + let try_verify = prev_fingerprint.as_value().1 % 32 == 0; + if unlikely!( + try_verify || tcx.dep_context().sess().opts.debugging_opts.incremental_verify_ich + ) { incremental_verify_ich(*tcx.dep_context(), &result, dep_node, query); } |
