-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rustdoc: document-private-items makes aliased types expansion see through private fields #123860
Comments
I suppose it's "ok" since you used the |
I'll summarize the exchange I had with Guillaume on matrix. First, the Regarding design, it seems weird to me that aliased type expansion shows private implementation details of dependencies (e.g.
// Expanded type is `Vec`, it's external to this crate so you don't expand it
type One = Vec<String>;
// Private-only fields struct defined in the same crate
struct Foo<T> { f1: T, f2: u32 }
// You fully expand the fields cause they are relevent
type Two = Foo<String>;
// In a separate crate
pub struct Bar<T> { pub f1: T, f2: u32 }
pub struct Baz<T> { pub f1: T, pub f2: u32 } // You only expand fields defined as public
type Three = Bar<String>; // only `f1`
type Four = Baz<String>; // both `f1` and `f2` |
…type, r=GuillaumeGomez Always hide private fields in aliased type This PR adds a new rustdoc pass that unconditionally always strips all private fields in aliased type, since showing them, even with `--document-private-items`, is confusing, unhelpful, and run backwards to the "Aliased type" feature, which is to show the type as it would be seen by the user. r? `@GuillaumeGomez` Fixes rust-lang#124938 Fixes rust-lang#123860
…type, r=GuillaumeGomez Always hide private fields in aliased type This PR adds a new rustdoc pass that unconditionally always strips all private fields in aliased type, since showing them, even with `--document-private-items`, is confusing, unhelpful, and run backwards to the "Aliased type" feature, which is to show the type as it would be seen by the user. r? ``@GuillaumeGomez`` Fixes rust-lang#124938 Fixes rust-lang#123860
Rollup merge of rust-lang#124939 - Urgau:hide-private-fields-aliased-type, r=GuillaumeGomez Always hide private fields in aliased type This PR adds a new rustdoc pass that unconditionally always strips all private fields in aliased type, since showing them, even with `--document-private-items`, is confusing, unhelpful, and run backwards to the "Aliased type" feature, which is to show the type as it would be seen by the user. r? ```@GuillaumeGomez``` Fixes rust-lang#124938 Fixes rust-lang#123860
Using
cargo doc --document-private-items
to document private types of the current workspace exposes external types private implementation details (in this case private fields). I would expect the expansion to limit itself to public fields.e.g.
gives
Quick repo
Meta
rustc --version --verbose
r? @GuillaumeGomez
The text was updated successfully, but these errors were encountered: