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`](600ec28483/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.
This commit is contained in:
bors 2022-03-29 01:09:22 +00:00
commit ad5b6f6b72

View file

@ -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);