From 2ac09692e7a79fa49031994351c36d70aa0e752e Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Sun, 4 Aug 2024 10:59:28 +0300 Subject: [PATCH 1/2] handle crates when they are not specified for std docs This fixes a regression from https://github.com/rust-lang/rust/pull/128182. Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/doc.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 1541396bfdd98..2cd5db706c26a 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -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)) + .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), @@ -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 { @@ -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); From b64260eb81930b4e90ff6c502d1b3c2ecf93a7a4 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Sun, 4 Aug 2024 16:54:20 +0300 Subject: [PATCH 2/2] assert expected json files in `rust-docs-json` component Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/dist.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 58f86aa996dd1..adeb7e9a0d233 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -110,11 +110,17 @@ impl Step for JsonDocs { )); let dest = "share/doc/rust/json"; + let out = builder.json_doc_out(host); + + // Make sure these are present in the component. + for f in ["alloc.json", "core.json", "std.json"] { + assert!(out.join(f).exists(), "rust-docs-json is missing `{f}`."); + } let mut tarball = Tarball::new(builder, "rust-docs-json", &host.triple); tarball.set_product_name("Rust Documentation In JSON Format"); tarball.is_preview(true); - tarball.add_bulk_dir(builder.json_doc_out(host), dest); + tarball.add_bulk_dir(out, dest); Some(tarball.generate()) } }