From ee370a1157be0b0260a7804c91a8e78fd03e932a Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 15 Jan 2024 09:23:05 -0800 Subject: Consistently unset RUSTC_BOOTSTRAP when compiling bootstrap --- src/bootstrap/bootstrap.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/bootstrap/bootstrap.py') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index fea194a80ef..6f3be1f6e93 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -917,6 +917,19 @@ class RustBuild(object): if toml_val is not None: env["{}_{}".format(var_name, host_triple_sanitized)] = toml_val + # In src/etc/rust_analyzer_settings.json, we configure rust-analyzer to + # pass RUSTC_BOOTSTRAP=1 to all cargo invocations because the standard + # library uses unstable Cargo features. Without RUSTC_BOOTSTRAP, + # rust-analyzer would fail to fetch workspace layout when the system's + # default toolchain is not nightly. + # + # But that setting has the collateral effect of rust-analyzer also + # passing RUSTC_BOOTSTRAP=1 to all x.py invocations too (the various + # overrideCommand). For compiling bootstrap, that is unwanted and can + # cause spurious rebuilding of bootstrap when rust-analyzer x.py + # invocations are interleaved with handwritten ones on the command line. + env.pop("RUSTC_BOOTSTRAP", None) + # preserve existing RUSTFLAGS env.setdefault("RUSTFLAGS", "") -- cgit 1.4.1-3-g733a5 From 21b4fe222f73e5f2b1791004071d73c19a63d08c Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Thu, 18 Jan 2024 15:50:40 +0300 Subject: Set RUSTC_BOOTSTRAP=1 consistently Signed-off-by: onur-ozkan --- src/bootstrap/bootstrap.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/bootstrap/bootstrap.py') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 6f3be1f6e93..28d96cb1cfe 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -924,14 +924,17 @@ class RustBuild(object): # default toolchain is not nightly. # # But that setting has the collateral effect of rust-analyzer also - # passing RUSTC_BOOTSTRAP=1 to all x.py invocations too (the various - # overrideCommand). For compiling bootstrap, that is unwanted and can - # cause spurious rebuilding of bootstrap when rust-analyzer x.py - # invocations are interleaved with handwritten ones on the command line. - env.pop("RUSTC_BOOTSTRAP", None) - - # preserve existing RUSTFLAGS - env.setdefault("RUSTFLAGS", "") + # passing RUSTC_BOOTSTRAP=1 to all x.py invocations too (the various overrideCommand). + # For compiling bootstrap that can cause spurious rebuilding of bootstrap when + # rust-analyzer x.py invocations are interleaved with handwritten ones on the + # command line. + # + # Set RUSTC_BOOTSTRAP=1 consistently. + env["RUSTC_BOOTSTRAP"] = "1" + + default_rustflags = "" if env.get("RUSTFLAGS_BOOTSTRAP", "") else "-Zallow-features=" + + env.setdefault("RUSTFLAGS", default_rustflags) target_features = [] if self.get_toml("crt-static", build_section) == "true": -- cgit 1.4.1-3-g733a5