File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ // This is a regression test for <https://github.com/rust-lang/rust/issues/141553>.
2+ // If the link is generated from expansion, we should not emit the lint.
3+
4+ #![ deny( rustdoc:: redundant_explicit_links) ]
5+
6+ macro_rules! mac1 {
7+ ( ) => {
8+ "provided by a [`BufferProvider`](crate::BufferProvider)."
9+ } ;
10+ }
11+
12+ macro_rules! mac2 {
13+ ( ) => {
14+ #[ doc = mac1!( ) ]
15+ pub struct BufferProvider ;
16+ }
17+ }
18+
19+ // Should not lint.
20+ #[ doc = mac1 ! ( ) ]
21+ pub struct Foo ;
22+
23+ // Should not lint.
24+ mac2 ! { }
25+
26+ #[ doc = "provided by a [`BufferProvider`](crate::BufferProvider)." ]
27+ //~^ ERROR: redundant_explicit_links
28+ pub struct Bla ;
Original file line number Diff line number Diff line change 1+ error: redundant explicit link target
2+ --> $DIR/redundant_explicit_links-expansion.rs:26:43
3+ |
4+ LL | #[doc = "provided by a [`BufferProvider`](crate::BufferProvider)."]
5+ | ---------------- ^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant
6+ | |
7+ | because label contains path that resolves to same destination
8+ |
9+ = note: when a link's destination is not specified,
10+ the label is used to resolve intra-doc links
11+ note: the lint level is defined here
12+ --> $DIR/redundant_explicit_links-expansion.rs:4:9
13+ |
14+ LL | #![deny(rustdoc::redundant_explicit_links)]
15+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+ help: remove explicit link target
17+ |
18+ LL - #[doc = "provided by a [`BufferProvider`](crate::BufferProvider)."]
19+ LL + #[doc = "provided by a [`BufferProvider`]."]
20+ |
21+
22+ error: aborting due to 1 previous error
23+
You can’t perform that action at this time.
0 commit comments