Skip to content

Commit ad5b6f6

Browse files
committed
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.
2 parents c1230e1 + 935e281 commit ad5b6f6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bootstrap/doc.rs

+6
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ impl Step for Std {
432432
let stage = self.stage;
433433
let target = self.target;
434434
builder.info(&format!("Documenting stage{} std ({})", stage, target));
435+
if builder.no_std(target) == Some(true) {
436+
panic!(
437+
"building std documentation for no_std target {target} is not supported\n\
438+
Set `docs = false` in the config to disable documentation."
439+
);
440+
}
435441
let out = builder.doc_out(target);
436442
t!(fs::create_dir_all(&out));
437443
let compiler = builder.compiler(stage, builder.config.build);

0 commit comments

Comments
 (0)