From c8c7b5b449d243a4ee5474e49e9bb112d56264aa Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 14 Jan 2026 00:58:35 +0100 Subject: [PATCH 1/2] Generate macro expansion for rust compiler crates docs --- src/bootstrap/src/core/build_steps/doc.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index b86582807f722..fa36a6471cae5 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -932,6 +932,7 @@ impl Step for Rustc { // see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222 // If there is any bug, please comment out the next line. cargo.rustdocflag("--generate-link-to-definition"); + cargo.rustdocflag("--generate-macro-expansion"); compile::rustc_cargo(builder, &mut cargo, target, &build_compiler, &self.crates); cargo.arg("-Zskip-rustdoc-fingerprint"); From 75445635784ebf4683a6d22aa8b9563469bd0e0c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 15 Jan 2026 16:48:30 +0100 Subject: [PATCH 2/2] Only enable rustdoc `--generate-macro-expansion` option for stage builds higher than 1 --- src/bootstrap/src/core/build_steps/doc.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index fa36a6471cae5..d8e8f65caa98b 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -932,7 +932,13 @@ impl Step for Rustc { // see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222 // If there is any bug, please comment out the next line. cargo.rustdocflag("--generate-link-to-definition"); - cargo.rustdocflag("--generate-macro-expansion"); + // FIXME: Currently, `--generate-macro-expansion` option is buggy in `beta` rustdoc. To + // allow CI to pass, we only enable the option in stage 2 and higher. + // cfg(bootstrap) + // ^ Adding this so it's not forgotten when the new release is done. + if builder.top_stage > 1 { + cargo.rustdocflag("--generate-macro-expansion"); + } compile::rustc_cargo(builder, &mut cargo, target, &build_compiler, &self.crates); cargo.arg("-Zskip-rustdoc-fingerprint");