about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2023-01-15 22:39:43 +0100
committerMads Marquart <mads@marquart.dk>2023-01-24 20:59:39 +0100
commit660d985d12bd66dde21490fefb31c9b7fb22a67e (patch)
tree49e4fe177da39922c685f16c06cf24568754d688
parentae4d89dfb51535c1c43052ef848564bd2323c9ca (diff)
downloadrust-660d985d12bd66dde21490fefb31c9b7fb22a67e.tar.gz
rust-660d985d12bd66dde21490fefb31c9b7fb22a67e.zip
Guarantee the memory layout of `Cell`
-rw-r--r--library/core/src/cell.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs
index 129213fde74..c65c30e566a 100644
--- a/library/core/src/cell.rs
+++ b/library/core/src/cell.rs
@@ -209,6 +209,12 @@ pub use once::OnceCell;
 
 /// A mutable memory location.
 ///
+/// # Memory layout
+///
+/// `Cell<T>` has the same [memory layout and caveats as
+/// `UnsafeCell<T>`](UnsafeCell#memory-layout). In particular, this means that
+/// `Cell<T>` has the same in-memory representation as its inner type `T`.
+///
 /// # Examples
 ///
 /// In this example, you can see that `Cell<T>` enables mutation inside an