[PATCH 0/3] rust: pin-init: reduce visibility of projection methods to declutter rustdoc

From: Gary Guo

Date: Wed Nov 18 2026 - 09:31:39 EST


Currently all types that use `#[pin_data]` will have projection method
generated and visible in rustdoc. But for many types, all fields are
private and thus these projection methods are not useful as public APIs.

Thus, compute a least upper bound (LUB) of field visibility and use that as
visibility for projection methods instead. This means that if none of the
fields are accessible publicly, the projection methods won't be as well and
thus will be hidden from rustdoc.

We could also just mark these methods as `#[doc(hidden)]` -- but LSPs will
hide these methods too -- and bthese are indeed APIs that people would want
to use.

Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
---
Gary Guo (3):
rust: pin-init: internal: allow `clippy::large_unopt_stack_frames`
rust: pin-init: internal: use visibility of the most visible field for projection
rust: pin-init: internal: hide `HasPinData` impl

rust/pin-init/internal/src/init.rs | 2 +-
rust/pin-init/internal/src/pin_data.rs | 36 ++++++++++++++++----------
rust/pin-init/internal/src/util.rs | 47 +++++++++++++++++++++++++++++++++-
3 files changed, 69 insertions(+), 16 deletions(-)
---
base-commit: b7218f1996f8491dbe28632b70f444cb73f554df
change-id: 20261118-dev-project-vis-ff83ea9e6926

Best regards,
--
Gary Guo <gary@xxxxxxxxxxx>