Skip to content

Commit 344a79c

Browse files
committed
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.
1 parent 543d7e9 commit 344a79c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/project-model/src/build_scripts.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl WorkspaceBuildScripts {
138138
toolchain: &Option<Version>,
139139
sysroot: Option<&Sysroot>,
140140
) -> io::Result<WorkspaceBuildScripts> {
141-
const RUST_1_62: Version = Version::new(1, 62, 0);
141+
const RUST_1_75: Version = Version::new(1, 75, 0);
142142

143143
let current_dir = match &config.invocation_location {
144144
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {
@@ -162,7 +162,7 @@ impl WorkspaceBuildScripts {
162162
progress,
163163
) {
164164
Ok(WorkspaceBuildScripts { error: Some(error), .. })
165-
if toolchain.as_ref().map_or(false, |it| *it >= RUST_1_62) =>
165+
if toolchain.as_ref().map_or(false, |it| *it >= RUST_1_75) =>
166166
{
167167
// building build scripts failed, attempt to build with --keep-going so
168168
// that we potentially get more build data
@@ -172,7 +172,8 @@ impl WorkspaceBuildScripts {
172172
&workspace.workspace_root().to_path_buf(),
173173
sysroot,
174174
)?;
175-
cmd.args(["-Z", "unstable-options", "--keep-going"]).env("RUSTC_BOOTSTRAP", "1");
175+
176+
cmd.args(["--keep-going"]);
176177
let mut res = Self::run_per_ws(cmd, workspace, current_dir, progress)?;
177178
res.error = Some(error);
178179
Ok(res)

0 commit comments

Comments
 (0)