Skip to content

Commit 2878f98

Browse files
committed
Initialize rust-analyzer submodule on bootstrap
1 parent 082e4ca commit 2878f98

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/bootstrap/bootstrap.py

+4
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,10 @@ def update_submodules(self):
11471147
"library/backtrace",
11481148
"library/stdarch"
11491149
]
1150+
# If build.vendor is set in config.toml, we must update rust-analyzer also.
1151+
# Otherwise, the bootstrap will fail (#96456).
1152+
if self.use_vendored_sources:
1153+
submodules.append("src/tools/rust-analyzer")
11501154
filtered_submodules = []
11511155
submodules_names = []
11521156
for module in submodules:

src/bootstrap/lib.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -609,14 +609,19 @@ impl Build {
609609
/// This avoids contributors checking in a submodule change by accident.
610610
pub fn maybe_update_submodules(&self) {
611611
// WARNING: keep this in sync with the submodules hard-coded in bootstrap.py
612-
const BOOTSTRAP_SUBMODULES: &[&str] = &[
612+
let mut bootstrap_submodules: Vec<&str> = vec![
613613
"src/tools/rust-installer",
614614
"src/tools/cargo",
615615
"src/tools/rls",
616616
"src/tools/miri",
617617
"library/backtrace",
618618
"library/stdarch",
619619
];
620+
// As in bootstrap.py, we include `rust-analyzer` if `build.vendor` was set in
621+
// `config.toml`.
622+
if self.config.vendor {
623+
bootstrap_submodules.push("src/tools/rust-analyzer");
624+
}
620625
// Avoid running git when there isn't a git checkout.
621626
if !self.config.submodules(&self.rust_info) {
622627
return;
@@ -632,7 +637,7 @@ impl Build {
632637
// Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
633638
let submodule = Path::new(line.splitn(2, ' ').nth(1).unwrap());
634639
// avoid updating submodules twice
635-
if !BOOTSTRAP_SUBMODULES.iter().any(|&p| Path::new(p) == submodule)
640+
if !bootstrap_submodules.iter().any(|&p| Path::new(p) == submodule)
636641
&& channel::GitInfo::new(false, submodule).is_git()
637642
{
638643
self.update_submodule(submodule);

0 commit comments

Comments
 (0)