Skip to content

Conversation

karolzwolak
Copy link
Member

@karolzwolak karolzwolak commented Aug 24, 2025

Makes #[doc(hidden)] render the same as other attrs, instead of being rendered it the same line like visibility specifiers (pub etc.).
This only has effect when unstable flag document-hidden-items is on, as otherwise items with this attr wouldn't be rendered at all.
Also makes #[doc(hidden)] render for macro_rules!.

Fixes #132304.
r? @GuillaumeGomez


Before:
image
After:
image

Before:
image
After:
image

Makes `#[doc(hidden)]` render the same as other attrs, instead of being
rendered it the same line like visibility specifiers (`pub` etc.).
This only has effect when unstable flag `document-hidden-items` is on,
as otherwise items with this attr wouldn't be rendered at all.
Also makes `#[doc(hidden)]` render for `macro_rules!`.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Aug 24, 2025
@GuillaumeGomez
Copy link
Member

Normally we have a specific display for this attribute, so we don't want to display it with the other attributes.

@karolzwolak
Copy link
Member Author

So you're saying that we don't actually want this attribute to look the same as other attributes?
How do you propose we differentiate it then?
Maybe we could add 👻 emoji next to the attribute like we do in other places?

image

@GuillaumeGomez
Copy link
Member

It's the same for private items: it's only displayed at the module levels for types. We can add a sentence under the type declaration mentioning (with the ghost for the hidden items) that it's a hidden item.

@fmease
Copy link
Member

fmease commented Aug 24, 2025

Since I created the linked issue, my 2¢ are that users rarely want to use --document-hidden-items (regardless of whether it will ever be stabilized or not) and if they do, they likely only want to double-check things I'm assuming. Therefore, rendering doc(hidden) like a normal attribute – which it is – is more than sufficient and in my opinion we needn't spend any extra effort designing and maintaining a special display for it.

@GuillaumeGomez
Copy link
Member

I agree with you. However, doc attributes are always rendered differently and not supposed to be displayed as is in the documentation as they convey extra info that needs to be displayed differently. Displayed attributes are about how they "modify" the item they're applied to, whereas doc attributes only impact how they're displayed in the docs.

So as such, I think doc(hidden) should be handled differently, like I suggested above for example.

@bors
Copy link
Collaborator

bors commented Sep 22, 2025

☔ The latest upstream changes (presumably #146879) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc: Appearance of #[doc(hidden)] differs from all the other attributes
5 participants