Skip to content

Commit 572d14d

Browse files
Aaron1011Mark-Simulacrum
authored andcommitted
Show nicer error when an 'unstable fingerprints' error occurs
1 parent 6d698ce commit 572d14d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

compiler/rustc_query_system/src/query/plumbing.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,18 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
590590

591591
let old_hash = tcx.dep_graph().fingerprint_of(dep_node_index);
592592

593-
assert!(new_hash == old_hash, "found unstable fingerprints for {:?}: {:?}", dep_node, result);
593+
if new_hash != old_hash {
594+
let run_cmd = if let Some(crate_name) = &tcx.sess().opts.crate_name {
595+
format!("`cargo clean -p {}` or `cargo clean`", crate_name)
596+
} else {
597+
"`cargo clean`".to_string()
598+
};
599+
tcx.sess().struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node))
600+
.help(&format!("This is a known issue with the compiler. Run {} to allow your project to compile", run_cmd))
601+
.note(&format!("Please follow the instructions below to create a bug report with the provided information"))
602+
.emit();
603+
panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
604+
}
594605
}
595606

596607
fn force_query_with_job<C, CTX>(

0 commit comments

Comments
 (0)