diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-03-01 12:07:17 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-03-01 12:07:17 +0100 |
| commit | 885e80854063e8ad4736aeb100c42230c9ef0a70 (patch) | |
| tree | 7816a0cc5a01d5bf0b766938199b7b9039d53736 | |
| parent | 741553e55a6d44c4d86e6cd4bea3b82c92f04848 (diff) | |
| download | rust-885e80854063e8ad4736aeb100c42230c9ef0a70.tar.gz rust-885e80854063e8ad4736aeb100c42230c9ef0a70.zip | |
Add test to ensure it does not panic when an intra-doc link is generated from a macro
| -rw-r--r-- | src/test/rustdoc-ui/auxiliary/module_macro_doc.rs | 1 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/macro-docs.rs | 12 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/macro-docs.stderr | 20 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/macro-docs.stdout | 0 |
4 files changed, 33 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/auxiliary/module_macro_doc.rs b/src/test/rustdoc-ui/auxiliary/module_macro_doc.rs new file mode 100644 index 00000000000..9d6b52b95a7 --- /dev/null +++ b/src/test/rustdoc-ui/auxiliary/module_macro_doc.rs @@ -0,0 +1 @@ +//! [`long_cat`] is really long diff --git a/src/test/rustdoc-ui/macro-docs.rs b/src/test/rustdoc-ui/macro-docs.rs new file mode 100644 index 00000000000..0e8472eb242 --- /dev/null +++ b/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!(); diff --git a/src/test/rustdoc-ui/macro-docs.stderr b/src/test/rustdoc-ui/macro-docs.stderr new file mode 100644 index 00000000000..e3cc1731146 --- /dev/null +++ b/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 + diff --git a/src/test/rustdoc-ui/macro-docs.stdout b/src/test/rustdoc-ui/macro-docs.stdout new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/src/test/rustdoc-ui/macro-docs.stdout |
