Guarantee the memory layout of `Cell`

This commit is contained in:
Mads Marquart 2023-01-15 22:39:43 +01:00
parent ae4d89dfb5
commit 660d985d12
1 changed files with 6 additions and 0 deletions

View File

@ -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