Skip to content

internal: use visibility of the most visible field for projection - #188

Merged
nbdd0121 merged 2 commits into
mainfrom
dev/project-vis
Nov 22, 2026
Merged

nbdd0121 merged 2 commits into
mainfrom
dev/project-vis

Conversation

@nbdd0121

Copy link
Copy Markdown
Member

Currently, we use the struct visibility for projection methods. This means
that if a public struct uses #[pin_data], the projection methods will be
defined on them with public visibility despite the projection struct having
no publicly accessible field. This both exposes the implementation detail
of such structs, and add noise to the generated documentation.

Use the combined field visibility for this instead, where that of the most
visible field is used instead.

Currently, we use the struct visibility for projection methods. This means
that if a public struct uses `#[pin_data]`, the projection methods will be
defined on them with public visibility despite the projection struct having
no publicly accessible field. This both exposes the implementation detail
of such structs, and add noise to the generated documentation.

Use the combined field visibility for this instead, where that of the most
visible field is used instead.

Signed-off-by: Gary Guo <[email protected]>
`HasPinData` is an implementation detail of pin-init to communicate from
`#[pin_data]` macro to `pin_init!()` macro on how to initialize the struct.
Thus, `HasPinData` is marked as `#[doc(hidden)]`; however, Rustdoc still
renders the impl. Thus, also mark impl as `#[doc(hidden)]`

Signed-off-by: Gary Guo <[email protected]>
@nbdd0121 nbdd0121 changed the title internal: use most visibility of the most visible field for projection internal: use visibility of the most visible field for projection Nov 18, 2026
@nbdd0121
nbdd0121 merged commit 4d2ce91 into main Nov 22, 2026
59 checks passed
@nbdd0121
nbdd0121 deleted the dev/project-vis branch November 22, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant