about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-29 01:09:22 +0000
committerbors <bors@rust-lang.org>2022-03-29 01:09:22 +0000
commitad5b6f6b72091261ac421d1331b2350f628d1fcb (patch)
tree399e752e258789a40d17e151ab45cb96b953dd15
parentc1230e137b9b82c97eef178b9a3689ef093b33fa (diff)
parent935e281959b5d02dd8939da58f2a648a28af2a9b (diff)
downloadrust-ad5b6f6b72091261ac421d1331b2350f628d1fcb.tar.gz
rust-ad5b6f6b72091261ac421d1331b2350f628d1fcb.zip
Auto merge of #95417 - ehuss:doc-no_std-error, r=Dylan-DPC
bootstrap: better error message for no_std docs

Currently if one tries to build std documentation for a no_std target, you get a confusing error message:

`error: The argument '--package [<SPEC>...]' was provided more than once, but cannot be used multiple times`

This is because [`std_cargo`](https://github.com/rust-lang/rust/blob/600ec284838c52d1f6657c2cf0097b58970b133b/src/bootstrap/compile.rs#L299-L305) has a built-in `-p alloc` argument that conflicts with the `cargo rustdoc` command used in the Std doc step.

This just adds a better error message in this scenario. It may be possible to fix this correctly, but that would likely be a bit more of an invasive change that I don't have time for right now.
-rw-r--r--src/bootstrap/doc.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index be55871b56a..5f16716a0fd 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -432,6 +432,12 @@ impl Step for Std {
         let stage = self.stage;
         let target = self.target;
         builder.info(&format!("Documenting stage{} std ({})", stage, target));
+        if builder.no_std(target) == Some(true) {
+            panic!(
+                "building std documentation for no_std target {target} is not supported\n\
+                 Set `docs = false` in the config to disable documentation."
+            );
+        }
         let out = builder.doc_out(target);
         t!(fs::create_dir_all(&out));
         let compiler = builder.compiler(stage, builder.config.build);