Uh oh!
There was an error while loading. Please reload this page.
Use relative paths for std links in rustc-docs - #152243
Conversation
Signed-off-by: arferreira <arfs.antonio@gmail.com>
GuillaumeGomez
commented
Feb 6, 2026
Thanks for the work! One thought I had: how do we test that? ^^' |
arferreira
commented
Feb 6, 2026
Yeahh def! I tested manually, just built the compiler docs and comparing the HTML output before and after :) |
GuillaumeGomez
commented
Feb 6, 2026
I expect as much. :p That was an open question for other rust contributors: how do we check that automatically in the CI to ensure it doesn't regress? Maybe you have an idea @Kobzol ? |
Kobzol
commented
Feb 6, 2026
What's the exact thing that you want to check? That all links in the docs are relative? Doesn't rustdoc already has some similar tests in one of its test suites? |
GuillaumeGomez
commented
Feb 6, 2026
Nah, just a few cross-crate ones. And we do, but it's unrelated here: we need this fix because std/core are handled differently and point to each others with |
I guess it would either have to be some rustdoc test that scans the HTML (using some existing machinery), or it would require some large-ish changes. Because the docs that we dist are in the dist components, and we don't really have a notion of testing these today, outside of one hardcoded sanity checks for the PGO-ed rustc toolchain. |
GuillaumeGomez
commented
Feb 6, 2026
Nothing we can check then? Oh well, I guess I can live with that. @bors r+ rollup |
…=GuillaumeGomez Use relative paths for std links in rustc-docs Fixesrust-lang#151496 This adds `--extern-html-root-url` for each `STD_PUBLIC_CRATES` entry pointing to `../`, so that `rustc-docs` links to the locally installed `rust-docs` via relative paths. r? @GuillaumeGomez@rami3l
…=GuillaumeGomez Use relative paths for std links in rustc-docs Fixesrust-lang#151496 This adds `--extern-html-root-url` for each `STD_PUBLIC_CRATES` entry pointing to `../`, so that `rustc-docs` links to the locally installed `rust-docs` via relative paths. r? @GuillaumeGomez@rami3l
…=GuillaumeGomez Use relative paths for std links in rustc-docs Fixesrust-lang#151496 This adds `--extern-html-root-url` for each `STD_PUBLIC_CRATES` entry pointing to `../`, so that `rustc-docs` links to the locally installed `rust-docs` via relative paths. r? @GuillaumeGomez@rami3l
…uwer Rollup of 5 pull requests Successful merges: - #149960 (add `unreachable_cfg_select_predicates` lint) - #152126 (Convert to inline diagnostics in `rustc_mir_build`) - #152186 (Convert to inline diagnostics in `rustc_const_eval`) - #152234 (Dont strip const blocks in array lengths) - #152243 (Use relative paths for std links in rustc-docs)
Uh oh!
There was an error while loading. Please reload this page.
Rollup merge of #152243 - arferreira:fix-rustc-docs-local, r=GuillaumeGomez Use relative paths for std links in rustc-docs Fixes#151496 This adds `--extern-html-root-url` for each `STD_PUBLIC_CRATES` entry pointing to `../`, so that `rustc-docs` links to the locally installed `rust-docs` via relative paths. r? @GuillaumeGomez@rami3l
…paths, r=jieyouxu Revert relative paths for std links in rustc-docs Reverts rust-lang#152243. The relative path `../` passed via `--extern-html-root-url` produces broken links in compiler documentation. The path is wrong in both the published layout (`doc.rust-lang.org/nightly/nightly-rustc/` vs `doc.rust-lang.org/nightly/core/`) and local builds (`compiler-doc/` vs `doc/`). This restores absolute URLs via `#[doc(html_root_url)]`. Fixesrust-lang#152917 Re-opens rust-lang#151496 cc @eggyal
Rollup merge of #152976 - arferreira:revert-relative-extern-paths, r=jieyouxu Revert relative paths for std links in rustc-docs Reverts #152243. The relative path `../` passed via `--extern-html-root-url` produces broken links in compiler documentation. The path is wrong in both the published layout (`doc.rust-lang.org/nightly/nightly-rustc/` vs `doc.rust-lang.org/nightly/core/`) and local builds (`compiler-doc/` vs `doc/`). This restores absolute URLs via `#[doc(html_root_url)]`. Fixes#152917 Re-opens #151496 cc @eggyal
…jieyouxu Revert relative paths for std links in rustc-docs Reverts rust-lang/rust#152243. The relative path `../` passed via `--extern-html-root-url` produces broken links in compiler documentation. The path is wrong in both the published layout (`doc.rust-lang.org/nightly/nightly-rustc/` vs `doc.rust-lang.org/nightly/core/`) and local builds (`compiler-doc/` vs `doc/`). This restores absolute URLs via `#[doc(html_root_url)]`. Fixesrust-lang/rust#152917 Re-opens rust-lang/rust#151496 cc @eggyal
…jieyouxu Revert relative paths for std links in rustc-docs Reverts rust-lang/rust#152243. The relative path `../` passed via `--extern-html-root-url` produces broken links in compiler documentation. The path is wrong in both the published layout (`doc.rust-lang.org/nightly/nightly-rustc/` vs `doc.rust-lang.org/nightly/core/`) and local builds (`compiler-doc/` vs `doc/`). This restores absolute URLs via `#[doc(html_root_url)]`. Fixesrust-lang/rust#152917 Re-opens rust-lang/rust#151496 cc @eggyal
Fixes#151496
This adds
--extern-html-root-urlfor eachSTD_PUBLIC_CRATESentry pointing to../, so thatrustc-docslinks to the locally installedrust-docsvia relative paths.r? @GuillaumeGomez@rami3l