about summary refs log tree commit diff
path: root/tests/rustdoc-ui/lints/redundant_explicit_links-expansion.rs
blob: 2e42a0a5c5d6158dce82810488726015b4180296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This is a regression test for <https://github.com/rust-lang/rust/issues/141553>.
// If the link is generated from expansion, we should not emit the lint.

#![deny(rustdoc::redundant_explicit_links)]

macro_rules! mac1 {
    () => {
        "provided by a [`BufferProvider`](crate::BufferProvider)."
    };
}

macro_rules! mac2 {
    () => {
        #[doc = mac1!()]
        pub struct BufferProvider;
    }
}

macro_rules! mac3 {
    () => {
        "Provided by"
    };
}

// Should not lint.
#[doc = mac1!()]
pub struct Foo;

// Should not lint.
mac2!{}

#[doc = "provided by a [`BufferProvider`](crate::BufferProvider)."]
/// bla
//~^^ ERROR: redundant_explicit_links
pub struct Bla;

#[doc = mac3!()]
/// a [`BufferProvider`](crate::BufferProvider).
//~^ ERROR: redundant_explicit_links
pub fn f() {}