From e7411a26e4a247c86bb14ab37443bbad35c970b0 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 28 May 2021 16:40:22 -0700 Subject: [PATCH] Add specific help for *how* to fix an incremental lock error. --- compiler/rustc_incremental/src/persist/fs.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index a9925832fd8..83e80b55dae 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -521,6 +521,19 @@ fn lock_directory( or disable incremental compilation", session_dir.display() )); + if std::env::var_os("CARGO").is_some() { + err.help( + "incremental compilation can be disabled by setting the \ + environment variable CARGO_INCREMENTAL=0 (see \ + https://doc.rust-lang.org/cargo/reference/profiles.html#incremental)", + ); + err.help( + "the entire build directory can be changed to a different \ + filesystem by setting the environment variable CARGO_TARGET_DIR \ + to a different path (see \ + https://doc.rust-lang.org/cargo/reference/config.html#buildtarget-dir)", + ); + } } err.emit(); Err(ErrorReported)