Skip to content

Commit f3acf23

Browse files
authored
Rollup merge of rust-lang#84942 - jyn514:channel-replace, r=Manishearth
rustdoc: link to stable/beta docs consistently in documentation This is an alternative to rust-lang#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 rust-lang#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 rust-lang#30693 (note that issue is marked as feature-accepted, although I don't see where it was discussed).
2 parents 4ee9d4a + 106428a commit f3acf23

File tree

8 files changed

+4
-18
lines changed

8 files changed

+4
-18
lines changed

alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#![allow(unused_attributes)]
6060
#![stable(feature = "alloc", since = "1.36.0")]
6161
#![doc(
62-
html_root_url = "https://doc.rust-lang.org/nightly/",
6362
html_playground_url = "https://play.rust-lang.org/",
6463
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
6564
test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))

core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#![cfg(not(test))]
5252
#![stable(feature = "core", since = "1.6.0")]
5353
#![doc(
54-
html_root_url = "https://doc.rust-lang.org/nightly/",
5554
html_playground_url = "https://play.rust-lang.org/",
5655
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
5756
test(no_crate_inject, attr(deny(warnings))),

panic_abort/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
66
#![no_std]
77
#![unstable(feature = "panic_abort", issue = "32837")]
8-
#![doc(
9-
html_root_url = "https://doc.rust-lang.org/nightly/",
10-
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/"
11-
)]
8+
#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
129
#![panic_runtime]
1310
#![allow(unused_features)]
1411
#![feature(core_intrinsics)]

panic_unwind/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
1414
#![no_std]
1515
#![unstable(feature = "panic_unwind", issue = "32837")]
16-
#![doc(
17-
html_root_url = "https://doc.rust-lang.org/nightly/",
18-
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/"
19-
)]
16+
#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
2017
#![feature(core_intrinsics)]
2118
#![feature(lang_items)]
2219
#![feature(nll)]

proc_macro/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![stable(feature = "proc_macro_lib", since = "1.15.0")]
1313
#![deny(missing_docs)]
1414
#![doc(
15-
html_root_url = "https://doc.rust-lang.org/nightly/",
1615
html_playground_url = "https://play.rust-lang.org/",
1716
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
1817
test(no_crate_inject, attr(deny(warnings))),

std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@
190190
#![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))]
191191
#![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))]
192192
#![doc(
193-
html_root_url = "https://doc.rust-lang.org/nightly/",
194193
html_playground_url = "https://play.rust-lang.org/",
195194
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
196195
test(no_crate_inject, attr(deny(warnings))),

term/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
//! [win]: https://docs.microsoft.com/en-us/windows/console/character-mode-applications
3131
//! [ti]: https://en.wikipedia.org/wiki/Terminfo
3232
33-
#![doc(
34-
html_root_url = "https://doc.rust-lang.org/nightly/",
35-
html_playground_url = "https://play.rust-lang.org/",
36-
test(attr(deny(warnings)))
37-
)]
33+
#![doc(html_playground_url = "https://play.rust-lang.org/", test(attr(deny(warnings))))]
3834
#![deny(missing_docs)]
3935
#![cfg_attr(windows, feature(libc))]
4036

test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#![crate_name = "test"]
2121
#![unstable(feature = "test", issue = "50297")]
22-
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
22+
#![doc(test(attr(deny(warnings))))]
2323
#![cfg_attr(unix, feature(libc))]
2424
#![feature(rustc_private)]
2525
#![feature(nll)]

0 commit comments

Comments
 (0)