Skip to content

Commit 7e4d056

Browse files
Aaron1011Mark-Simulacrum
authored andcommitted
Show nicer error when an 'unstable fingerprints' error occurs
1 parent e96136a commit 7e4d056

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

compiler/rustc_query_system/src/query/plumbing.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -585,13 +585,18 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
585585

586586
let old_hash = tcx.dep_graph().prev_fingerprint_of(dep_node);
587587

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

597602
fn force_query_with_job<C, CTX>(

0 commit comments

Comments
 (0)