Skip to content

Commit

Permalink
Add test to ensure it does not panic when an intra-doc link is genera…
Browse files Browse the repository at this point in the history
…ted from a macro
  • Loading branch information
GuillaumeGomez committed Mar 1, 2022
1 parent 741553e commit 885e808
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/test/rustdoc-ui/auxiliary/module_macro_doc.rs
@@ -0,0 +1 @@
//! [`long_cat`] is really long
12 changes: 12 additions & 0 deletions src/test/rustdoc-ui/macro-docs.rs
@@ -0,0 +1,12 @@
// check-pass

macro_rules! m {
() => {
/// A
//~^ WARNING
#[path = "auxiliary/module_macro_doc.rs"]
pub mod mymodule;
}
}

m!();
20 changes: 20 additions & 0 deletions src/test/rustdoc-ui/macro-docs.stderr
@@ -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

Empty file.

0 comments on commit 885e808

Please sign in to comment.