-
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
Always hide private fields in aliased type #124939
Conversation
Based on discussion in #123860 the preferred implementation would seem to be to only hide these if the fields are from an "upstream" dependency and still reveal them if they're in the workspace. |
That would indeed be better, but neither |
Ah, then it makes sense to defer the preferred implementation until later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks! Please add a FIXME with a link to the cargo issue and open an issue here to keep track of it so it's not forgotten.
9b25ab4
to
e89a2cc
Compare
Created issue #125009 to track the FIXME and added the it in the code. |
Thanks! @bors r+ rollup |
…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
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#124807 (Migrate `run-make/rustdoc-io-error` to `rmake.rs`) - rust-lang#124829 (Enable profiler for armv7-unknown-linux-gnueabihf.) - rust-lang#124939 (Always hide private fields in aliased type) - rust-lang#124963 (Migrate `run-make/rustdoc-shared-flags` to rmake) - rust-lang#124981 (Relax allocator requirements on some Rc/Arc APIs.) - rust-lang#125008 (Add test for rust-lang#122775) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#124096 (Clean up users of rust_dbg_call) - rust-lang#124829 (Enable profiler for armv7-unknown-linux-gnueabihf.) - rust-lang#124939 (Always hide private fields in aliased type) - rust-lang#124963 (Migrate `run-make/rustdoc-shared-flags` to rmake) - rust-lang#124981 (Relax allocator requirements on some Rc/Arc APIs.) - rust-lang#125008 (Add test for rust-lang#122775) r? `@ghost` `@rustbot` modify labels: rollup
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
// the field and not the one given by the user for the currrent crate. | ||
// | ||
// FIXME(#125009): Not-local should probably consider same Cargo workspace | ||
if !i.def_id().map_or(true, |did| did.is_local()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much appreciated, thanks!
…ed-viz, r=fmease rustdoc: Don't strip items with inherited visibility in `AliasedNonLocalStripper` Enum variants return `None` in `Item::visibility`, which fails the comparison to `Some(Visibility::Public)`. This means that all enums in type aliases are being stripped, leading to this in the `rustc_middle` docs: <img width="474" alt="image" src="https://github.com/rust-lang/rust/assets/3674314/83704d94-a571-4c28-acbd-ca51c4efd46e"> This regressed in rust-lang#124939 (comment). This switches the `AliasedNonLocalStripper` to not strip items with `None` as their visibility.
…ed-viz, r=fmease rustdoc: Don't strip items with inherited visibility in `AliasedNonLocalStripper` Enum variants return `None` in `Item::visibility`, which fails the comparison to `Some(Visibility::Public)`. This means that all enums in type aliases are being stripped, leading to this in the `rustc_middle` docs: <img width="474" alt="image" src="https://github.com/rust-lang/rust/assets/3674314/83704d94-a571-4c28-acbd-ca51c4efd46e"> This regressed in rust-lang#124939 (comment). This switches the `AliasedNonLocalStripper` to not strip items with `None` as their visibility.
…ed-viz, r=fmease rustdoc: Don't strip items with inherited visibility in `AliasedNonLocalStripper` Enum variants return `None` in `Item::visibility`, which fails the comparison to `Some(Visibility::Public)`. This means that all enums in type aliases are being stripped, leading to this in the `rustc_middle` docs: <img width="474" alt="image" src="https://github.com/rust-lang/rust/assets/3674314/83704d94-a571-4c28-acbd-ca51c4efd46e"> This regressed in rust-lang#124939 (comment). This switches the `AliasedNonLocalStripper` to not strip items with `None` as their visibility.
Rollup merge of rust-lang#125300 - compiler-errors:dont-strip-inherited-viz, r=fmease rustdoc: Don't strip items with inherited visibility in `AliasedNonLocalStripper` Enum variants return `None` in `Item::visibility`, which fails the comparison to `Some(Visibility::Public)`. This means that all enums in type aliases are being stripped, leading to this in the `rustc_middle` docs: <img width="474" alt="image" src="https://github.com/rust-lang/rust/assets/3674314/83704d94-a571-4c28-acbd-ca51c4efd46e"> This regressed in rust-lang#124939 (comment). This switches the `AliasedNonLocalStripper` to not strip items with `None` as their visibility.
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 #124938
Fixes #123860