Skip to content

Commit a142fcf

Browse files
committed
Only pass -Zincremental-verify-ich for incremental compiles
1 parent 3659db0 commit a142fcf

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,18 @@ fn encode_query_values_inner<'a, 'tcx, C, V>(
100100
}
101101

102102
pub(crate) fn verify_query_key_hashes<'tcx>(tcx: TyCtxt<'tcx>) {
103-
if tcx.sess.opts.unstable_opts.incremental_verify_ich || cfg!(debug_assertions) {
103+
// Under debug assertions, always check for query key fingerprint collisions.
104+
// Fingerprints do not depend on whether a dep graph exists, so a collision
105+
// found in a non-incremental build means incremental compilation of the same
106+
// code would misbehave — the broad non-incremental test coverage is valuable.
107+
//
108+
// `-Zincremental-verify-ich`, however, asks to verify incremental compilation
109+
// hashes: without a dep graph there is nothing to verify, and the sweep would
110+
// only waste time. This matters because rustc-perf passes the flag on every
111+
// compile, including non-incremental benchmark runs.
112+
if cfg!(debug_assertions)
113+
|| (tcx.sess.opts.unstable_opts.incremental_verify_ich && tcx.dep_graph.is_fully_enabled())
114+
{
104115
tcx.sess.time("verify_query_key_hashes", || {
105116
for_each_query_vtable!(ALL, tcx, |query| {
106117
verify_query_key_hashes_inner(query, tcx);

0 commit comments

Comments
 (0)