diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_query_system/src/query/plumbing.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 77267489a75..da372091608 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -590,7 +590,19 @@ 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")) + .note(&format!("See <https://github.com/rust-lang/rust/issues/84970> for more information.")) + .emit(); + panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result); + } } fn force_query_with_job<C, CTX>( diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 75078a12311..85448b7fe72 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1885,7 +1885,12 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { check_thread_count(&debugging_opts, error_format); - let incremental = cg.incremental.as_ref().map(PathBuf::from); + let incremental = + if std::env::var_os("RUSTC_FORCE_INCREMENTAL").map(|v| v == "1").unwrap_or(false) { + cg.incremental.as_ref().map(PathBuf::from) + } else { + None + }; if debugging_opts.profile && incremental.is_some() { early_error( |
