about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbinarycat <binarycat@envs.net>2024-11-08 13:59:56 -0600
committerbinarycat <binarycat@envs.net>2025-07-24 11:17:13 -0500
commit87d7d80cec060690c9055fa93cb29dfe5eb79ce9 (patch)
tree3d2798367f224cdac61b22090eb5723ea25e3bd1
parent5ae2d42a8c80807c7e3ae7e8aff165fb4d8e046f (diff)
downloadrust-87d7d80cec060690c9055fa93cb29dfe5eb79ce9.tar.gz
rust-87d7d80cec060690c9055fa93cb29dfe5eb79ce9.zip
adjust more unit tests to reflect more aggressive intra-doc linting
-rw-r--r--tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs30
-rw-r--r--tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr122
-rw-r--r--tests/rustdoc-ui/intra-doc/weird-syntax.rs2
-rw-r--r--tests/rustdoc-ui/intra-doc/weird-syntax.stderr24
-rw-r--r--tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs14
-rw-r--r--tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr59
6 files changed, 230 insertions, 21 deletions
diff --git a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs
index 1174e16dd53..cb277d529ce 100644
--- a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs
+++ b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs
@@ -2,67 +2,67 @@
 //@ normalize-stderr: "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 `!`
diff --git a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr
index f4e40a48873..18403385968 100644
--- a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr
+++ b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr
@@ -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
 
diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.rs b/tests/rustdoc-ui/intra-doc/weird-syntax.rs
index d2a922b2b62..1c5977b1bc3 100644
--- a/tests/rustdoc-ui/intra-doc/weird-syntax.rs
+++ b/tests/rustdoc-ui/intra-doc/weird-syntax.rs
@@ -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
diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr
index ad813f0f9b6..3a567e409ef 100644
--- a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr
+++ b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr
@@ -123,6 +123,14 @@ LL - /// [x][struct@Clone ]
 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
    |
@@ -299,5 +307,21 @@ LL | /// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]: the
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
 
+error: unresolved link to `Clone`
+  --> $DIR/weird-syntax.rs:132:9
+   |
+LL | /// The [cln][] link here will produce a plain text suggestion
+   |         ^^^^^ this link resolves to the trait `Clone`, which is not a function
+   |
+   = help: to link to the trait, prefix with `trait@`: trait@Clone
+
+error: incompatible link kind for `Clone`
+  --> $DIR/weird-syntax.rs:137:9
+   |
+LL | /// The [cln][] link here will produce a plain text suggestion
+   |         ^^^^^ this link resolved to a trait, which is not a struct
+   |
+   = help: to link to the trait, prefix with `trait@`: trait@Clone
+
 error: aborting due to 27 previous errors
 
diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs
index 4f4590d45fc..81cd6c73d1c 100644
--- a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs
+++ b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs
@@ -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;
diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr
new file mode 100644
index 00000000000..0a5ff68b908
--- /dev/null
+++ b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr
@@ -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
+