Skip to content

Commit 885e808

Browse files
Add test to ensure it does not panic when an intra-doc link is generated from a macro
1 parent 741553e commit 885e808

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//! [`long_cat`] is really long

src/test/rustdoc-ui/macro-docs.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
3+
macro_rules! m {
4+
() => {
5+
/// A
6+
//~^ WARNING
7+
#[path = "auxiliary/module_macro_doc.rs"]
8+
pub mod mymodule;
9+
}
10+
}
11+
12+
m!();

src/test/rustdoc-ui/macro-docs.stderr

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
warning: unresolved link to `long_cat`
2+
--> $DIR/macro-docs.rs:5:9
3+
|
4+
LL | /// A
5+
| ^^^^^
6+
...
7+
LL | m!();
8+
| ---- in this macro invocation
9+
|
10+
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
11+
= note: the link appears in this line:
12+
13+
[`long_cat`] is really long
14+
^^^^^^^^^^
15+
= note: no item named `long_cat` in scope
16+
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
17+
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
18+
19+
warning: 1 warning emitted
20+

src/test/rustdoc-ui/macro-docs.stdout

Whitespace-only changes.

0 commit comments

Comments
 (0)