about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-05-06 13:44:17 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2021-05-08 22:05:42 -0400
commit572d14db8c218268ba23537db99476c68f68df07 (patch)
treed5053d6f5b17a0ebb88f50ede46a1ef0d3c607b4
parent6d698cecf5f13d3809a6676ce920787ea1716558 (diff)
downloadrust-572d14db8c218268ba23537db99476c68f68df07.tar.gz
rust-572d14db8c218268ba23537db99476c68f68df07.zip
Show nicer error when an 'unstable fingerprints' error occurs
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index 77267489a75..5a825e6775b 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -590,7 +590,18 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
 
     let old_hash = tcx.dep_graph().fingerprint_of(dep_node_index);
 
-    assert!(new_hash == old_hash, "found unstable fingerprints for {:?}: {:?}", dep_node, result);
+    if new_hash != old_hash {
+        let run_cmd = if let Some(crate_name) = &tcx.sess().opts.crate_name {
+            format!("`cargo clean -p {}` or `cargo clean`", crate_name)
+        } else {
+            "`cargo clean`".to_string()
+        };
+        tcx.sess().struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node))
+            .help(&format!("This is a known issue with the compiler. Run {} to allow your project to compile", run_cmd))
+            .note(&format!("Please follow the instructions below to create a bug report with the provided information"))
+            .emit();
+        panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
+    }
 }
 
 fn force_query_with_job<C, CTX>(