]> git.lizzy.rs Git - rust.git/commitdiff
Initialize rust-analyzer submodule on bootstrap
authoryungkneez <brendonfederko@outlook.com>
Wed, 27 Apr 2022 00:01:40 +0000 (17:01 -0700)
committeryungkneez <brendonfederko@outlook.com>
Mon, 2 May 2022 00:36:39 +0000 (17:36 -0700)
src/bootstrap/bootstrap.py
src/bootstrap/lib.rs

index ac1c47524fd0e2f65c295411645e47dfafcfe69a..b94335b16a2d2464f9cf5dfd949bc48d02641426 100644 (file)
@@ -1147,6 +1147,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:
index 59102ad9f50b8fdd39ba352c235c823c8342f049..f47398d45d478793aa2149d095c35d39ab22017e 100644 (file)
@@ -609,7 +609,7 @@ fn dir_is_empty(dir: &Path) -> bool {
     /// 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 @@ pub fn maybe_update_submodules(&self) {
             "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 @@ pub fn maybe_update_submodules(&self) {
             // 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);