Skip to content

Commit 838523d

Browse files
committed
Auto merge of #16621 - txase:no-build-with-bootstrap, r=Veykril
fix: Recompiles due to RUSTC_BOOTSTRAP 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. This causes flapping recompiles when building outside of RA. Fixes #15057
2 parents c45b355 + 2826eb5 commit 838523d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

crates/project-model/src/build_scripts.rs

+4-3
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)

crates/project-model/src/target_data_layout.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@ pub fn get(
3232
Sysroot::set_rustup_toolchain_env(&mut cmd, sysroot);
3333
cmd.envs(extra_env);
3434
cmd.current_dir(cargo_toml.parent())
35-
.args(["rustc", "--", "-Z", "unstable-options", "--print", "target-spec-json"])
35+
.args([
36+
"rustc",
37+
"-Z",
38+
"unstable-options",
39+
"--print",
40+
"target-spec-json",
41+
"--",
42+
"-Z",
43+
"unstable-options",
44+
])
3645
.env("RUSTC_BOOTSTRAP", "1");
3746
if let Some(target) = target {
3847
cmd.args(["--target", target]);

0 commit comments

Comments
 (0)