add tests for broken links in unused doc strings

This commit is contained in:
Lukas Markeffsky 2023-07-21 23:10:12 +02:00
parent bb98f3ad4d
commit 237ed1630f
2 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,16 @@
// Test that we don't ICE with broken links that don't show up in the docs.
// check-pass
// edition: 2021
/// [1]
//~^ WARN unresolved link to `1`
//~| WARN unresolved link to `1`
pub use {std, core};
/// [2]
pub use {};
/// [3]
//~^ WARN unresolved link to `3`
pub extern crate alloc;

View file

@ -0,0 +1,27 @@
warning: unresolved link to `3`
--> $DIR/broken-link-in-unused-doc-string.rs:14:6
|
LL | /// [3]
| ^ no item named `3` 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 `1`
--> $DIR/broken-link-in-unused-doc-string.rs:6:6
|
LL | /// [1]
| ^ no item named `1` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `1`
--> $DIR/broken-link-in-unused-doc-string.rs:6:6
|
LL | /// [1]
| ^ no item named `1` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: 3 warnings emitted