rust/src/test/rustdoc/intra-doc
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
..
auxiliary Preprocess intra-doc links consistently 2021-04-10 22:32:09 -04:00
cross-crate rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
anchors.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
associated-defaults.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
associated-items.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
basic.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
builtin-macros.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
disambiguators-removed.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
email-address.rs Don't report disambiguator error if link would have been ignored 2021-04-04 15:49:57 -07:00
enum-struct-field.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
extern-crate-only-used-in-link.rs Preprocess intra-doc links consistently 2021-04-10 22:32:09 -04:00
extern-crate.rs Move src/test/rustdoc intra-doc link tests into a subdirectory 2020-11-28 21:13:55 -05:00
extern-type.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
external-traits.rs Move src/test/rustdoc intra-doc link tests into a subdirectory 2020-11-28 21:13:55 -05:00
field.rs Make match in register_res easier to read 2021-05-03 17:01:16 -04:00
generic-params.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
in-bodies.rs Move src/test/rustdoc intra-doc link tests into a subdirectory 2020-11-28 21:13:55 -05:00
issue-82209.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
libstd-re-export.rs Fix intra-doc link to raw pointer method 2021-02-15 14:27:50 +01:00
mod-ambiguity.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
non-path-primitives.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
prim-assoc.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
prim-methods-external-core.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
prim-methods-local.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
prim-methods.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
prim-precedence.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
primitive-disambiguators.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
primitive-non-default-impl.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
private-failures-ignored.rs Move src/test/rustdoc intra-doc link tests into a subdirectory 2020-11-28 21:13:55 -05:00
private.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
proc-macro.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
pub-use.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
raw-ident-self.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
reexport-additional-docs.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
self.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
through-proc-macro.rs Move src/test/rustdoc intra-doc link tests into a subdirectory 2020-11-28 21:13:55 -05:00
trait-impl.rs rustdoc: use more precise relative URLS 2021-04-17 09:21:52 -07:00
trait-item.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
true-false.rs rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00