Skip to content

Commit

Permalink
precompute the std crates before documenting for rust-docs-json
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 384de54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,18 @@ 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(

let crates = builder
.in_tree_crates("sysroot", Some(host))
.into_iter()
.map(|krate| krate.name.to_string())
.collect();

builder.ensure(crate::core::build_steps::doc::Std::new_with_crates(
builder.top_stage,
host,
DocumentationFormat::Json,
crates,
));

let dest = "share/doc/rust/json";
Expand Down
9 changes: 9 additions & 0 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,15 @@ impl Std {
pub(crate) fn new(stage: u32, target: TargetSelection, format: DocumentationFormat) -> Self {
Std { stage, target, format, crates: vec![] }
}

pub(crate) fn new_with_crates(
stage: u32,
target: TargetSelection,
format: DocumentationFormat,
crates: Vec<String>,
) -> Self {
Std { stage, target, format, crates }
}
}

impl Step for Std {
Expand Down

0 comments on commit 384de54

Please sign in to comment.