Skip to content

rustdoc: show attributes on enum variants #142987

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lolbinarycat
Copy link
Contributor

@lolbinarycat lolbinarycat commented Jun 24, 2025

mostly for #[non_exhaustive]

unsure if there's any attributes we should take care to not include, it could use render_code_attribute and is_non_exhaustive instead, if that is a concern.

fixes #142599

@rustbot
Copy link
Collaborator

rustbot commented Jun 24, 2025

r? @GuillaumeGomez

rustbot has assigned @GuillaumeGomez.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Jun 24, 2025
@lolbinarycat lolbinarycat force-pushed the rustdoc-non_exhaustive-enum-v-142599 branch from 232bdaf to a73c70e Compare June 24, 2025 23:07
@GuillaumeGomez
Copy link
Member

Looks good to me, thanks! Since @fmease opened the issue, I'll let them take a look before r+ing.

Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attribute-related changes look fine to me.

It might be worth noting that for non-exhaustive structs, below the "introductory code snippet" we say Fields (Non-exhaustive) and have a <details> section explaining what that implies whereas for enum variants, we just say Fields but we do have that same <details> section. Not sure if y'all want to address that in this PR.

(Does this show up in Aliased Type sections? Just curious. I know that we only allowlist repr for aliased enums and structs and we should include #[non_exhaustive] at some point but that's a another story for another day).

@GuillaumeGomez
Copy link
Member

Normally it should since #140863 which unified alias rendering with the other ADTs. However I suppose adding a test to ensure it is rendering as expected would be a good idea.

Can you add a type alias on the enum in your rustdoc test @lolbinarycat please?

mostly for #[non_exhaustive]
@lolbinarycat lolbinarycat force-pushed the rustdoc-non_exhaustive-enum-v-142599 branch from a73c70e to 4bece45 Compare June 25, 2025 18:47
@lolbinarycat
Copy link
Contributor Author

Yes it shows up in the aliased type. Added a test for that (unfortunately I couldn't make it super robust due to not having access to all of XPath)

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 doesn't render #[non_exhaustive] on enum variants
4 participants