Skip to content

Commit 166d8b8

Browse files
committed
add "Memory layout" subsection to documentation of UnsafeCell for additional clarity
1 parent 5673536 commit 166d8b8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/src/cell.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,8 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
18161816
///
18171817
/// [`.get_mut()`]: `UnsafeCell::get_mut`
18181818
///
1819+
/// # Memory layout
1820+
///
18191821
/// `UnsafeCell<T>` has the same in-memory representation as its inner type `T`. A consequence
18201822
/// of this guarantee is that it is possible to convert between `T` and `UnsafeCell<T>`.
18211823
/// Special care has to be taken when converting a nested `T` inside of an `Outer<T>` type

0 commit comments

Comments
 (0)