rust/src/librustdoc
Yuki Okushi 01b0e6e645
Rollup merge of #84942 - jyn514:channel-replace, r=Manishearth
rustdoc: link to stable/beta docs consistently in documentation

This is an alternative to https://github.com/rust-lang/rust/pull/84941 which fixes the problem consistently by linking to stable/beta for *all* items, not just for primitives.

 ## User-facing changes

- Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as).
- Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels).
- Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links.

Note that "links" includes both intra-doc links and rustdoc's own
automatically generated hyperlinks.

 ## Implementation changes

- Update the testsuite to allow linking to /beta and /1.52.1 in docs
- Use an html_root_url for the standard library that's dependent on the channel

  This avoids linking to nightly docs on stable.

- Update rustdoc to use channel-dependent links for primitives from an
  unknown crate

- Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync
- Include doc.rust-lang.org in the channel

cc Mark-Simulacrum - I know [you were dubious about this in the past](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Rustdoc.20unconditionally.20links.20to.20nightly.20libstd.20docs/near/231223124), but I'm not quite sure why? I see this as "just a bugfix", I don't know why rustdoc should unconditionally link to nightly.
cc dtolnay who commented in https://github.com/rust-lang/rust/issues/30693:

>  I would welcome a PR to solve this permanently if anyone has ideas for how. I don't believe we need an RFC.

Fixes https://github.com/rust-lang/rust/issues/30693 (note that issue is marked as feature-accepted, although I don't see where it was discussed).
2021-06-05 06:13:37 +09:00
..
clean Rollup merge of #84942 - jyn514:channel-replace, r=Manishearth 2021-06-05 06:13:37 +09:00
doctest Fix injected errors when running doctests on a crate named after a keyword 2021-02-11 17:16:43 -05:00
formats Minimize amount of fake DefIds used in rustdoc 2021-05-15 13:21:35 +02:00
html Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomez 2021-06-05 06:13:30 +09:00
json Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomez 2021-06-05 06:13:30 +09:00
passes Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomez 2021-06-05 06:13:30 +09:00
theme Add test to check if minified theme are handled correctly 2020-02-12 15:49:39 +01:00
Cargo.toml Upgrade minifier version to 0.0.41 2021-05-20 16:51:44 +02:00
config.rs Auto merge of #85788 - rylev:force-warns, r=nikomatsakis 2021-06-04 13:31:51 +00:00
core.rs Auto merge of #85178 - cjgillot:local-crate, r=oli-obk 2021-05-17 01:42:03 +00:00
docfs.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00
doctest.rs Auto merge of #83813 - cbeuw:remap-std, r=michaelwoerister 2021-05-12 11:05:56 +00:00
doctree.rs compute where_outer on demand, remove it from Module 2021-05-01 15:33:49 +02:00
error.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00
externalfiles.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00
fold.rs rustdoc: Remove unnecessary StripItem wrapper 2021-05-04 21:56:27 -04:00
lib.rs Rollup merge of #84942 - jyn514:channel-replace, r=Manishearth 2021-06-05 06:13:37 +09:00
lint.rs Rename INVALID_RUST_CODEBLOCK{,S} 2021-05-17 21:31:04 -04:00
markdown.rs Make all rustdoc functions and structs crate-private 2020-11-15 11:21:12 -05:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
theme.rs Change librustdoc write(.. \n) to writeln(..); fix comment in grammar 2021-05-03 02:19:57 -05:00
visit_ast.rs Restrict access to crate_name. 2021-06-02 18:35:32 +02:00
visit_lib.rs Remove the dummy cache in DocContext 2021-03-01 00:30:30 -05:00

For more information about how librustdoc works, see the rustc dev guide.