Skip to content

Commit bbfdfa9

Browse files
committed
Revert PR 83866
That PR caused multiple test failures when Rust's channel is changed from nightly to anything else. The commit will have to be landed again after the test suite is fixed.
1 parent bd9c30d commit bbfdfa9

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
@@ -393,10 +393,9 @@ impl Item {
393393
Some(&(_, _, ExternalLocation::Remote(ref s))) => {
394394
format!("{}/std/", s.trim_end_matches('/'))
395395
}
396-
Some(&(_, _, ExternalLocation::Unknown)) | None => format!(
397-
"https://doc.rust-lang.org/{}/std/",
398-
crate::doc_rust_lang_org_channel(),
399-
),
396+
Some(&(_, _, ExternalLocation::Unknown)) | None => {
397+
"https://doc.rust-lang.org/nightly/std/".to_string()
398+
}
400399
};
401400
// This is a primitive so the url is done "by hand".
402401
let tail = fragment.find('#').unwrap_or_else(|| fragment.len());

src/librustdoc/clean/utils.rs

-11
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,3 @@ crate fn has_doc_flag(attrs: ty::Attributes<'_>, flag: Symbol) -> bool {
525525
&& attr.meta_item_list().map_or(false, |l| rustc_attr::list_contains_name(&l, flag))
526526
})
527527
}
528-
529-
/// Return a channel suitable for using in a `doc.rust-lang.org/{channel}` format string.
530-
crate fn doc_rust_lang_org_channel() -> &'static str {
531-
match env!("CFG_RELEASE_CHANNEL") {
532-
"stable" => env!("CFG_RELEASE_NUM"),
533-
"beta" => "beta",
534-
"nightly" | "dev" => "nightly",
535-
// custom build of rustdoc maybe? link to the stable docs just in case
536-
_ => "",
537-
}
538-
}

src/librustdoc/core.rs

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

452452
if krate.module.doc_value().map(|d| d.is_empty()).unwrap_or(true) {
453-
let help = format!(
454-
"The following guide may be of use:\n\
455-
https://doc.rust-lang.org/{}/rustdoc/how-to-write-documentation.html",
456-
crate::doc_rust_lang_org_channel(),
457-
);
453+
let help = "The following guide may be of use:\n\
454+
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
458455
tcx.struct_lint_node(
459456
crate::lint::MISSING_CRATE_LEVEL_DOCS,
460457
DocContext::as_local_hir_id(tcx, krate.module.def_id).unwrap(),
461458
|lint| {
462459
let mut diag =
463460
lint.build("no documentation found for this crate's top-level module");
464-
diag.help(&help);
461+
diag.help(help);
465462
diag.emit();
466463
},
467464
);

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:
@@ -605,10 +603,7 @@ fn usage(argv0: &str) {
605603
}
606604
println!("{}", options.usage(&format!("{} [options] <input>", argv0)));
607605
println!(" @path Read newline separated options from `path`\n");
608-
println!(
609-
"More information available at https://doc.rust-lang.org/{}/rustdoc/what-is-rustdoc.html",
610-
doc_rust_lang_org_channel()
611-
);
606+
println!("More information available at https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html")
612607
}
613608

614609
/// 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
@@ -1993,14 +1993,7 @@ fn disambiguator_error(
19931993
msg: &str,
19941994
) {
19951995
diag_info.link_range = disambiguator_range;
1996-
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |diag, _sp| {
1997-
let msg = format!(
1998-
"see https://doc.rust-lang.org/{}/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators \
1999-
for more info about disambiguators",
2000-
crate::doc_rust_lang_org_channel(),
2001-
);
2002-
diag.note(&msg);
2003-
});
1996+
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |_diag, _sp| {});
20041997
}
20051998

20061999
/// 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)