Skip to content

Commit 30046ce

Browse files
committed
Auto merge of #96457 - yungkneez:fix-bootstrap, r=Mark-Simulacrum
Initialize rust-analyzer submodule on bootstrap Fixes #96456
2 parents 030c886 + 2878f98 commit 30046ce

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
@@ -998,6 +998,10 @@ def update_submodules(self):
998998
"library/backtrace",
999999
"library/stdarch"
10001000
]
1001+
# If build.vendor is set in config.toml, we must update rust-analyzer also.
1002+
# Otherwise, the bootstrap will fail (#96456).
1003+
if self.use_vendored_sources:
1004+
submodules.append("src/tools/rust-analyzer")
10011005
filtered_submodules = []
10021006
submodules_names = []
10031007
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)