rustdoc: Link to the docs on namespaces when an unknown disambiguator is found
This commit is contained in:
parent
1c158b6a8b
commit
9866ea0ac5
@ -1924,7 +1924,20 @@ fn disambiguator_error(
|
||||
msg: &str,
|
||||
) {
|
||||
diag_info.link_range = disambiguator_range;
|
||||
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |_diag, _sp| {});
|
||||
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |diag, _sp| {
|
||||
let channel = match env!("CFG_RELEASE_CHANNEL") {
|
||||
"stable" => env!("CFG_RELEASE_NUM"),
|
||||
"beta" => "beta",
|
||||
"nightly" | "dev" => "nightly",
|
||||
// custom build of rustdoc maybe? link to the stable docs just in case
|
||||
_ => "",
|
||||
};
|
||||
let msg = format!(
|
||||
"see https://doc.rust-lang.org/{}/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators",
|
||||
channel,
|
||||
);
|
||||
diag.note(&msg);
|
||||
});
|
||||
}
|
||||
|
||||
/// Report an ambiguity error, where there were multiple possible resolutions.
|
||||
|
@ -10,6 +10,7 @@ note: the lint level is defined here
|
||||
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
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -10,36 +10,47 @@ note: the lint level is defined here
|
||||
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
|
||||
|
||||
error: unknown disambiguator `bar`
|
||||
--> $DIR/unknown-disambiguator.rs:3: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
|
||||
|
||||
error: unknown disambiguator `foo`
|
||||
--> $DIR/unknown-disambiguator.rs:9: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
|
||||
|
||||
error: unknown disambiguator `foo`
|
||||
--> $DIR/unknown-disambiguator.rs:9: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
|
||||
|
||||
error: unknown disambiguator ``
|
||||
--> $DIR/unknown-disambiguator.rs:6: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
|
||||
|
||||
error: unknown disambiguator ``
|
||||
--> $DIR/unknown-disambiguator.rs:6: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
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user