about summary refs log tree commit diff
path: root/src/bootstrap/bootstrap.py
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2024-01-15 09:23:05 -0800
committerDavid Tolnay <dtolnay@gmail.com>2024-01-15 10:05:50 -0800
commitee370a1157be0b0260a7804c91a8e78fd03e932a (patch)
tree92c5fe2f1037a617431243d6b493cfc1b9e60b6a /src/bootstrap/bootstrap.py
parent1ead4761e9e2f056385768614c23ffa7acb6a19e (diff)
downloadrust-ee370a1157be0b0260a7804c91a8e78fd03e932a.tar.gz
rust-ee370a1157be0b0260a7804c91a8e78fd03e932a.zip
Consistently unset RUSTC_BOOTSTRAP when compiling bootstrap
Diffstat (limited to 'src/bootstrap/bootstrap.py')
-rw-r--r--src/bootstrap/bootstrap.py13
1 files changed, 13 insertions, 0 deletions
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", "")