diff options
| author | Chase Douglas <chase@stackery.io> | 2024-02-20 16:42:20 -0800 |
|---|---|---|
| committer | Chase Douglas <chase@stackery.io> | 2024-02-20 16:42:20 -0800 |
| commit | 344a79c17dd321279897cc287313ff38e0fe255e (patch) | |
| tree | 308cf3afa0ec81a43e77165dc4ead84bb0f8553d | |
| parent | 543d7e98dbcc0668528dbf3f5b32d752882baa33 (diff) | |
| download | rust-344a79c17dd321279897cc287313ff38e0fe255e.tar.gz rust-344a79c17dd321279897cc287313ff38e0fe255e.zip | |
Drop RUSTC_BOOTSTRAP env var when building build scripts
Some packages (e.g. thiserror) force a recompile if the value of the `RUSTC_BOOTSTRAP` env var changes. RA sets the variable to 1 in order to enable rustc / cargo unstable options it uses. This causes flapping recompiles when building outside of RA. As of Cargo 1.75 the `--keep-going` flag is stable. This change uses the flag without `RUSTC_BOOTSTRAP` if the Cargo version is >= 1.75, and drops `--keep-going` otherwise. This fixes build script recompilation.
| -rw-r--r-- | crates/project-model/src/build_scripts.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/project-model/src/build_scripts.rs b/crates/project-model/src/build_scripts.rs index ab72f1fba09..621b6ca3efa 100644 --- a/crates/project-model/src/build_scripts.rs +++ b/crates/project-model/src/build_scripts.rs @@ -138,7 +138,7 @@ impl WorkspaceBuildScripts { toolchain: &Option<Version>, sysroot: Option<&Sysroot>, ) -> io::Result<WorkspaceBuildScripts> { - const RUST_1_62: Version = Version::new(1, 62, 0); + const RUST_1_75: Version = Version::new(1, 75, 0); let current_dir = match &config.invocation_location { InvocationLocation::Root(root) if config.run_build_script_command.is_some() => { @@ -162,7 +162,7 @@ impl WorkspaceBuildScripts { progress, ) { Ok(WorkspaceBuildScripts { error: Some(error), .. }) - if toolchain.as_ref().map_or(false, |it| *it >= RUST_1_62) => + if toolchain.as_ref().map_or(false, |it| *it >= RUST_1_75) => { // building build scripts failed, attempt to build with --keep-going so // that we potentially get more build data @@ -172,7 +172,8 @@ impl WorkspaceBuildScripts { &workspace.workspace_root().to_path_buf(), sysroot, )?; - cmd.args(["-Z", "unstable-options", "--keep-going"]).env("RUSTC_BOOTSTRAP", "1"); + + cmd.args(["--keep-going"]); let mut res = Self::run_per_ws(cmd, workspace, current_dir, progress)?; res.error = Some(error); Ok(res) |
