about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-22 09:35:51 +0000
committerbors <bors@rust-lang.org>2023-05-22 09:35:51 +0000
commit48ec50ae39d0ca0baa0e78f56c395dcc6d7ebd65 (patch)
treeb620e74c4b4a754ca5bb67b51e804228d38e0dd9
parent2d66e5a729d85490dc3c342e4c23c22786e324ee (diff)
parentf16acbeef63cee81026013f6f8ffd538a6e04e66 (diff)
downloadrust-48ec50ae39d0ca0baa0e78f56c395dcc6d7ebd65.tar.gz
rust-48ec50ae39d0ca0baa0e78f56c395dcc6d7ebd65.zip
Auto merge of #111711 - Jules-Bertholet:document-pin-layout, r=thomcc
Document `Pin` memory layout

The fact that `Pin` is `#[repr(transparent)]` technically isn't documented anywhere currently. I don't see any reason why `Pin`'s layout would ever change, so this PR codifies it.

`@rustbot` label +T-libs-api -T-libs +A-docs +A-layout +A-pin
-rw-r--r--library/core/src/pin.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs
index c4b89a63019..6b319b4355c 100644
--- a/library/core/src/pin.rs
+++ b/library/core/src/pin.rs
@@ -393,6 +393,8 @@ use crate::ops::{CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Receiver};
 /// value in place, preventing the value referenced by that pointer from being moved
 /// unless it implements [`Unpin`].
 ///
+/// `Pin<P>` is guaranteed to have the same memory layout and ABI as `P`.
+///
 /// *See the [`pin` module] documentation for an explanation of pinning.*
 ///
 /// [`pin` module]: self