diff options
| author | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-05-20 10:19:23 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-05-20 10:19:23 +0200 |
| commit | e7252739cdaf75d52dcdd6fb8abfa7d495e22a09 (patch) | |
| tree | 1aa9ea6040c105e1a03afc51c3be74acb488476b /src | |
| parent | f24ef2e296ec6fc6fd2e24d7e4bfec3f4cb0577a (diff) | |
Do not warn on inherent doc(hidden) assoc items
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/lint/unused/unused-attr-doc-hidden.fixed | 15 | ||||
| -rw-r--r-- | src/test/ui/lint/unused/unused-attr-doc-hidden.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/lint/unused/unused-attr-doc-hidden.stderr | 14 |
3 files changed, 35 insertions, 9 deletions
diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed b/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed index 36a14097ac3..362ad55707a 100644 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed +++ b/src/test/ui/lint/unused/unused-attr-doc-hidden.fixed @@ -1,5 +1,7 @@ -#![deny(unused_attributes)] +#![feature(inherent_associated_types)] +#![allow(dead_code, incomplete_features)] #![crate_type = "lib"] +#![deny(unused_attributes)] // run-rustfix pub trait Trait { @@ -12,6 +14,17 @@ pub trait Trait { pub struct Implementor; +impl Implementor { + #[doc(hidden)] // no error + type Inh = (); + + #[doc(hidden)] // no error + const INH: () = (); + + #[doc(hidden)] // no error + fn inh() {} +} + impl Trait for Implementor { type It = (); diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.rs b/src/test/ui/lint/unused/unused-attr-doc-hidden.rs index e58c4f22f31..d493ed6dae2 100644 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.rs +++ b/src/test/ui/lint/unused/unused-attr-doc-hidden.rs @@ -1,5 +1,7 @@ -#![deny(unused_attributes)] +#![feature(inherent_associated_types)] +#![allow(dead_code, incomplete_features)] #![crate_type = "lib"] +#![deny(unused_attributes)] // run-rustfix pub trait Trait { @@ -12,6 +14,17 @@ pub trait Trait { pub struct Implementor; +impl Implementor { + #[doc(hidden)] // no error + type Inh = (); + + #[doc(hidden)] // no error + const INH: () = (); + + #[doc(hidden)] // no error + fn inh() {} +} + impl Trait for Implementor { #[doc(hidden)] type It = (); diff --git a/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr b/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr index fd1202a29de..f167bd460db 100644 --- a/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr +++ b/src/test/ui/lint/unused/unused-attr-doc-hidden.stderr @@ -1,11 +1,11 @@ error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:16:5 + --> $DIR/unused-attr-doc-hidden.rs:29:5 | LL | #[doc(hidden)] | ^^^^^^^^^^^^^^ help: remove this attribute | note: the lint level is defined here - --> $DIR/unused-attr-doc-hidden.rs:1:9 + --> $DIR/unused-attr-doc-hidden.rs:4:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(unused_attributes)] = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:21:5 + --> $DIR/unused-attr-doc-hidden.rs:34:5 | LL | #[doc(hidden)] | ^^^^^^^^^^^^^^ help: remove this attribute @@ -22,7 +22,7 @@ LL | #[doc(hidden)] = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:26:11 + --> $DIR/unused-attr-doc-hidden.rs:39:11 | LL | #[doc(hidden, alias = "aka")] | ^^^^^^-- @@ -33,7 +33,7 @@ LL | #[doc(hidden, alias = "aka")] = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:31:27 + --> $DIR/unused-attr-doc-hidden.rs:44:27 | LL | #[doc(alias = "this", hidden,)] | ^^^^^^- @@ -44,7 +44,7 @@ LL | #[doc(alias = "this", hidden,)] = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:36:11 + --> $DIR/unused-attr-doc-hidden.rs:49:11 | LL | #[doc(hidden, hidden)] | ^^^^^^-- @@ -55,7 +55,7 @@ LL | #[doc(hidden, hidden)] = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item error: `#[doc(hidden)]` is ignored on trait impl items - --> $DIR/unused-attr-doc-hidden.rs:36:19 + --> $DIR/unused-attr-doc-hidden.rs:49:19 | LL | #[doc(hidden, hidden)] | ^^^^^^ help: remove this attribute |
