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.
This commit is contained in:
parent
543d7e98db
commit
344a79c17d
@ -138,7 +138,7 @@ pub(crate) fn run_for_workspace(
|
||||
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 @@ pub(crate) fn run_for_workspace(
|
||||
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 @@ pub(crate) fn run_for_workspace(
|
||||
&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)
|
||||
|
Loading…
Reference in New Issue
Block a user