Closed
Description
The warning added by #96008 claims that doc(hidden)
on an impl item is ignored by rustdoc, but it isn't necessarily.
The warning says:
whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item
which is not true in the following repro:
pub trait Trait {
type A;
type B;
}
pub struct Struct;
impl Trait for Struct {
type A = [(); "interesting type".len()];
#[doc(hidden)]
type B = [(); "nasty uninteresting type".len()];
}
$ cargo check
warning: `#[doc(hidden)]` is ignored on trait impl items
--> src/lib.rs:10:5
|
10 | #[doc(hidden)]
| ^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(unused_attributes)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item
This warning is a false positive. Rustdoc does pay attention to this attribute. For the code above, the rendered documentation of Struct
and Trait
looks like:
![]() | ![]() |
After removing the supposedly unused doc(hidden)
attribute and rendering again, the "nasty uninteresting type" that we wanted not shown is going to get rendered on both pages:
![]() | ![]() |
Meta
rustc --version --verbose
:
rustc 1.62.0-nightly (88860d547 2022-05-09)
binary: rustc
commit-hash: 88860d5474a32f507dde8fba8df35fd2064f11b9
commit-date: 2022-05-09
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1