about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-08 06:22:21 +0000
committerbors <bors@rust-lang.org>2022-05-08 06:22:21 +0000
commit30046ce1fe8d00e576cc7b91404c7cf79aaa5a3b (patch)
tree56b27196286a067bf8575e810a3a1fcaf46a4f22
parent030c886c29ffbfbb9f9c6495651cb4bee0fc93fe (diff)
parent2878f98672ea8b5d69c2139a0784e41c90de1d9b (diff)
downloadrust-30046ce1fe8d00e576cc7b91404c7cf79aaa5a3b.tar.gz
rust-30046ce1fe8d00e576cc7b91404c7cf79aaa5a3b.zip
Auto merge of #96457 - yungkneez:fix-bootstrap, r=Mark-Simulacrum
Initialize rust-analyzer submodule on bootstrap

Fixes #96456
-rw-r--r--src/bootstrap/bootstrap.py4
-rw-r--r--src/bootstrap/lib.rs9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index e38a574ca23..ab4338e1c85 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -998,6 +998,10 @@ class RustBuild(object):
             "library/backtrace",
             "library/stdarch"
         ]
+        # If build.vendor is set in config.toml, we must update rust-analyzer also.
+        # Otherwise, the bootstrap will fail (#96456).
+        if self.use_vendored_sources:
+            submodules.append("src/tools/rust-analyzer")
         filtered_submodules = []
         submodules_names = []
         for module in submodules:
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index b4b973b4247..5d32b4f801a 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -609,7 +609,7 @@ impl Build {
     /// This avoids contributors checking in a submodule change by accident.
     pub fn maybe_update_submodules(&self) {
         // WARNING: keep this in sync with the submodules hard-coded in bootstrap.py
-        const BOOTSTRAP_SUBMODULES: &[&str] = &[
+        let mut bootstrap_submodules: Vec<&str> = vec![
             "src/tools/rust-installer",
             "src/tools/cargo",
             "src/tools/rls",
@@ -617,6 +617,11 @@ impl Build {
             "library/backtrace",
             "library/stdarch",
         ];
+        // As in bootstrap.py, we include `rust-analyzer` if `build.vendor` was set in
+        // `config.toml`.
+        if self.config.vendor {
+            bootstrap_submodules.push("src/tools/rust-analyzer");
+        }
         // Avoid running git when there isn't a git checkout.
         if !self.config.submodules(&self.rust_info) {
             return;
@@ -632,7 +637,7 @@ impl Build {
             // Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
             let submodule = Path::new(line.splitn(2, ' ').nth(1).unwrap());
             // avoid updating submodules twice
-            if !BOOTSTRAP_SUBMODULES.iter().any(|&p| Path::new(p) == submodule)
+            if !bootstrap_submodules.iter().any(|&p| Path::new(p) == submodule)
                 && channel::GitInfo::new(false, submodule).is_git()
             {
                 self.update_submodule(submodule);