Skip to content

Commit 2d9a038

Browse files
authored
Rollup merge of rust-lang#87007 - ehuss:fix-rust-analyzer-install, r=Mark-Simulacrum
Fix rust-analyzer install when not available. This changes it so that `x.py install` won't fail if rust-analyzer isn't available. This was changed in rust-lang#86568 to handle the case where installing on stable/beta, and `extended=true`, to skip rust-analyzer. But I neglected to update the install part to also ignore it. Fixes rust-lang#86999
2 parents a499273 + 166c147 commit 2d9a038

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/bootstrap/install.rs

+19-6
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,17 @@ macro_rules! install {
139139

140140
install!((self, builder, _config),
141141
Docs, "src/doc", _config.docs, only_hosts: false, {
142-
let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs");
143-
install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
142+
if let Some(tarball) = builder.ensure(dist::Docs { host: self.target }) {
143+
install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
144+
} else {
145+
panic!("docs are not available to install, \
146+
check that `build.docs` is true in `config.toml`");
147+
}
144148
};
145149
Std, "library/std", true, only_hosts: false, {
146150
for target in &builder.targets {
151+
// `expect` should be safe, only None when host != build, but this
152+
// only runs when host == build
147153
let tarball = builder.ensure(dist::Std {
148154
compiler: self.compiler,
149155
target: *target
@@ -165,10 +171,15 @@ install!((self, builder, _config),
165171
}
166172
};
167173
RustAnalyzer, "rust-analyzer", Self::should_build(_config), only_hosts: true, {
168-
let tarball = builder
169-
.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target })
170-
.expect("missing rust-analyzer");
171-
install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball);
174+
if let Some(tarball) =
175+
builder.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target })
176+
{
177+
install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball);
178+
} else {
179+
builder.info(
180+
&format!("skipping Install rust-analyzer stage{} ({})", self.compiler.stage, self.target),
181+
);
182+
}
172183
};
173184
Clippy, "clippy", Self::should_build(_config), only_hosts: true, {
174185
let tarball = builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target });
@@ -212,6 +223,8 @@ install!((self, builder, _config),
212223
}
213224
};
214225
Analysis, "analysis", Self::should_build(_config), only_hosts: false, {
226+
// `expect` should be safe, only None with host != build, but this
227+
// only uses the `build` compiler
215228
let tarball = builder.ensure(dist::Analysis {
216229
// Find the actual compiler (handling the full bootstrap option) which
217230
// produced the save-analysis data because that data isn't copied

0 commit comments

Comments
 (0)