Add test to ensure it does not panic when an intra-doc link is generated from a macro

This commit is contained in:
Guillaume Gomez 2022-03-01 12:07:17 +01:00
parent 741553e55a
commit 885e808540
4 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1 @@
//! [`long_cat`] is really long

View File

@ -0,0 +1,12 @@
// check-pass
macro_rules! m {
() => {
/// A
//~^ WARNING
#[path = "auxiliary/module_macro_doc.rs"]
pub mod mymodule;
}
}
m!();

View File

@ -0,0 +1,20 @@
warning: unresolved link to `long_cat`
--> $DIR/macro-docs.rs:5:9
|
LL | /// A
| ^^^^^
...
LL | m!();
| ---- in this macro invocation
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
= note: the link appears in this line:
[`long_cat`] is really long
^^^^^^^^^^
= note: no item named `long_cat` in scope
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 1 warning emitted

View File