]> git.lizzy.rs Git - rust.git/commitdiff
Provide a better error when `x.py install src/doc` doesn't work.
authorEric Huss <eric@huss.org>
Mon, 12 Jul 2021 20:29:47 +0000 (13:29 -0700)
committerEric Huss <eric@huss.org>
Mon, 12 Jul 2021 20:29:47 +0000 (13:29 -0700)
src/bootstrap/install.rs

index 2ac9d3dda206fb640807b296e7c3ab86adc52321..8a1b6df0dafe34910e2631733e8cb4642c7ddb65 100644 (file)
@@ -139,10 +139,12 @@ fn run($sel, $builder: &Builder<'_>) {
 
 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 {