Skip to content

Commit 660d985

Browse files
committed
Guarantee the memory layout of Cell
1 parent ae4d89d commit 660d985

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/core/src/cell.rs

+6
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ pub use once::OnceCell;
209209

210210
/// A mutable memory location.
211211
///
212+
/// # Memory layout
213+
///
214+
/// `Cell<T>` has the same [memory layout and caveats as
215+
/// `UnsafeCell<T>`](UnsafeCell#memory-layout). In particular, this means that
216+
/// `Cell<T>` has the same in-memory representation as its inner type `T`.
217+
///
212218
/// # Examples
213219
///
214220
/// In this example, you can see that `Cell<T>` enables mutation inside an

0 commit comments

Comments
 (0)