Skip to content

Commit ab65989

Browse files
authoredMay 6, 2021
Rollup merge of rust-lang#84950 - pietroalbini:revert-3478f83c0, r=Mark-Simulacrum
Revert PR 83866 rust-lang#83866 caused multiple test failures when Rust's channel is changed from nightly to anything else. The PR will have to be landed again after the test suite is fixed. The two kinds of test failures were: * Rustdoc tests failed because the links in the generated HTML didn't point at nightly anymore, see rust-lang#84909 (comment) * Rustdoc UI tests failed because the links included in error messages didn't point at nightly anymore, see rust-lang#84909 (comment) r? `@Mark-Simulacrum` cc `@jyn514`
2 parents 0c94c4b + 5b34bf4 commit ab65989

File tree

7 files changed

+8
-47
lines changed

7 files changed

+8
-47
lines changed
 

‎src/librustdoc/clean/types.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,9 @@ impl Item {
517517
Some(ExternalLocation::Remote(ref s)) => {
518518
format!("{}/std/", s.trim_end_matches('/'))
519519
}
520-
Some(ExternalLocation::Unknown) | None => format!(
521-
"https://doc.rust-lang.org/{}/std/",
522-
crate::doc_rust_lang_org_channel(),
523-
),
520+
Some(ExternalLocation::Unknown) | None => {
521+
"https://doc.rust-lang.org/nightly/std/".to_string()
522+
}
524523
};
525524
// This is a primitive so the url is done "by hand".
526525
let tail = fragment.find('#').unwrap_or_else(|| fragment.len());

‎src/librustdoc/clean/utils.rs

-11
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,3 @@ crate fn has_doc_flag(attrs: ty::Attributes<'_>, flag: Symbol) -> bool {
542542
&& attr.meta_item_list().map_or(false, |l| rustc_attr::list_contains_name(&l, flag))
543543
})
544544
}
545-
546-
/// Return a channel suitable for using in a `doc.rust-lang.org/{channel}` format string.
547-
crate fn doc_rust_lang_org_channel() -> &'static str {
548-
match env!("CFG_RELEASE_CHANNEL") {
549-
"stable" => env!("CFG_RELEASE_NUM"),
550-
"beta" => "beta",
551-
"nightly" | "dev" => "nightly",
552-
// custom build of rustdoc maybe? link to the stable docs just in case
553-
_ => "",
554-
}
555-
}

‎src/librustdoc/core.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -406,18 +406,15 @@ crate fn run_global_ctxt(
406406
let mut krate = tcx.sess.time("clean_crate", || clean::krate(&mut ctxt));
407407

408408
if krate.module.doc_value().map(|d| d.is_empty()).unwrap_or(true) {
409-
let help = format!(
410-
"The following guide may be of use:\n\
411-
https://doc.rust-lang.org/{}/rustdoc/how-to-write-documentation.html",
412-
crate::doc_rust_lang_org_channel(),
413-
);
409+
let help = "The following guide may be of use:\n\
410+
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
414411
tcx.struct_lint_node(
415412
crate::lint::MISSING_CRATE_LEVEL_DOCS,
416413
DocContext::as_local_hir_id(tcx, krate.module.def_id).unwrap(),
417414
|lint| {
418415
let mut diag =
419416
lint.build("no documentation found for this crate's top-level module");
420-
diag.help(&help);
417+
diag.help(help);
421418
diag.emit();
422419
},
423420
);

‎src/librustdoc/lib.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ use rustc_session::config::{make_crate_type_option, ErrorOutputType, RustcOptGro
8282
use rustc_session::getopts;
8383
use rustc_session::{early_error, early_warn};
8484

85-
use crate::clean::utils::doc_rust_lang_org_channel;
86-
8785
/// A macro to create a FxHashMap.
8886
///
8987
/// Example:
@@ -606,10 +604,7 @@ fn usage(argv0: &str) {
606604
}
607605
println!("{}", options.usage(&format!("{} [options] <input>", argv0)));
608606
println!(" @path Read newline separated options from `path`\n");
609-
println!(
610-
"More information available at https://doc.rust-lang.org/{}/rustdoc/what-is-rustdoc.html",
611-
doc_rust_lang_org_channel()
612-
);
607+
println!("More information available at https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html")
613608
}
614609

615610
/// A result type used by several functions under `main()`.

‎src/librustdoc/passes/collect_intra_doc_links.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -2017,14 +2017,7 @@ fn disambiguator_error(
20172017
msg: &str,
20182018
) {
20192019
diag_info.link_range = disambiguator_range;
2020-
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |diag, _sp| {
2021-
let msg = format!(
2022-
"see https://doc.rust-lang.org/{}/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators \
2023-
for more info about disambiguators",
2024-
crate::doc_rust_lang_org_channel(),
2025-
);
2026-
diag.note(&msg);
2027-
});
2020+
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |_diag, _sp| {});
20282021
}
20292022

20302023
/// Report an ambiguity error, where there were multiple possible resolutions.

‎src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ note: the lint level is defined here
1010
LL | #![deny(warnings)]
1111
| ^^^^^^^^
1212
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]`
13-
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
1413

1514
error: aborting due to previous error
1615

‎src/test/rustdoc-ui/intra-doc/unknown-disambiguator.stderr

-11
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,36 @@ note: the lint level is defined here
1010
LL | #![deny(warnings)]
1111
| ^^^^^^^^
1212
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]`
13-
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
1413

1514
error: unknown disambiguator `bar`
1615
--> $DIR/unknown-disambiguator.rs:3:35
1716
|
1817
LL | //! Linking to [foo@banana] and [`bar@banana!()`].
1918
| ^^^
20-
|
21-
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
2219

2320
error: unknown disambiguator `foo`
2421
--> $DIR/unknown-disambiguator.rs:9:34
2522
|
2623
LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello].
2724
| ^^^
28-
|
29-
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
3025

3126
error: unknown disambiguator `foo`
3227
--> $DIR/unknown-disambiguator.rs:9:48
3328
|
3429
LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello].
3530
| ^^^
36-
|
37-
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
3831

3932
error: unknown disambiguator ``
4033
--> $DIR/unknown-disambiguator.rs:6:31
4134
|
4235
LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()).
4336
| ^
44-
|
45-
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
4637

4738
error: unknown disambiguator ``
4839
--> $DIR/unknown-disambiguator.rs:6:57
4940
|
5041
LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()).
5142
| ^
52-
|
53-
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
5443

5544
error: aborting due to 6 previous errors
5645

0 commit comments

Comments
 (0)
Please sign in to comment.