rustdoc: Don't distinguish structs and tuple structs with only private fields
For example, AddrParseError shows up as pub struct AddrParseError(_); and Ipv4Addr shows up as pub struct Ipv4Addr { /* fields omitted */ }
I feel like all structs should show up as the latter form if all of the fields are private. It technically doesn't matter that the struct is a tuple struct if the fields are all private. It's not a huge deal but it's an inconsistency that looks off to me.
Yes, it is time, because the relevant part of #35626 is stable in nightly.
bluss at 2016-12-01 15:49:53
Triage: this bug still reproduces
Steve Klabnik at 2020-01-09 14:32:11
This bug still reproduces, in case you were wondering.
Clar Fon at 2022-02-07 19:33:59
/cc @camelid who might be interested because it's similar in nature to #92699.
Jacob Hoffman-Andrews at 2022-02-08 10:35:49
Yeah, it's always bothered me that tuple structs with all private fields show how many fields they have, even though they're supposed to be fully private.
Noah Lev at 2022-02-09 19:50:56
Bonus points if you make it so that it has the struct-field syntax if there are a mix of private/public fields, e.g.
Struct { 1: T, /* some fields hidden */ }Clar Fon at 2022-02-09 22:52:51
In that case, I think I might make it look like
Struct(..., T, ...)orStruct(/* private fields */, T, /* private fields */). Preferences?Noah Lev at 2022-02-10 20:23:31
The main benefit of the struct-based syntax is that it's actually valid Rust syntax, but if you don't care about that, the latter also works. I don't believe that there's any tuple-based syntax that works like that.
Clar Fon at 2022-02-11 02:03:41
The main benefit of the struct-based syntax is that it's actually valid Rust syntax, but if you don't care about that, the latter also works. I don't believe that there's any tuple-based syntax that works like that.
Struct { 1: T }doesn't seem to be valid syntax, unless you were referring to something else?Noah Lev at 2022-02-11 02:20:28
So, I should have clarified:
Struct { 1: T }isn't a valid struct definition, butStruct { 1: x }is a valid pattern. So, I guess what I meant to say was that it's closer to valid Rust syntax, although it's still invalid.Clar Fon at 2022-02-11 02:30:12