mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
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
1 changed files with 4 additions and 3 deletions
|
@ -138,7 +138,7 @@ impl WorkspaceBuildScripts {
|
||||||
toolchain: &Option<Version>,
|
toolchain: &Option<Version>,
|
||||||
sysroot: Option<&Sysroot>,
|
sysroot: Option<&Sysroot>,
|
||||||
) -> io::Result<WorkspaceBuildScripts> {
|
) -> 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 {
|
let current_dir = match &config.invocation_location {
|
||||||
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {
|
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {
|
||||||
|
@ -162,7 +162,7 @@ impl WorkspaceBuildScripts {
|
||||||
progress,
|
progress,
|
||||||
) {
|
) {
|
||||||
Ok(WorkspaceBuildScripts { error: Some(error), .. })
|
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
|
// building build scripts failed, attempt to build with --keep-going so
|
||||||
// that we potentially get more build data
|
// that we potentially get more build data
|
||||||
|
@ -172,7 +172,8 @@ impl WorkspaceBuildScripts {
|
||||||
&workspace.workspace_root().to_path_buf(),
|
&workspace.workspace_root().to_path_buf(),
|
||||||
sysroot,
|
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)?;
|
let mut res = Self::run_per_ws(cmd, workspace, current_dir, progress)?;
|
||||||
res.error = Some(error);
|
res.error = Some(error);
|
||||||
Ok(res)
|
Ok(res)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue