mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Add ui test for redundant_explicit_links rustdoc lint for items coming from expansion
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// Should not lint.
|
||||
#[doc = mac1!()]
|
||||
pub struct Foo;
|
||||
|
||||
// Should not lint.
|
||||
mac2!{}
|
||||
|
||||
#[doc = "provided by a [`BufferProvider`](crate::BufferProvider)."]
|
||||
//~^ ERROR: redundant_explicit_links
|
||||
pub struct Bla;
|
||||
@@ -0,0 +1,23 @@
|
||||
error: redundant explicit link target
|
||||
--> $DIR/redundant_explicit_links-expansion.rs:26:43
|
||||
|
|
||||
LL | #[doc = "provided by a [`BufferProvider`](crate::BufferProvider)."]
|
||||
| ---------------- ^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant
|
||||
| |
|
||||
| because label contains path that resolves to same destination
|
||||
|
|
||||
= note: when a link's destination is not specified,
|
||||
the label is used to resolve intra-doc links
|
||||
note: the lint level is defined here
|
||||
--> $DIR/redundant_explicit_links-expansion.rs:4:9
|
||||
|
|
||||
LL | #![deny(rustdoc::redundant_explicit_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: remove explicit link target
|
||||
|
|
||||
LL - #[doc = "provided by a [`BufferProvider`](crate::BufferProvider)."]
|
||||
LL + #[doc = "provided by a [`BufferProvider`]."]
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Reference in New Issue
Block a user