Skip to content

Commit

Permalink
handle crates when they are not specified for std docs
Browse files Browse the repository at this point in the history
This fixes a regression from rust-lang#128182.

Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed Aug 4, 2024
1 parent 5367673 commit 5f0e0a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl Step for JsonDocs {
/// Builds the `rust-docs-json` installer component.
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
let host = self.host;

builder.ensure(crate::core::build_steps::doc::Std::new(
builder.top_stage,
host,
Expand Down
14 changes: 12 additions & 2 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,16 @@ impl Step for Std {
fn run(self, builder: &Builder<'_>) {
let stage = self.stage;
let target = self.target;
let crates = if self.crates.is_empty() {
builder
.in_tree_crates("sysroot", Some(target))
.into_iter()
.map(|c| c.name.to_string())
.collect()
} else {
self.crates
};

let out = match self.format {
DocumentationFormat::Html => builder.doc_out(target),
DocumentationFormat::Json => builder.json_doc_out(target),
Expand Down Expand Up @@ -627,7 +637,7 @@ impl Step for Std {
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
if let DocumentationFormat::Json = self.format {
Expand All @@ -639,7 +649,7 @@ impl Step for Std {
let index = out.join("std").join("index.html");
builder.open_in_browser(index);
} else {
for requested_crate in &*self.crates {
for requested_crate in crates {
if STD_PUBLIC_CRATES.iter().any(|&k| k == requested_crate) {
let index = out.join(requested_crate).join("index.html");
builder.open_in_browser(index);
Expand Down

0 comments on commit 5f0e0a6

Please sign in to comment.