rustdoc: Render private fields in tuple struct as /* private fields */#110552
rustdoc: Render private fields in tuple struct as /* private fields */#110552compiler-errors wants to merge 1 commit intorust-lang:masterfrom
/* private fields */#110552Conversation
|
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
|
This looks like a good idea to me. For the test updates: for the tests that aren't intentionally testing the rendering of private fields (e.g. tests/rustdoc/const-generics/const-generic-defaults.rs), we should update the test expectations so they don't make a statement one way or the other about private fields. Since the test expectation is based on substring matching I think it should suffice to remove everything after the |
9da2bfd to
5f5e6f1
Compare
|
Looks good to me as well. Can you add one test which specifically check the following cases:
please? (I think they cover all possible cases I could think of) Once done, I'll start an FCP to get the approval from the rest of the team since it's a user facing change. |
|
☔ The latest upstream changes (presumably #112957) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Just a friendly bump on this. @GuillaumeGomez requested above some additional test cases. And there are a merge conflicts. I think this is a good improvement and it would be nice to get it merged. |
|
don't really have time to update this pr -- would be a good beginner issue tho. |
|
I'll take over as this is a bug fix. |
…e-struct, r=notriddle rustdoc: Render private fields in tuple struct as `/* private fields */` Reopening of rust-lang#110552. All that was missing was a test for the different cases so I added it into the second commit. Description from the original PR: > I've gotten some feedback that the current rustdoc rendering of... > > ``` > struct HasPrivateFields(_); > ``` > > ...is confusing, and I agree with that feedback, especially compared to the field struct case: > > ``` > struct HasPrivateFields { /* private fields */ } > ``` > > So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the `/* private fields */` comment. We can't *always* render it like that, for example when there's a mix of private and public fields. cc `@jsha` r? `@notriddle`
…e-struct, r=notriddle rustdoc: Render private fields in tuple struct as `/* private fields */` Reopening of rust-lang#110552. All that was missing was a test for the different cases so I added it into the second commit. Description from the original PR: > I've gotten some feedback that the current rustdoc rendering of... > > ``` > struct HasPrivateFields(_); > ``` > > ...is confusing, and I agree with that feedback, especially compared to the field struct case: > > ``` > struct HasPrivateFields { /* private fields */ } > ``` > > So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the `/* private fields */` comment. We can't *always* render it like that, for example when there's a mix of private and public fields. cc ``@jsha`` r? ``@notriddle``
…e-struct, r=notriddle rustdoc: Render private fields in tuple struct as `/* private fields */` Reopening of rust-lang#110552. All that was missing was a test for the different cases so I added it into the second commit. Description from the original PR: > I've gotten some feedback that the current rustdoc rendering of... > > ``` > struct HasPrivateFields(_); > ``` > > ...is confusing, and I agree with that feedback, especially compared to the field struct case: > > ``` > struct HasPrivateFields { /* private fields */ } > ``` > > So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the `/* private fields */` comment. We can't *always* render it like that, for example when there's a mix of private and public fields. cc ```@jsha``` r? ```@notriddle```
…e-struct, r=notriddle rustdoc: Render private fields in tuple struct as `/* private fields */` Reopening of rust-lang#110552. All that was missing was a test for the different cases so I added it into the second commit. Description from the original PR: > I've gotten some feedback that the current rustdoc rendering of... > > ``` > struct HasPrivateFields(_); > ``` > > ...is confusing, and I agree with that feedback, especially compared to the field struct case: > > ``` > struct HasPrivateFields { /* private fields */ } > ``` > > So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the `/* private fields */` comment. We can't *always* render it like that, for example when there's a mix of private and public fields. cc ````@jsha```` r? ````@notriddle````
Rollup merge of rust-lang#115604 - GuillaumeGomez:private-fields-tuple-struct, r=notriddle rustdoc: Render private fields in tuple struct as `/* private fields */` Reopening of rust-lang#110552. All that was missing was a test for the different cases so I added it into the second commit. Description from the original PR: > I've gotten some feedback that the current rustdoc rendering of... > > ``` > struct HasPrivateFields(_); > ``` > > ...is confusing, and I agree with that feedback, especially compared to the field struct case: > > ``` > struct HasPrivateFields { /* private fields */ } > ``` > > So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the `/* private fields */` comment. We can't *always* render it like that, for example when there's a mix of private and public fields. cc ````@jsha```` r? ````@notriddle````
I've gotten some feedback that the current rustdoc rendering of...
...is confusing, and I agree with that feedback, especially compared to the field struct case:
So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the
/* private fields */comment. We can't always render it like that, for example when there's a mix of private and public fields.Not sure if this is a worthwhile change, so opening it up for discussion :)