From ebea57d095eb861e7891e385b3278d8ef0fd19e2 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 15 Jan 2023 22:39:43 +0100 Subject: [PATCH] Guarantee the memory layout of `Cell` --- core/src/cell.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/cell.rs b/core/src/cell.rs index 129213fde..c65c30e56 100644 --- a/core/src/cell.rs +++ b/core/src/cell.rs @@ -209,6 +209,12 @@ pub use once::OnceCell; /// A mutable memory location. /// +/// # Memory layout +/// +/// `Cell` has the same [memory layout and caveats as +/// `UnsafeCell`](UnsafeCell#memory-layout). In particular, this means that +/// `Cell` has the same in-memory representation as its inner type `T`. +/// /// # Examples /// /// In this example, you can see that `Cell` enables mutation inside an