-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Change struct rendering to include a case for all fields being omitted #34713
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
Comments
Why not "private fields omitted"? It may be confusing to somebody new ("why are they omitting some/all fields?") |
@bugaevc has a good point, though one (weak) counterpoint is However, since hidden fields are effectively private to most API users, I don't think they necessitate a different wording, especially since those who know enough to know the difference |
When there are hidden fields, we may want to go with "private and hidden fields omitted", if it's worth it. |
I've uploaded an alternative which just renders |
oops, my bad, thanks |
My proposal
stays if your alternative gets merged, for partly opaque structs. By the way, are they a common thing? Are there statistics for stdlib & crates.io? |
I think the only instance in I guess we could also change "some fields omitted" to "private fields omitted" or "private/hidden fields omitted". There's also "some variants omitted" on enums although in that case it's only from |
A bit off-topic: is there a reason why these prototypes are not syntax-highlighted? |
rustdoc: Don't add extra newlines for fully opaque structs Changes the definition for braced structs with only private or hidden fields to save space on the page. Before: ``` pub struct Vec<T> { // some fields omitted } ``` After: ``` pub struct Vec<T> { /* fields omitted */ } ``` This also cleans up empty braced structs. Before: ``` pub struct Foo { } ``` After: ``` pub struct Foo {} ``` [before](https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html) [after](https://ollie27.github.io/rust_doc_test/std/vec/struct.Vec.html) cc #34713
Triage: this now says |
The Path documentation provides a good case-in-point. The struct for
Path
is being rendered aswhen it could be rendered as
since there are no fields which have not been emitted. It just feels like an understatement when it says "some" fields have been omitted, and there are no fields being shown at all.
The text was updated successfully, but these errors were encountered: