Add a comment to justify why the pointer field is pub.

Addresses https://github.com/rust-lang/rust/pull/93176/files#r795258110.
This commit is contained in:
Daniel Henry-Mantilla 2022-02-14 17:35:27 +01:00
parent c93968aee8
commit 002f627d38

View File

@ -406,6 +406,11 @@
#[repr(transparent)]
#[derive(Copy, Clone)]
pub struct Pin<P> {
// FIXME(#93176): this field is made `#[unstable] #[doc(hidden)] pub` to:
// - deter downstream users from accessing it (which would be unsound!),
// - let the `pin!` macro access it (such a macro requires using struct
// literal syntax in order to benefit from lifetime extension).
// Long-term, `unsafe` fields or macro hygiene are expected to offer more robust alternatives.
#[unstable(feature = "unsafe_pin_internals", issue = "none")]
#[doc(hidden)]
pub pointer: P,