From f698cacc33f0c9148bb3bb7501087b0d37e837ec Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 9 Jul 2021 10:01:23 -0700 Subject: [PATCH 1/3] Fix rust-analyzer install when not available. --- src/bootstrap/install.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 13ee909afd5e4..6f3054538a898 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -165,10 +165,15 @@ install!((self, builder, _config), } }; RustAnalyzer, "rust-analyzer", Self::should_build(_config), only_hosts: true, { - let tarball = builder - .ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target }) - .expect("missing rust-analyzer"); - install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball); + if let Some(tarball) = + builder.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target }) + { + install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball); + } else { + builder.info( + &format!("skipping Install rust-analyzer stage{} ({})", self.compiler.stage, self.target), + ); + } }; Clippy, "clippy", Self::should_build(_config), only_hosts: true, { let tarball = builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target }); From 60ff731110815349dbc052c36e9cc50b9f12f32a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 11 Jul 2021 09:01:31 -0700 Subject: [PATCH 2/3] Add comments why install steps should never fail. --- src/bootstrap/install.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 6f3054538a898..2ac9d3dda206f 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -139,11 +139,15 @@ macro_rules! install { install!((self, builder, _config), Docs, "src/doc", _config.docs, only_hosts: false, { + // `expect` should be safe, only None when config.docs is false, + // which is guarded in `should_run` let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs"); install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball); }; Std, "library/std", true, only_hosts: false, { for target in &builder.targets { + // `expect` should be safe, only None when host != build, but this + // only runs when host == build let tarball = builder.ensure(dist::Std { compiler: self.compiler, target: *target @@ -217,6 +221,8 @@ install!((self, builder, _config), } }; Analysis, "analysis", Self::should_build(_config), only_hosts: false, { + // `expect` should be safe, only None with host != build, but this + // only uses the `build` compiler let tarball = builder.ensure(dist::Analysis { // Find the actual compiler (handling the full bootstrap option) which // produced the save-analysis data because that data isn't copied From 166c147c2727cd6d6ad4d39c40c51273b8a63c96 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 12 Jul 2021 13:29:47 -0700 Subject: [PATCH 3/3] Provide a better error when `x.py install src/doc` doesn't work. --- src/bootstrap/install.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 2ac9d3dda206f..8a1b6df0dafe3 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -139,10 +139,12 @@ macro_rules! install { install!((self, builder, _config), Docs, "src/doc", _config.docs, only_hosts: false, { - // `expect` should be safe, only None when config.docs is false, - // which is guarded in `should_run` - let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs"); - install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball); + if let Some(tarball) = builder.ensure(dist::Docs { host: self.target }) { + install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball); + } else { + panic!("docs are not available to install, \ + check that `build.docs` is true in `config.toml`"); + } }; Std, "library/std", true, only_hosts: false, { for target in &builder.targets {