Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of some false negatives in rustdoc::broken_intra_doc_links #132748

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
13 changes: 10 additions & 3 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
@@ -930,13 +930,20 @@ fn preprocess_link(
ori_link: &MarkdownLink,
dox: &str,
) -> Option<Result<PreprocessingInfo, PreprocessingError>> {
// certain link kinds cannot have their path be urls,
// so they should not be ignored, no matter how much they look like urls.
// e.g. [https://example.com/] is not a link to example.com.
let can_be_url = ori_link.kind != LinkType::ShortcutUnknown
&& ori_link.kind != LinkType::CollapsedUnknown
&& ori_link.kind != LinkType::ReferenceUnknown;

// [] is mostly likely not supposed to be a link
if ori_link.link.is_empty() {
return None;
}

// Bail early for real links.
if ori_link.link.contains('/') {
if can_be_url && ori_link.link.contains('/') {
return None;
}

@@ -961,7 +968,7 @@ fn preprocess_link(
Ok(None) => (None, link, link),
Err((err_msg, relative_range)) => {
// Only report error if we would not have ignored this link. See issue #83859.
if !should_ignore_link_with_disambiguators(link) {
if !(can_be_url && should_ignore_link_with_disambiguators(link)) {
let disambiguator_range = match range_between_backticks(&ori_link.range, dox) {
MarkdownLinkRange::Destination(no_backticks_range) => {
MarkdownLinkRange::Destination(
@@ -978,7 +985,7 @@ fn preprocess_link(
}
};

if should_ignore_link(path_str) {
if can_be_url && should_ignore_link(path_str) {
return None;
}

13 changes: 13 additions & 0 deletions tests/rustdoc-ui/bad-intra-doc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![no_std]
#![deny(rustdoc::broken_intra_doc_links)]

// regression test for https://github.com/rust-lang/rust/issues/54191

/// this is not a link to [`example.com`] //~ERROR unresolved link
///
/// this link [`has spaces in it`].
///
/// attempted link to method: [`Foo.bar()`] //~ERROR unresolved link
///
/// classic broken intra-doc link: [`Bar`] //~ERROR unresolved link
pub struct Foo;
31 changes: 31 additions & 0 deletions tests/rustdoc-ui/bad-intra-doc.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
error: unresolved link to `example.com`
--> $DIR/bad-intra-doc.rs:6:29
|
LL | /// this is not a link to [`example.com`]
| ^^^^^^^^^^^ no item named `example.com` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
note: the lint level is defined here
--> $DIR/bad-intra-doc.rs:2:9
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unresolved link to `Foo.bar`
--> $DIR/bad-intra-doc.rs:10:33
|
LL | /// attempted link to method: [`Foo.bar()`]
| ^^^^^^^^^ no item named `Foo.bar` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

error: unresolved link to `Bar`
--> $DIR/bad-intra-doc.rs:12:38
|
LL | /// classic broken intra-doc link: [`Bar`]
| ^^^ no item named `Bar` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

error: aborting due to 3 previous errors

30 changes: 15 additions & 15 deletions tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs
Original file line number Diff line number Diff line change
@@ -2,67 +2,67 @@
//@ normalize-stderr-test: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL"

//! [struct@m!()] //~ WARN: unmatched disambiguator `struct` and suffix `!()`
//! [struct@m!{}]
//! [struct@m!{}] //~ WARN: unmatched disambiguator `struct` and suffix `!{}`
//! [struct@m![]]
//! [struct@f()] //~ WARN: unmatched disambiguator `struct` and suffix `()`
//! [struct@m!] //~ WARN: unmatched disambiguator `struct` and suffix `!`
//!
//! [enum@m!()] //~ WARN: unmatched disambiguator `enum` and suffix `!()`
//! [enum@m!{}]
//! [enum@m!{}] //~ WARN: unmatched disambiguator `enum` and suffix `!{}`
//! [enum@m![]]
//! [enum@f()] //~ WARN: unmatched disambiguator `enum` and suffix `()`
//! [enum@m!] //~ WARN: unmatched disambiguator `enum` and suffix `!`
//!
//! [trait@m!()] //~ WARN: unmatched disambiguator `trait` and suffix `!()`
//! [trait@m!{}]
//! [trait@m!{}] //~ WARN: unmatched disambiguator `trait` and suffix `!{}`
//! [trait@m![]]
//! [trait@f()] //~ WARN: unmatched disambiguator `trait` and suffix `()`
//! [trait@m!] //~ WARN: unmatched disambiguator `trait` and suffix `!`
//!
//! [module@m!()] //~ WARN: unmatched disambiguator `module` and suffix `!()`
//! [module@m!{}]
//! [module@m!{}] //~ WARN: unmatched disambiguator `module` and suffix `!{}`
//! [module@m![]]
//! [module@f()] //~ WARN: unmatched disambiguator `module` and suffix `()`
//! [module@m!] //~ WARN: unmatched disambiguator `module` and suffix `!`
//!
//! [mod@m!()] //~ WARN: unmatched disambiguator `mod` and suffix `!()`
//! [mod@m!{}]
//! [mod@m!{}] //~ WARN: unmatched disambiguator `mod` and suffix `!{}`
//! [mod@m![]]
//! [mod@f()] //~ WARN: unmatched disambiguator `mod` and suffix `()`
//! [mod@m!] //~ WARN: unmatched disambiguator `mod` and suffix `!`
//!
//! [const@m!()] //~ WARN: unmatched disambiguator `const` and suffix `!()`
//! [const@m!{}]
//! [const@m!{}] //~ WARN: unmatched disambiguator `const` and suffix `!{}`
//! [const@m![]]
//! [const@f()] //~ WARN: incompatible link kind for `f`
//! [const@m!] //~ WARN: unmatched disambiguator `const` and suffix `!`
//!
//! [constant@m!()] //~ WARN: unmatched disambiguator `constant` and suffix `!()`
//! [constant@m!{}]
//! [constant@m!{}] //~ WARN: unmatched disambiguator `constant` and suffix `!{}`
//! [constant@m![]]
//! [constant@f()] //~ WARN: incompatible link kind for `f`
//! [constant@m!] //~ WARN: unmatched disambiguator `constant` and suffix `!`
//!
//! [static@m!()] //~ WARN: unmatched disambiguator `static` and suffix `!()`
//! [static@m!{}]
//! [static@m!{}] //~ WARN: unmatched disambiguator `static` and suffix `!{}`
//! [static@m![]]
//! [static@f()] //~ WARN: incompatible link kind for `f`
//! [static@m!] //~ WARN: unmatched disambiguator `static` and suffix `!`
//!
//! [function@m!()] //~ WARN: unmatched disambiguator `function` and suffix `!()`
//! [function@m!{}]
//! [function@m!{}] //~ WARN: unmatched disambiguator `function` and suffix `!{}`
//! [function@m![]]
//! [function@f()]
//! [function@m!] //~ WARN: unmatched disambiguator `function` and suffix `!`
//!
//! [fn@m!()] //~ WARN: unmatched disambiguator `fn` and suffix `!()`
//! [fn@m!{}]
//! [fn@m!{}] //~ WARN: unmatched disambiguator `fn` and suffix `!{}`
//! [fn@m![]]
//! [fn@f()]
//! [fn@m!] //~ WARN: unmatched disambiguator `fn` and suffix `!`
//!
//! [method@m!()] //~ WARN: unmatched disambiguator `method` and suffix `!()`
//! [method@m!{}]
//! [method@m!{}] //~ WARN: unmatched disambiguator `method` and suffix `!{}`
//! [method@m![]]
//! [method@f()]
//! [method@m!] //~ WARN: unmatched disambiguator `method` and suffix `!`
@@ -74,13 +74,13 @@
//! [derive@m!] //~ WARN: incompatible link kind for `m`
//!
//! [type@m!()] //~ WARN: unmatched disambiguator `type` and suffix `!()`
//! [type@m!{}]
//! [type@m!{}] //~ WARN: unmatched disambiguator `type` and suffix `!{}`
//! [type@m![]]
//! [type@f()] //~ WARN: unmatched disambiguator `type` and suffix `()`
//! [type@m!] //~ WARN: unmatched disambiguator `type` and suffix `!`
//!
//! [value@m!()] //~ WARN: unmatched disambiguator `value` and suffix `!()`
//! [value@m!{}]
//! [value@m!{}] //~ WARN: unmatched disambiguator `value` and suffix `!{}`
//! [value@m![]]
//! [value@f()]
//! [value@m!] //~ WARN: unmatched disambiguator `value` and suffix `!`
@@ -92,13 +92,13 @@
//! [macro@m!]
//!
//! [prim@m!()] //~ WARN: unmatched disambiguator `prim` and suffix `!()`
//! [prim@m!{}]
//! [prim@m!{}] //~ WARN: unmatched disambiguator `prim` and suffix `!{}`
//! [prim@m![]]
//! [prim@f()] //~ WARN: unmatched disambiguator `prim` and suffix `()`
//! [prim@m!] //~ WARN: unmatched disambiguator `prim` and suffix `!`
//!
//! [primitive@m!()] //~ WARN: unmatched disambiguator `primitive` and suffix `!()`
//! [primitive@m!{}]
//! [primitive@m!{}] //~ WARN: unmatched disambiguator `primitive` and suffix `!{}`
//! [primitive@m![]]
//! [primitive@f()] //~ WARN: unmatched disambiguator `primitive` and suffix `()`
//! [primitive@m!] //~ WARN: unmatched disambiguator `primitive` and suffix `!`
122 changes: 121 additions & 1 deletion tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr
Original file line number Diff line number Diff line change
@@ -7,6 +7,14 @@ LL | //! [struct@m!()]
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

warning: unmatched disambiguator `struct` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:5:6
|
LL | //! [struct@m!{}]
| ^^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `struct` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:7:6
|
@@ -31,6 +39,14 @@ LL | //! [enum@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `enum` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:11:6
|
LL | //! [enum@m!{}]
| ^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `enum` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:13:6
|
@@ -55,6 +71,14 @@ LL | //! [trait@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `trait` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:17:6
|
LL | //! [trait@m!{}]
| ^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `trait` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:19:6
|
@@ -79,6 +103,14 @@ LL | //! [module@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `module` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:23:6
|
LL | //! [module@m!{}]
| ^^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `module` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:25:6
|
@@ -103,6 +135,14 @@ LL | //! [mod@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `mod` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:29:6
|
LL | //! [mod@m!{}]
| ^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `mod` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:31:6
|
@@ -127,6 +167,14 @@ LL | //! [const@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `const` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:35:6
|
LL | //! [const@m!{}]
| ^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: incompatible link kind for `f`
--> $DIR/disambiguator-endswith-named-suffix.rs:37:6
|
@@ -155,6 +203,14 @@ LL | //! [constant@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `constant` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:41:6
|
LL | //! [constant@m!{}]
| ^^^^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: incompatible link kind for `f`
--> $DIR/disambiguator-endswith-named-suffix.rs:43:6
|
@@ -183,6 +239,14 @@ LL | //! [static@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `static` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:47:6
|
LL | //! [static@m!{}]
| ^^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: incompatible link kind for `f`
--> $DIR/disambiguator-endswith-named-suffix.rs:49:6
|
@@ -211,6 +275,14 @@ LL | //! [function@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `function` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:53:6
|
LL | //! [function@m!{}]
| ^^^^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `function` and suffix `!`
--> $DIR/disambiguator-endswith-named-suffix.rs:56:6
|
@@ -227,6 +299,14 @@ LL | //! [fn@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `fn` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:59:6
|
LL | //! [fn@m!{}]
| ^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `fn` and suffix `!`
--> $DIR/disambiguator-endswith-named-suffix.rs:62:6
|
@@ -243,6 +323,14 @@ LL | //! [method@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `method` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:65:6
|
LL | //! [method@m!{}]
| ^^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `method` and suffix `!`
--> $DIR/disambiguator-endswith-named-suffix.rs:68:6
|
@@ -303,6 +391,14 @@ LL | //! [type@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `type` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:77:6
|
LL | //! [type@m!{}]
| ^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `type` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:79:6
|
@@ -327,6 +423,14 @@ LL | //! [value@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `value` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:83:6
|
LL | //! [value@m!{}]
| ^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `value` and suffix `!`
--> $DIR/disambiguator-endswith-named-suffix.rs:86:6
|
@@ -351,6 +455,14 @@ LL | //! [prim@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `prim` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:95:6
|
LL | //! [prim@m!{}]
| ^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `prim` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:97:6
|
@@ -375,6 +487,14 @@ LL | //! [primitive@m!()]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `primitive` and suffix `!{}`
--> $DIR/disambiguator-endswith-named-suffix.rs:101:6
|
LL | //! [primitive@m!{}]
| ^^^^^^^^^
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: unmatched disambiguator `primitive` and suffix `()`
--> $DIR/disambiguator-endswith-named-suffix.rs:103:6
|
@@ -391,5 +511,5 @@ LL | //! [primitive@m!]
|
= note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

warning: 46 warnings emitted
warning: 61 warnings emitted

2 changes: 1 addition & 1 deletion tests/rustdoc-ui/intra-doc/weird-syntax.rs
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ pub struct XLinkToCloneWithStartSpace;
/// [x][struct@Clone ] //~ERROR link
pub struct XLinkToCloneWithEndSpace;

/// [x][Clone\(\)] not URL-shaped enough
/// [x][Clone\(\)] //~ERROR link
pub struct XLinkToCloneWithEscapedParens;

/// [x][`Clone`] not URL-shaped enough
10 changes: 9 additions & 1 deletion tests/rustdoc-ui/intra-doc/weird-syntax.stderr
Original file line number Diff line number Diff line change
@@ -118,6 +118,14 @@ help: to link to the trait, prefix with `trait@`
LL | /// [x][trait@Clone ]
| ~~~~~~

error: unresolved link to `Clone\(\)`
--> $DIR/weird-syntax.rs:68:9
|
LL | /// [x][Clone\(\)]
| ^^^^^^^^^ no item named `Clone\(\)` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

error: unresolved link to `Clone`
--> $DIR/weird-syntax.rs:74:9
|
@@ -268,5 +276,5 @@ LL | /// The [cln][] link here will produce a plain text suggestion
|
= help: to link to the trait, prefix with `trait@`: trait@Clone

error: aborting due to 26 previous errors
error: aborting due to 27 previous errors

14 changes: 10 additions & 4 deletions tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
//@ check-pass

/// [`…foo`] [`…bar`] [`Err`]
/// [`…foo`] //~ WARN: unresolved link
/// [`…bar`] //~ WARN: unresolved link
/// [`Err`]
pub struct Broken {}

/// [`…`] [`…`] [`Err`]
/// [`…`] //~ WARN: unresolved link
/// [`…`] //~ WARN: unresolved link
/// [`Err`]
pub struct Broken2 {}

/// [`…`][…] [`…`][…] [`Err`]
/// [`…`][…] //~ WARN: unresolved link
/// [`…`][…] //~ WARN: unresolved link
/// [`Err`]
pub struct Broken3 {}

/// […………………………][Broken3]
pub struct Broken4 {}

/// [Broken3][…………………………]
/// [Broken3][…………………………] //~ WARN: unresolved link
pub struct Broken5 {}

pub struct Err;
59 changes: 59 additions & 0 deletions tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
warning: unresolved link to `…foo`
--> $DIR/redundant_explicit_links-utf8.rs:3:7
|
LL | /// [`…foo`]
| ^^^^ no item named `…foo` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

warning: unresolved link to `…bar`
--> $DIR/redundant_explicit_links-utf8.rs:4:7
|
LL | /// [`…bar`]
| ^^^^ no item named `…bar` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `…`
--> $DIR/redundant_explicit_links-utf8.rs:8:7
|
LL | /// [`…`]
| ^ no item named `…` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `…`
--> $DIR/redundant_explicit_links-utf8.rs:9:7
|
LL | /// [`…`]
| ^ no item named `…` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `…`
--> $DIR/redundant_explicit_links-utf8.rs:13:11
|
LL | /// [`…`][…]
| ^ no item named `…` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `…`
--> $DIR/redundant_explicit_links-utf8.rs:14:11
|
LL | /// [`…`][…]
| ^ no item named `…` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `…………………………`
--> $DIR/redundant_explicit_links-utf8.rs:21:15
|
LL | /// [Broken3][…………………………]
| ^^^^^^^^^^ no item named `…………………………` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 7 warnings emitted

Loading