-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive unused_attributes lint on doc(hidden) attribute on associated type #96890
Comments
My bad, I did not notice that at all 😳. I can adjust the lint once it's decided how we are going to proceed with my changes in general (see / blocked on #96008 (comment)). @rustbot claim |
In summary, This weirdly deviates from my (former) personal mental model of how Out of curiosity, @ dtolnay, how / why do you use this feature? Do you use it to reduce visual clutter? Edit: Ah, well, I overlooked the top right picture. So in some cases the item is indeed entirely hidden, not just the value. |
Should I remove the lint entirely or should I adjust |
Just wanted to add that this is also affecting impl<'a> Origin<'a> {
/// The root: `'/'`.
#[doc(hidden)]
pub const ROOT: Origin<'static> = Origin::const_new("/", None);
}
The
Based on the above, this isn't correct: it actually hides the entire thing, at least for associated constants. |
…t, r=GuillaumeGomez Remove the unused-`#[doc(hidden)]` logic from the `unused_attributes` lint Fixes rust-lang#96890. It was found out that `#[doc(hidden)]` on trait impl items does indeed have an effect on the generated documentation (see the linked issue). In my opinion and the one of [others](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Validy.20checks.20for.20.60.23.5Bdoc.28hidden.29.5D.60/near/281846219), rustdoc's output is actually a bit flawed in that regard but that should be tracked in a new issue I suppose (I will open an issue for that in the near future). The check was introduced in rust-lang#96008 which is marked to be part of version `1.62` (current `beta`). As far as I understand, this means that **this PR needs to be backported** to `beta` to fix rust-lang#96890 on time. Correct me if I am wrong. CC `@dtolnay` (in case you would like to agree or disagree with my decision to fully remove this check) `@rustbot` label A-lint T-compiler T-rustdoc r? `@rust-lang/compiler`
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:
which is not true in the following repro:
This warning is a false positive. Rustdoc does pay attention to this attribute. For the code above, the rendered documentation of
Struct
andTrait
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:(@fmease @lcnr)
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: