From eaf7eb97bfd50ff7ca43d5b78007da0f457e8565 Mon Sep 17 00:00:00 2001 From: Michael Hinton Date: Thu, 11 Jul 2024 13:02:32 -0600 Subject: [PATCH] Do not let cc-rs trigger a rebuild any time the env changes --- build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.rs b/build.rs index 886ff9536..af5805d9c 100644 --- a/build.rs +++ b/build.rs @@ -97,6 +97,11 @@ fn new_build() -> cc::Build { if !is_windows_msvc() { build.flag("-std=c11"); } + // Do NOT trigger a rebuild any time the env changes (e.g. $PATH). + // This prevents all downstream crates from being rebuilt when `cargo check` + // or `cargo build` are run in different environments, like Rust Analyzer + // vs. in the terminal vs. in a Git pre-commit hook. + build.emit_rerun_if_env_changed(false); build }