Skip to content

Commit 002f627

Browse files
Add a comment to justify why the pointer field is pub.
Addresses https://github.com/rust-lang/rust/pull/93176/files#r795258110.
1 parent c93968a commit 002f627

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/core/src/pin.rs

+5
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,11 @@ use crate::ops::{CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Receiver};
406406
#[repr(transparent)]
407407
#[derive(Copy, Clone)]
408408
pub struct Pin<P> {
409+
// FIXME(#93176): this field is made `#[unstable] #[doc(hidden)] pub` to:
410+
// - deter downstream users from accessing it (which would be unsound!),
411+
// - let the `pin!` macro access it (such a macro requires using struct
412+
// literal syntax in order to benefit from lifetime extension).
413+
// Long-term, `unsafe` fields or macro hygiene are expected to offer more robust alternatives.
409414
#[unstable(feature = "unsafe_pin_internals", issue = "none")]
410415
#[doc(hidden)]
411416
pub pointer: P,

0 commit comments

Comments
 (0)