From 7411a9e7ccde17258ccd39990097fc12f7a76a71 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 4 May 2021 23:36:33 -0400 Subject: [PATCH] rustdoc: link to stable/beta docs consistently in documentation ## 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 --- library/alloc/src/lib.rs | 1 - library/core/src/lib.rs | 1 - library/panic_abort/src/lib.rs | 5 +-- library/panic_unwind/src/lib.rs | 5 +-- library/proc_macro/src/lib.rs | 1 - library/std/src/lib.rs | 1 - library/term/src/lib.rs | 6 +--- library/test/src/lib.rs | 2 +- src/bootstrap/builder.rs | 12 +++++++ src/bootstrap/compile.rs | 5 +++ src/bootstrap/test.rs | 1 + src/bootstrap/tool.rs | 1 + src/etc/htmldocck.py | 4 +++ src/librustdoc/clean/types.rs | 2 +- src/librustdoc/clean/utils.rs | 5 +++ src/librustdoc/lib.rs | 2 ++ src/test/rustdoc-ui/check.rs | 1 + src/test/rustdoc-ui/check.stderr | 16 ++++----- .../intra-doc/email-address-localhost.rs | 1 + .../intra-doc/email-address-localhost.stderr | 6 ++-- .../intra-doc/unknown-disambiguator.rs | 1 + .../intra-doc/unknown-disambiguator.stderr | 26 +++++++------- .../rustdoc-ui/no-crate-level-doc-lint.rs | 1 + .../rustdoc-ui/no-crate-level-doc-lint.stderr | 4 +-- .../rustdoc/intra-doc/associated-items.rs | 6 ++-- src/test/rustdoc/intra-doc/builtin-macros.rs | 2 +- src/test/rustdoc/intra-doc/generic-params.rs | 28 +++++++-------- .../rustdoc/intra-doc/non-path-primitives.rs | 34 +++++++++---------- src/test/rustdoc/intra-doc/prim-assoc.rs | 2 +- .../intra-doc/prim-methods-external-core.rs | 4 +-- .../rustdoc/intra-doc/prim-methods-local.rs | 4 +-- src/test/rustdoc/intra-doc/prim-methods.rs | 4 +-- src/test/rustdoc/intra-doc/prim-precedence.rs | 4 +-- .../intra-doc/primitive-disambiguators.rs | 2 +- .../intra-doc/primitive-non-default-impl.rs | 20 +++++------ src/test/rustdoc/intra-doc/pub-use.rs | 4 +-- src/test/rustdoc/intra-doc/trait-item.rs | 2 +- src/test/rustdoc/intra-doc/true-false.rs | 4 +-- src/test/rustdoc/intra-link-prim-self.rs | 7 ++-- src/test/rustdoc/primitive-link.rs | 10 +++--- src/test/rustdoc/primitive-reexport.rs | 12 +++---- 41 files changed, 139 insertions(+), 120 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 7bc9aa69be98e..a04e7c8a498da 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -59,7 +59,6 @@ #![allow(unused_attributes)] #![stable(feature = "alloc", since = "1.36.0")] #![doc( - html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(allow(unused_variables), deny(warnings))) diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index a023edaca9e94..6c0b9c0331e30 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -51,7 +51,6 @@ #![cfg(not(test))] #![stable(feature = "core", since = "1.6.0")] #![doc( - html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(deny(warnings))), diff --git a/library/panic_abort/src/lib.rs b/library/panic_abort/src/lib.rs index 5dcd1e6af3659..d95ea6530c204 100644 --- a/library/panic_abort/src/lib.rs +++ b/library/panic_abort/src/lib.rs @@ -5,10 +5,7 @@ #![no_std] #![unstable(feature = "panic_abort", issue = "32837")] -#![doc( - html_root_url = "https://doc.rust-lang.org/nightly/", - issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/" -)] +#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")] #![panic_runtime] #![allow(unused_features)] #![feature(core_intrinsics)] diff --git a/library/panic_unwind/src/lib.rs b/library/panic_unwind/src/lib.rs index 99a0c67fc11b9..d32a3f1f8322c 100644 --- a/library/panic_unwind/src/lib.rs +++ b/library/panic_unwind/src/lib.rs @@ -13,10 +13,7 @@ #![no_std] #![unstable(feature = "panic_unwind", issue = "32837")] -#![doc( - html_root_url = "https://doc.rust-lang.org/nightly/", - issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/" -)] +#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")] #![feature(core_intrinsics)] #![feature(lang_items)] #![feature(nll)] diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 04a165e09f1e5..3990826ce42e0 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -12,7 +12,6 @@ #![stable(feature = "proc_macro_lib", since = "1.15.0")] #![deny(missing_docs)] #![doc( - html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(deny(warnings))), diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 8e4c63762fd38..c4f21587457c1 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -190,7 +190,6 @@ #![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))] #![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))] #![doc( - html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(deny(warnings))), diff --git a/library/term/src/lib.rs b/library/term/src/lib.rs index 2116b433fce3f..943b276a220c8 100644 --- a/library/term/src/lib.rs +++ b/library/term/src/lib.rs @@ -30,11 +30,7 @@ //! [win]: https://docs.microsoft.com/en-us/windows/console/character-mode-applications //! [ti]: https://en.wikipedia.org/wiki/Terminfo -#![doc( - html_root_url = "https://doc.rust-lang.org/nightly/", - html_playground_url = "https://play.rust-lang.org/", - test(attr(deny(warnings))) -)] +#![doc(html_playground_url = "https://play.rust-lang.org/", test(attr(deny(warnings))))] #![deny(missing_docs)] #![cfg_attr(windows, feature(libc))] diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index bda5ed888d7e1..3da4d434f48f2 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -19,7 +19,7 @@ #![crate_name = "test"] #![unstable(feature = "test", issue = "50297")] -#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))] +#![doc(test(attr(deny(warnings))))] #![cfg_attr(unix, feature(libc))] #![feature(rustc_private)] #![feature(nll)] diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index da298f7edb9f4..06f8bf89daecd 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -574,6 +574,18 @@ impl<'a> Builder<'a> { self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), paths); } + /// NOTE: keep this in sync with `rustdoc::clean::utils::doc_rust_lang_org_channel`, or tests will fail on beta/stable. + pub fn doc_rust_lang_org_channel(&self) -> String { + let channel = match &*self.config.channel { + "stable" => &self.version, + "beta" => "beta", + "nightly" | "dev" => "nightly", + // custom build of rustdoc maybe? link to the latest stable docs just in case + _ => "stable", + }; + "https://doc.rust-lang.org/".to_owned() + channel + } + fn run_step_descriptions(&self, v: &[StepDescription], paths: &[PathBuf]) { StepDescription::run(v, self, paths); } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index e5258d08956f6..c057910e4f95f 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -326,6 +326,11 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car if target.contains("riscv") { cargo.rustflag("-Cforce-unwind-tables=yes"); } + + let html_root = + format!("-Zcrate-attr=doc(html_root_url=\"{}/\")", builder.doc_rust_lang_org_channel(),); + cargo.rustflag(&html_root); + cargo.rustdocflag(&html_root); } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 7bd29c61b0cdb..cc7c143d47461 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1486,6 +1486,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the } } cmd.env("RUSTC_BOOTSTRAP", "1"); + cmd.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel()); builder.add_rust_test_threads(&mut cmd); if builder.config.sanitizers_enabled(target) { diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 64e4be6863a62..9d75ad0918a79 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -263,6 +263,7 @@ pub fn prepare_tool_cargo( cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel); cargo.env("CFG_VERSION", builder.rust_version()); cargo.env("CFG_RELEASE_NUM", &builder.version); + cargo.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel()); let info = GitInfo::new(builder.config.ignore_git, &dir); if let Some(sha) = info.sha() { diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index 2f7233685db52..8647db5a45dc8 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -135,6 +135,8 @@ unichr = chr +channel = os.environ["DOC_RUST_LANG_ORG_CHANNEL"] + class CustomHTMLParser(HTMLParser): """simplified HTML parser. @@ -270,6 +272,7 @@ def flatten(node): def normalize_xpath(path): + path = path.replace("{{channel}}", channel) if path.startswith('//'): return '.' + path # avoid warnings elif path.startswith('.//'): @@ -334,6 +337,7 @@ def get_dir(self, path): def check_string(data, pat, regexp): + pat = pat.replace("{{channel}}", channel) if not pat: return True # special case a presence testing elif regexp: diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 3ae516bd6df7c..dd1887d0bef77 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -499,7 +499,7 @@ impl Item { format!("{}/std/", s.trim_end_matches('/')) } Some(ExternalLocation::Unknown) | None => { - "https://doc.rust-lang.org/nightly/std/".to_string() + format!("{}/std/", crate::DOC_RUST_LANG_ORG_CHANNEL) } }; // This is a primitive so the url is done "by hand". diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 2c31a502565aa..d9a25aba8682d 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -543,3 +543,8 @@ crate fn has_doc_flag(attrs: ty::Attributes<'_>, flag: Symbol) -> bool { && attr.meta_item_list().map_or(false, |l| rustc_attr::list_contains_name(&l, flag)) }) } + +/// A link to `doc.rust-lang.org` that includes the channel name. +/// +/// Set by `bootstrap::Builder::doc_rust_lang_org_channel` in order to keep tests passing on beta/stable. +crate const DOC_RUST_LANG_ORG_CHANNEL: &'static str = env!("DOC_RUST_LANG_ORG_CHANNEL"); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index bf0be62635630..a4b11584371aa 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -81,6 +81,8 @@ use rustc_session::config::{make_crate_type_option, ErrorOutputType, RustcOptGro use rustc_session::getopts; use rustc_session::{early_error, early_warn}; +use crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL; + /// A macro to create a FxHashMap. /// /// Example: diff --git a/src/test/rustdoc-ui/check.rs b/src/test/rustdoc-ui/check.rs index 65a56e03d9dfc..2b44ba24b4426 100644 --- a/src/test/rustdoc-ui/check.rs +++ b/src/test/rustdoc-ui/check.rs @@ -1,5 +1,6 @@ // check-pass // compile-flags: -Z unstable-options --check +// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" #![warn(missing_docs)] //~^ WARN diff --git a/src/test/rustdoc-ui/check.stderr b/src/test/rustdoc-ui/check.stderr index 2e1fc1eca4d6e..8c9e70e57fe7b 100644 --- a/src/test/rustdoc-ui/check.stderr +++ b/src/test/rustdoc-ui/check.stderr @@ -1,5 +1,5 @@ warning: missing documentation for the crate - --> $DIR/check.rs:4:1 + --> $DIR/check.rs:5:1 | LL | / #![warn(missing_docs)] LL | | @@ -10,13 +10,13 @@ LL | | pub fn foo() {} | |_______________^ | note: the lint level is defined here - --> $DIR/check.rs:4:9 + --> $DIR/check.rs:5:9 | LL | #![warn(missing_docs)] | ^^^^^^^^^^^^ warning: missing documentation for a function - --> $DIR/check.rs:9:1 + --> $DIR/check.rs:10:1 | LL | pub fn foo() {} | ^^^^^^^^^^^^ @@ -24,16 +24,16 @@ LL | pub fn foo() {} warning: no documentation found for this crate's top-level module | note: the lint level is defined here - --> $DIR/check.rs:7:9 + --> $DIR/check.rs:8:9 | LL | #![warn(rustdoc::all)] | ^^^^^^^^^^^^ = note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc::all)]` = help: The following guide may be of use: - https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html + https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html warning: missing code example in this documentation - --> $DIR/check.rs:4:1 + --> $DIR/check.rs:5:1 | LL | / #![warn(missing_docs)] LL | | @@ -44,14 +44,14 @@ LL | | pub fn foo() {} | |_______________^ | note: the lint level is defined here - --> $DIR/check.rs:7:9 + --> $DIR/check.rs:8:9 | LL | #![warn(rustdoc::all)] | ^^^^^^^^^^^^ = note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc::all)]` warning: missing code example in this documentation - --> $DIR/check.rs:9:1 + --> $DIR/check.rs:10:1 | LL | pub fn foo() {} | ^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/intra-doc/email-address-localhost.rs b/src/test/rustdoc-ui/intra-doc/email-address-localhost.rs index 417618c74582c..9465e8e7ab996 100644 --- a/src/test/rustdoc-ui/intra-doc/email-address-localhost.rs +++ b/src/test/rustdoc-ui/intra-doc/email-address-localhost.rs @@ -1,3 +1,4 @@ +// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" #![deny(warnings)] //! Email me at . diff --git a/src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr b/src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr index f287f87408c48..1b07828fc6e55 100644 --- a/src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr +++ b/src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr @@ -1,16 +1,16 @@ error: unknown disambiguator `hello` - --> $DIR/email-address-localhost.rs:3:18 + --> $DIR/email-address-localhost.rs:4:18 | LL | //! Email me at . | ^^^^^ | note: the lint level is defined here - --> $DIR/email-address-localhost.rs:1:9 + --> $DIR/email-address-localhost.rs:2:9 | LL | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]` - = note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators error: aborting due to previous error diff --git a/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.rs b/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.rs index 925fc515a3e65..0aa1e5a415aa7 100644 --- a/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.rs +++ b/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.rs @@ -1,3 +1,4 @@ +// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" #![deny(warnings)] //! Linking to [foo@banana] and [`bar@banana!()`]. diff --git a/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.stderr b/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.stderr index 94d6d4616518e..d280e6497e096 100644 --- a/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.stderr +++ b/src/test/rustdoc-ui/intra-doc/unknown-disambiguator.stderr @@ -1,56 +1,56 @@ error: unknown disambiguator `foo` - --> $DIR/unknown-disambiguator.rs:3:17 + --> $DIR/unknown-disambiguator.rs:4:17 | LL | //! Linking to [foo@banana] and [`bar@banana!()`]. | ^^^ | note: the lint level is defined here - --> $DIR/unknown-disambiguator.rs:1:9 + --> $DIR/unknown-disambiguator.rs:2:9 | LL | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]` - = note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators error: unknown disambiguator `bar` - --> $DIR/unknown-disambiguator.rs:3:35 + --> $DIR/unknown-disambiguator.rs:4:35 | LL | //! Linking to [foo@banana] and [`bar@banana!()`]. | ^^^ | - = note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators error: unknown disambiguator `foo` - --> $DIR/unknown-disambiguator.rs:9:34 + --> $DIR/unknown-disambiguator.rs:10:34 | LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello]. | ^^^ | - = note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators error: unknown disambiguator `foo` - --> $DIR/unknown-disambiguator.rs:9:48 + --> $DIR/unknown-disambiguator.rs:10:48 | LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello]. | ^^^ | - = note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators error: unknown disambiguator `` - --> $DIR/unknown-disambiguator.rs:6:31 + --> $DIR/unknown-disambiguator.rs:7:31 | LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()). | ^ | - = note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators error: unknown disambiguator `` - --> $DIR/unknown-disambiguator.rs:6:57 + --> $DIR/unknown-disambiguator.rs:7:57 | LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()). | ^ | - = note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators error: aborting due to 6 previous errors diff --git a/src/test/rustdoc-ui/no-crate-level-doc-lint.rs b/src/test/rustdoc-ui/no-crate-level-doc-lint.rs index 3939ec6827ade..a186410acf483 100644 --- a/src/test/rustdoc-ui/no-crate-level-doc-lint.rs +++ b/src/test/rustdoc-ui/no-crate-level-doc-lint.rs @@ -1,4 +1,5 @@ // error-pattern: no documentation found +// normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" #![deny(rustdoc::missing_crate_level_docs)] //^~ NOTE defined here diff --git a/src/test/rustdoc-ui/no-crate-level-doc-lint.stderr b/src/test/rustdoc-ui/no-crate-level-doc-lint.stderr index 55ead1a55cfcd..1a1f8085a1b46 100644 --- a/src/test/rustdoc-ui/no-crate-level-doc-lint.stderr +++ b/src/test/rustdoc-ui/no-crate-level-doc-lint.stderr @@ -1,12 +1,12 @@ error: no documentation found for this crate's top-level module | note: the lint level is defined here - --> $DIR/no-crate-level-doc-lint.rs:2:9 + --> $DIR/no-crate-level-doc-lint.rs:3:9 | LL | #![deny(rustdoc::missing_crate_level_docs)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: The following guide may be of use: - https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html + https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html error: aborting due to previous error diff --git a/src/test/rustdoc/intra-doc/associated-items.rs b/src/test/rustdoc/intra-doc/associated-items.rs index 2757418bc64e5..d9fed2d69518a 100644 --- a/src/test/rustdoc/intra-doc/associated-items.rs +++ b/src/test/rustdoc/intra-doc/associated-items.rs @@ -3,9 +3,9 @@ /// [`std::collections::BTreeMap::into_iter`] /// [`String::from`] is ambiguous as to which `From` impl /// [Vec::into_iter()] uses a disambiguator -// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter' -// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from"]' 'String::from' -// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter' +// @has 'associated_items/fn.foo.html' '//a[@href="{{channel}}/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter' +// @has 'associated_items/fn.foo.html' '//a[@href="{{channel}}/alloc/string/struct.String.html#method.from"]' 'String::from' +// @has 'associated_items/fn.foo.html' '//a[@href="{{channel}}/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter' pub fn foo() {} /// Link to [MyStruct], [link from struct][MyStruct::method], [MyStruct::clone], [MyStruct::Input] diff --git a/src/test/rustdoc/intra-doc/builtin-macros.rs b/src/test/rustdoc/intra-doc/builtin-macros.rs index 74216a587e1da..bbdbe246bbce2 100644 --- a/src/test/rustdoc/intra-doc/builtin-macros.rs +++ b/src/test/rustdoc/intra-doc/builtin-macros.rs @@ -1,3 +1,3 @@ // @has builtin_macros/index.html -// @has - '//a/@href' 'https://doc.rust-lang.org/nightly/core/macro.cfg.html' +// @has - '//a/@href' '{{channel}}/core/macro.cfg.html' //! [cfg] diff --git a/src/test/rustdoc/intra-doc/generic-params.rs b/src/test/rustdoc/intra-doc/generic-params.rs index 1de6410f10c43..fbc9fc6a9bc21 100644 --- a/src/test/rustdoc/intra-doc/generic-params.rs +++ b/src/test/rustdoc/intra-doc/generic-params.rs @@ -5,40 +5,40 @@ //! Here's a link to [`Vec`] and one to [`Box>>`]. //! Here's a link to [`Iterator>::Item`]. //! -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html"]' 'Vec' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"]' 'Box>>' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item"]' 'Iterator>::Item' +// @has foo/index.html '//a[@href="{{channel}}/alloc/vec/struct.Vec.html"]' 'Vec' +// @has foo/index.html '//a[@href="{{channel}}/alloc/boxed/struct.Box.html"]' 'Box>>' +// @has foo/index.html '//a[@href="{{channel}}/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item"]' 'Iterator>::Item' //! And what about a link to [just `Option`](Option) and, [with the generic, `Option`](Option)? //! -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"]' 'just Option' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"]' 'with the generic, Option' +// @has foo/index.html '//a[@href="{{channel}}/core/option/enum.Option.html"]' 'just Option' +// @has foo/index.html '//a[@href="{{channel}}/core/option/enum.Option.html"]' 'with the generic, Option' //! We should also try linking to [`Result`]; it has *two* generics! //! And [`Result`] and [`Result`]. //! -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"]' 'Result' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"]' 'Result' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"]' 'Result' +// @has foo/index.html '//a[@href="{{channel}}/core/result/enum.Result.html"]' 'Result' +// @has foo/index.html '//a[@href="{{channel}}/core/result/enum.Result.html"]' 'Result' +// @has foo/index.html '//a[@href="{{channel}}/core/result/enum.Result.html"]' 'Result' //! Now let's test a trickier case: [`Vec::::new`], or you could write it //! [with parentheses as `Vec::::new()`][Vec::::new()]. //! And what about something even harder? That would be [`Vec::>::new()`]. //! -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'Vec::::new' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'with parentheses as Vec::::new()' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'Vec::>::new()' +// @has foo/index.html '//a[@href="{{channel}}/alloc/vec/struct.Vec.html#method.new"]' 'Vec::::new' +// @has foo/index.html '//a[@href="{{channel}}/alloc/vec/struct.Vec.html#method.new"]' 'with parentheses as Vec::::new()' +// @has foo/index.html '//a[@href="{{channel}}/alloc/vec/struct.Vec.html#method.new"]' 'Vec::>::new()' //! This is also pretty tricky: [`TypeId::of::()`]. //! And this too: [`Vec::::len`]. //! -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html#method.of"]' 'TypeId::of::()' -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.len"]' 'Vec::::len' +// @has foo/index.html '//a[@href="{{channel}}/core/any/struct.TypeId.html#method.of"]' 'TypeId::of::()' +// @has foo/index.html '//a[@href="{{channel}}/alloc/vec/struct.Vec.html#method.len"]' 'Vec::::len' //! We unofficially and implicitly support things that aren't valid in the actual Rust syntax, like //! [`Box::new()`]. We may not support them in the future! //! -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html#method.new"]' 'Box::new()' +// @has foo/index.html '//a[@href="{{channel}}/alloc/boxed/struct.Box.html#method.new"]' 'Box::new()' //! These will be resolved as regular links: //! - [`this is first`](https://www.rust-lang.org) diff --git a/src/test/rustdoc/intra-doc/non-path-primitives.rs b/src/test/rustdoc/intra-doc/non-path-primitives.rs index ee71537d15531..be4b44b314252 100644 --- a/src/test/rustdoc/intra-doc/non-path-primitives.rs +++ b/src/test/rustdoc/intra-doc/non-path-primitives.rs @@ -2,45 +2,45 @@ #![feature(intra_doc_pointers)] #![deny(rustdoc::broken_intra_doc_links)] -// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.rotate_left"]' 'slice::rotate_left' +// @has foo/index.html '//a[@href="{{channel}}/std/primitive.slice.html#method.rotate_left"]' 'slice::rotate_left' //! [slice::rotate_left] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.array.html#method.map"]' 'array::map' +// @has - '//a[@href="{{channel}}/std/primitive.array.html#method.map"]' 'array::map' //! [array::map] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html"]' 'owned str' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html"]' 'str ref' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.is_empty"]' 'str::is_empty' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.len"]' '&str::len' +// @has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'owned str' +// @has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'str ref' +// @has - '//a[@href="{{channel}}/std/primitive.str.html#method.is_empty"]' 'str::is_empty' +// @has - '//a[@href="{{channel}}/std/primitive.str.html#method.len"]' '&str::len' //! [owned str][str] //! [str ref][&str] //! [str::is_empty] //! [&str::len] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.is_null"]' 'pointer::is_null' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.is_null"]' '*const::is_null' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.is_null"]' '*mut::is_null' +// @has - '//a[@href="{{channel}}/std/primitive.pointer.html#method.is_null"]' 'pointer::is_null' +// @has - '//a[@href="{{channel}}/std/primitive.pointer.html#method.is_null"]' '*const::is_null' +// @has - '//a[@href="{{channel}}/std/primitive.pointer.html#method.is_null"]' '*mut::is_null' //! [pointer::is_null] //! [*const::is_null] //! [*mut::is_null] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.unit.html"]' 'unit' +// @has - '//a[@href="{{channel}}/std/primitive.unit.html"]' 'unit' //! [unit] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html"]' 'tuple' +// @has - '//a[@href="{{channel}}/std/primitive.tuple.html"]' 'tuple' //! [tuple] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.reference.html"]' 'reference' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.reference.html"]' '&' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.reference.html"]' '&mut' +// @has - '//a[@href="{{channel}}/std/primitive.reference.html"]' 'reference' +// @has - '//a[@href="{{channel}}/std/primitive.reference.html"]' '&' +// @has - '//a[@href="{{channel}}/std/primitive.reference.html"]' '&mut' //! [reference] //! [&] //! [&mut] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.fn.html"]' 'fn' +// @has - '//a[@href="{{channel}}/std/primitive.fn.html"]' 'fn' //! [fn] -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.never.html"]' 'never' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.never.html"]' '!' +// @has - '//a[@href="{{channel}}/std/primitive.never.html"]' 'never' +// @has - '//a[@href="{{channel}}/std/primitive.never.html"]' '!' //! [never] //! [!] diff --git a/src/test/rustdoc/intra-doc/prim-assoc.rs b/src/test/rustdoc/intra-doc/prim-assoc.rs index 4099ececfaf7c..c73140420ff1f 100644 --- a/src/test/rustdoc/intra-doc/prim-assoc.rs +++ b/src/test/rustdoc/intra-doc/prim-assoc.rs @@ -1,4 +1,4 @@ #![deny(broken_intra_doc_links)] //! [i32::MAX] -// @has prim_assoc/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' "i32::MAX" +// @has prim_assoc/index.html '//a[@href="{{channel}}/std/primitive.i32.html#associatedconstant.MAX"]' "i32::MAX" diff --git a/src/test/rustdoc/intra-doc/prim-methods-external-core.rs b/src/test/rustdoc/intra-doc/prim-methods-external-core.rs index 695a7fbfb5348..9347d7bb42819 100644 --- a/src/test/rustdoc/intra-doc/prim-methods-external-core.rs +++ b/src/test/rustdoc/intra-doc/prim-methods-external-core.rs @@ -9,8 +9,8 @@ #![crate_type = "rlib"] // @has prim_methods_external_core/index.html -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html"]' 'char' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' //! A [`char`] and its [`char::len_utf8`]. diff --git a/src/test/rustdoc/intra-doc/prim-methods-local.rs b/src/test/rustdoc/intra-doc/prim-methods-local.rs index f0b939a468c03..124faa9a636ff 100644 --- a/src/test/rustdoc/intra-doc/prim-methods-local.rs +++ b/src/test/rustdoc/intra-doc/prim-methods-local.rs @@ -5,8 +5,8 @@ // @has prim_methods_local/index.html -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html"]' 'char' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' //! A [`char`] and its [`char::len_utf8`]. diff --git a/src/test/rustdoc/intra-doc/prim-methods.rs b/src/test/rustdoc/intra-doc/prim-methods.rs index 6de15e76d15cf..076117359d264 100644 --- a/src/test/rustdoc/intra-doc/prim-methods.rs +++ b/src/test/rustdoc/intra-doc/prim-methods.rs @@ -2,7 +2,7 @@ // @has prim_methods/index.html -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html"]' 'char' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' //! A [`char`] and its [`char::len_utf8`]. diff --git a/src/test/rustdoc/intra-doc/prim-precedence.rs b/src/test/rustdoc/intra-doc/prim-precedence.rs index 478b40b0b516f..fcd86a99f1d6b 100644 --- a/src/test/rustdoc/intra-doc/prim-precedence.rs +++ b/src/test/rustdoc/intra-doc/prim-precedence.rs @@ -2,12 +2,12 @@ pub mod char { /// [char] - // @has prim_precedence/char/struct.Inner.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' + // @has prim_precedence/char/struct.Inner.html '//a/@href' '{{channel}}/std/primitive.char.html' pub struct Inner; } /// See [prim@char] -// @has prim_precedence/struct.MyString.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' +// @has prim_precedence/struct.MyString.html '//a/@href' '{{channel}}/std/primitive.char.html' pub struct MyString; /// See also [crate::char] and [mod@char] diff --git a/src/test/rustdoc/intra-doc/primitive-disambiguators.rs b/src/test/rustdoc/intra-doc/primitive-disambiguators.rs index acdd07566c94d..9b3b698324096 100644 --- a/src/test/rustdoc/intra-doc/primitive-disambiguators.rs +++ b/src/test/rustdoc/intra-doc/primitive-disambiguators.rs @@ -1,4 +1,4 @@ #![deny(broken_intra_doc_links)] // @has primitive_disambiguators/index.html -// @has - '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim' +// @has - '//a/@href' '{{channel}}/std/primitive.str.html#method.trim' //! [str::trim()] diff --git a/src/test/rustdoc/intra-doc/primitive-non-default-impl.rs b/src/test/rustdoc/intra-doc/primitive-non-default-impl.rs index cf83ead4db72c..f8a824bd08f42 100644 --- a/src/test/rustdoc/intra-doc/primitive-non-default-impl.rs +++ b/src/test/rustdoc/intra-doc/primitive-non-default-impl.rs @@ -3,29 +3,29 @@ // @has primitive_non_default_impl/fn.str_methods.html /// [`str::trim`] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim"]' 'str::trim' +// @has - '//*[@href="{{channel}}/std/primitive.str.html#method.trim"]' 'str::trim' /// [`str::to_lowercase`] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.to_lowercase"]' 'str::to_lowercase' +// @has - '//*[@href="{{channel}}/std/primitive.str.html#method.to_lowercase"]' 'str::to_lowercase' /// [`str::into_boxed_bytes`] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.into_boxed_bytes"]' 'str::into_boxed_bytes' +// @has - '//*[@href="{{channel}}/std/primitive.str.html#method.into_boxed_bytes"]' 'str::into_boxed_bytes' /// [`str::replace`] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.replace"]' 'str::replace' +// @has - '//*[@href="{{channel}}/std/primitive.str.html#method.replace"]' 'str::replace' pub fn str_methods() {} // @has primitive_non_default_impl/fn.f32_methods.html /// [f32::powi] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f32.html#method.powi"]' 'f32::powi' +// @has - '//*[@href="{{channel}}/std/primitive.f32.html#method.powi"]' 'f32::powi' /// [f32::sqrt] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f32.html#method.sqrt"]' 'f32::sqrt' +// @has - '//*[@href="{{channel}}/std/primitive.f32.html#method.sqrt"]' 'f32::sqrt' /// [f32::mul_add] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f32.html#method.mul_add"]' 'f32::mul_add' +// @has - '//*[@href="{{channel}}/std/primitive.f32.html#method.mul_add"]' 'f32::mul_add' pub fn f32_methods() {} // @has primitive_non_default_impl/fn.f64_methods.html /// [`f64::powi`] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.powi"]' 'f64::powi' +// @has - '//*[@href="{{channel}}/std/primitive.f64.html#method.powi"]' 'f64::powi' /// [`f64::sqrt`] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.sqrt"]' 'f64::sqrt' +// @has - '//*[@href="{{channel}}/std/primitive.f64.html#method.sqrt"]' 'f64::sqrt' /// [`f64::mul_add`] -// @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.mul_add"]' 'f64::mul_add' +// @has - '//*[@href="{{channel}}/std/primitive.f64.html#method.mul_add"]' 'f64::mul_add' pub fn f64_methods() {} diff --git a/src/test/rustdoc/intra-doc/pub-use.rs b/src/test/rustdoc/intra-doc/pub-use.rs index 579fa68cee8be..b4f2d6b0617fa 100644 --- a/src/test/rustdoc/intra-doc/pub-use.rs +++ b/src/test/rustdoc/intra-doc/pub-use.rs @@ -12,7 +12,7 @@ extern crate inner; // documenting the re-export. // @has outer/index.html -// @ has - '//a[@href="https://doc.rust-lang.org/nightly/std/env/fn.var.html"]' "std::env" +// @ has - '//a[@href="{{channel}}/std/env/fn.var.html"]' "std::env" // @ has - '//a[@href="fn.f.html"]' "g" pub use f as g; @@ -23,5 +23,5 @@ extern crate self as _; // Make sure the documentation is actually correct by documenting an inlined re-export /// [mod@std::env] // @has outer/fn.f.html -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/env/index.html"]' "std::env" +// @has - '//a[@href="{{channel}}/std/env/index.html"]' "std::env" pub use inner::f; diff --git a/src/test/rustdoc/intra-doc/trait-item.rs b/src/test/rustdoc/intra-doc/trait-item.rs index 7602aced56416..0be368d051ee6 100644 --- a/src/test/rustdoc/intra-doc/trait-item.rs +++ b/src/test/rustdoc/intra-doc/trait-item.rs @@ -3,7 +3,7 @@ /// Link to [S::assoc_fn()] /// Link to [Default::default()] // @has trait_item/struct.S.html '//*[@href="struct.S.html#method.assoc_fn"]' 'S::assoc_fn()' -// @has - '//*[@href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default"]' 'Default::default()' +// @has - '//*[@href="{{channel}}/core/default/trait.Default.html#tymethod.default"]' 'Default::default()' pub struct S; impl S { diff --git a/src/test/rustdoc/intra-doc/true-false.rs b/src/test/rustdoc/intra-doc/true-false.rs index db637ece36995..44aac68841373 100644 --- a/src/test/rustdoc/intra-doc/true-false.rs +++ b/src/test/rustdoc/intra-doc/true-false.rs @@ -3,7 +3,7 @@ // @has foo/index.html -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.bool.html"]' 'true' -// @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.bool.html"]' 'false' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.bool.html"]' 'true' +// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.bool.html"]' 'false' //! A `bool` is either [`true`] or [`false`]. diff --git a/src/test/rustdoc/intra-link-prim-self.rs b/src/test/rustdoc/intra-link-prim-self.rs index 1189d266c536e..4744c84b6226d 100644 --- a/src/test/rustdoc/intra-link-prim-self.rs +++ b/src/test/rustdoc/intra-link-prim-self.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![deny(broken_intra_doc_links)] #![feature(lang_items)] #![feature(no_core)] @@ -8,8 +7,8 @@ /// [Self::f] /// [Self::MAX] // @has intra_link_prim_self/primitive.usize.html -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.usize.html#method.f"]' 'Self::f' -// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.usize.html#associatedconstant.MAX"]' 'Self::MAX' +// @has - '//a[@href="{{channel}}/std/primitive.usize.html#method.f"]' 'Self::f' +// @has - '//a[@href="{{channel}}/std/primitive.usize.html#associatedconstant.MAX"]' 'Self::MAX' impl usize { /// Some docs pub fn f() {} @@ -18,7 +17,7 @@ impl usize { pub const MAX: usize = 10; // FIXME(#8995) uncomment this when associated types in inherent impls are supported - // @ has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.usize.html#associatedtype.ME"]' 'Self::ME' + // @ has - '//a[@href="{{channel}}/std/primitive.usize.html#associatedtype.ME"]' 'Self::ME' // / [Self::ME] //pub type ME = usize; } diff --git a/src/test/rustdoc/primitive-link.rs b/src/test/rustdoc/primitive-link.rs index dd455e45bfc2a..125e0c849731a 100644 --- a/src/test/rustdoc/primitive-link.rs +++ b/src/test/rustdoc/primitive-link.rs @@ -1,12 +1,12 @@ #![crate_name = "foo"] -// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.u32.html"]' 'u32' -// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i64.html"]' 'i64' -// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html"]' 'std::primitive::i32' -// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html"]' 'std::primitive::str' +// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="{{channel}}/std/primitive.u32.html"]' 'u32' +// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="{{channel}}/std/primitive.i64.html"]' 'i64' +// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="{{channel}}/std/primitive.i32.html"]' 'std::primitive::i32' +// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="{{channel}}/std/primitive.str.html"]' 'std::primitive::str' -// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' 'std::primitive::i32::MAX' +// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="{{channel}}/std/primitive.i32.html#associatedconstant.MAX"]' 'std::primitive::i32::MAX' /// It contains [`u32`] and [i64]. /// It also links to [std::primitive::i32], [std::primitive::str], diff --git a/src/test/rustdoc/primitive-reexport.rs b/src/test/rustdoc/primitive-reexport.rs index de18360d4077c..10a8a47db5248 100644 --- a/src/test/rustdoc/primitive-reexport.rs +++ b/src/test/rustdoc/primitive-reexport.rs @@ -5,24 +5,24 @@ // @has bar/p/index.html // @has - '//code' 'pub use bool;' -// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.bool.html"]' 'bool' +// @has - '//code/a[@href="{{channel}}/std/primitive.bool.html"]' 'bool' // @has - '//code' 'pub use char as my_char;' -// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' +// @has - '//code/a[@href="{{channel}}/std/primitive.char.html"]' 'char' pub mod p { pub use foo::bar::*; } // @has bar/baz/index.html // @has - '//code' 'pub use bool;' -// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.bool.html"]' 'bool' +// @has - '//code/a[@href="{{channel}}/std/primitive.bool.html"]' 'bool' // @has - '//code' 'pub use char as my_char;' -// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' +// @has - '//code/a[@href="{{channel}}/std/primitive.char.html"]' 'char' pub use foo::bar as baz; // @has bar/index.html // @has - '//code' 'pub use str;' -// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html"]' 'str' +// @has - '//code/a[@href="{{channel}}/std/primitive.str.html"]' 'str' // @has - '//code' 'pub use i32 as my_i32;' -// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html"]' 'i32' +// @has - '//code/a[@href="{{channel}}/std/primitive.i32.html"]' 'i32' pub use str; pub use i32 as my_i32;