-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
base: master
Are you sure you want to change the base?
rustdoc: show attributes on enum variants #142987
Conversation
rustbot has assigned @GuillaumeGomez. Use |
232bdaf
to
a73c70e
Compare
Looks good to me, thanks! Since @fmease opened the issue, I'll let them take a look before r+ing. |
There was a problem hiding this 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).
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]
a73c70e
to
4bece45
Compare
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) |
mostly for #[non_exhaustive]
unsure if there's any attributes we should take care to not include, it could use
render_code_attribute
andis_non_exhaustive
instead, if that is a concern.fixes #142599