Rollup merge of #128631 - onur-ozkan:hotfix, r=Mark-Simulacrum

handle crates when they are not specified for std docs

Fixes a regression from https://github.com/rust-lang/rust/pull/128182.

Resolves #128610
This commit is contained in:
Matthias Krüger 2024-08-05 18:36:02 +02:00 committed by GitHub
commit 9d924d11c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -599,6 +599,16 @@ fn make_run(run: RunConfig<'_>) {
fn run(self, builder: &Builder<'_>) { fn run(self, builder: &Builder<'_>) {
let stage = self.stage; let stage = self.stage;
let target = self.target; let target = self.target;
let crates = if self.crates.is_empty() {
builder
.in_tree_crates("sysroot", Some(target))
.iter()
.map(|c| c.name.to_string())
.collect()
} else {
self.crates
};
let out = match self.format { let out = match self.format {
DocumentationFormat::Html => builder.doc_out(target), DocumentationFormat::Html => builder.doc_out(target),
DocumentationFormat::Json => builder.json_doc_out(target), DocumentationFormat::Json => builder.json_doc_out(target),
@ -627,7 +637,7 @@ fn run(self, builder: &Builder<'_>) {
extra_args.push("--disable-minification"); extra_args.push("--disable-minification");
} }
doc_std(builder, self.format, stage, target, &out, &extra_args, &self.crates); doc_std(builder, self.format, stage, target, &out, &extra_args, &crates);
// Don't open if the format is json // Don't open if the format is json
if let DocumentationFormat::Json = self.format { if let DocumentationFormat::Json = self.format {
@ -639,7 +649,7 @@ fn run(self, builder: &Builder<'_>) {
let index = out.join("std").join("index.html"); let index = out.join("std").join("index.html");
builder.open_in_browser(index); builder.open_in_browser(index);
} else { } else {
for requested_crate in &*self.crates { for requested_crate in crates {
if STD_PUBLIC_CRATES.iter().any(|&k| k == requested_crate) { if STD_PUBLIC_CRATES.iter().any(|&k| k == requested_crate) {
let index = out.join(requested_crate).join("index.html"); let index = out.join(requested_crate).join("index.html");
builder.open_in_browser(index); builder.open_in_browser(index);