-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Highlight default enum variant in rustdoc output #115438
Comments
To double check, you are asking for changes in the documentation that |
Yes, thanks |
What do you mean by highlighted? |
@GuillaumeGomez any way to show it or make it visible in docs. It can be shown as a flag in front of the default variant or whatever. |
I'm not super convinced that there is any benefit in displaying What do y'all think? |
It also feels like showing this attribute in the docs is similar to #90435, it surfaces something that might not be considered stable API by the author and implies that it is stable. |
Just giving my opinion here. From a crate maintainability point of view this would be great. We use Documenting every enum like below is kind of cumbersome, plus we have to keep it in sync with the actual attribute (which, granted, shouldn't be that often). I feel like this is more of a robustness thing, where a comment can't be out of sync with the actual code (which matches the philosophy of compile checking doc-comment imo). I also feel like this is a similar request as https://doc.rust-lang.org/rustdoc/unstable-features.html#extensions-to-the-doc-attribute.
I disagree, a default derive has the visibility of its enum, if the enum is public then it should be stable. As such, the default is documented only if the enum, and in tern default, are public. Also, if this ever makes it https://rust-lang.github.io/rfcs/3107-derive-default-enum.html#overriding-default-fields, this request would make even more sense. In the example, if beta is public and the default is 1, I want to know that as a lib user. Again this is just my opinion, I understand you guys have high stability constraints and all sort of other constraints :) |
The fact that |
Problem
Since Rust has introduced
#[default]
, can we hightlight it in the doc?Like this one:
For other type of default definition of enums, it can be hard! For example, the following code, can be hard:
or:
We can ignore these cases.
Proposed Solution
No response
Notes
No response
The text was updated successfully, but these errors were encountered: