Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,16 @@ impl Step for Rustc {
cargo.rustdocflag("--extern-html-root-url");
cargo.rustdocflag("ena=https://docs.rs/ena/latest/");

// Link std crates to local docs. Installed layout:
// html/ <- std docs (core/, std/, alloc/, ...)
// html/rustc-docs/ <- compiler docs
// `../../` from rustc-docs/*/index.html reaches html/.
Comment on lines +956 to +959
Copy link
Contributor

@eggyal eggyal Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be the installed layout, but if someone simply does ./x doc and browses the documentation in their build/doc directory, I guess these relative links won't work? Is that a use case we care about? Perhaps we could change the layout in the build directory to be consistent with the "installed" layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're totally right, but changing the build layout to match would be a larger change and might break other assumptions, I mean could be nice but feels like a separate effort.

for krate in STD_PUBLIC_CRATES {
cargo.rustdocflag("--extern-html-root-url");
cargo.rustdocflag(&format!("{krate}=../../"));
}
cargo.rustdocflag("--extern-html-root-takes-precedence");

let mut to_open = None;

let out_dir = builder.stage_out(build_compiler, Mode::Rustc).join(target).join("doc");
Expand Down
Loading