Lines Matching defs:UnsafeCell
13 cell::{Cell, UnsafeCell},
23 // - `Immutable`: `()` self-evidently does not contain any `UnsafeCell`s.
37 // - `Immutable`: These types self-evidently do not contain any `UnsafeCell`s.
90 // - `Immutable`: `bool` self-evidently does not contain any `UnsafeCell`s.
120 // - `Immutable`: `char` self-evidently does not contain any `UnsafeCell`s.
150 // - `Immutable`: `[u8]` does not contain any `UnsafeCell`s.
212 // doesn't contain any `UnsafeCell`s? It's obviously true, but it's not clear
298 // not contain any `UnsafeCell`s for `T: Sized` [1]. This is not a complete
378 // `UnsafeCell`s. This is not a proof, but we are accepting this as a known risk
415 /// `UnsafeCell<$prim>`.
439 // the same bit validity. `UnsafeCell<T>` has the same bit
442 // [1] Per https://doc.rust-lang.org/1.85.0/std/cell/struct.UnsafeCell.html#memory-layout:
444 // `UnsafeCell<T>` has the same in-memory representation as
446 // it is possible to convert between `T` and `UnsafeCell<T>`.
447 unsafe impl<$($tyvar)?> TransmuteFrom<$atomic, Safe, Safe> for core::cell::UnsafeCell<$prim> {}
449 unsafe impl<$($tyvar)?> TransmuteFrom<core::cell::UnsafeCell<$prim>, Safe, Safe> for $atomic {}
673 // Thus, `Wrapping<T>` must have `UnsafeCell`s covering the same byte ranges as
694 // SAFETY: `MaybeUninit<T>` has `UnsafeCell`s covering the same byte ranges as
701 // If the argument `&MaybeUninit<T>` and the returned `&T` had `UnsafeCell`s at
719 // implies, but does not guarantee, that it contains `UnsafeCell`s covering the
723 // exactly contains a `T` with the same fields and `UnsafeCell`s covering the
726 // `UnsafeCell` coverage, which would in turn permit interior mutation that
839 impl_for_transmute_from!(T: ?Sized + FromZeros => FromZeros for UnsafeCell<T>[T]);
840 impl_for_transmute_from!(T: ?Sized + FromBytes => FromBytes for UnsafeCell<T>[T]);
841 impl_for_transmute_from!(T: ?Sized + IntoBytes => IntoBytes for UnsafeCell<T>[T]);
842 // SAFETY: `UnsafeCell<T>` has the same in-memory representation as `T` [1], and
845 // [1] Per https://doc.rust-lang.org/1.81.0/core/cell/struct.UnsafeCell.html#memory-layout:
847 // `UnsafeCell<T>` has the same in-memory representation as its inner type
849 const _: () = unsafe { unsafe_impl!(T: ?Sized + Unaligned => Unaligned for UnsafeCell<T>) };
850 assert_unaligned!(UnsafeCell<()>, UnsafeCell<u8>);
853 unsafe impl<T: TryFromBytes + ?Sized> TryFromBytes for UnsafeCell<T> {
943 // - `Immutable`: Raw pointers do not contain any `UnsafeCell`s.
974 // SAFETY: `NonNull<T>` self-evidently does not contain `UnsafeCell`s. This is
978 // SAFETY: Reference types do not contain any `UnsafeCell`s.
987 // does not contain any `UnsafeCell`s outside of `T`. [1]
1498 Box<UnsafeCell<NotZerocopy>>,
1499 &'static UnsafeCell<NotZerocopy>,
1500 &'static mut UnsafeCell<NotZerocopy>,
1501 NonNull<UnsafeCell<NotZerocopy>>,
1551 ManuallyDrop<[UnsafeCell<u8>]>
1552 => @success bx!(ManuallyDrop::new([UnsafeCell::new(0)])), bx!(ManuallyDrop::new([UnsafeCell::new(0), UnsafeCell::new(1)]));
1553 ManuallyDrop<[UnsafeCell<bool>]>
1554 => @success bx!(ManuallyDrop::new([UnsafeCell::new(false)])), bx!(ManuallyDrop::new([UnsafeCell::new(false), UnsafeCell::new(true)])),
1700 ManuallyDrop<UnsafeCell<()>>,
1701 ManuallyDrop<[UnsafeCell<u8>]>,
1702 ManuallyDrop<[UnsafeCell<bool>]>,
1704 CoreMaybeUninit<UnsafeCell<()>>,
1705 Wrapping<UnsafeCell<()>>
1715 ManuallyDrop<[UnsafeCell<bool>]>
1725 Option<Box<UnsafeCell<NotZerocopy>>>,
1726 Option<&'static UnsafeCell<NotZerocopy>>,
1727 Option<&'static mut UnsafeCell<NotZerocopy>>,
1728 Option<NonNull<UnsafeCell<NotZerocopy>>>,
1746 ManuallyDrop<[UnsafeCell<bool>]>,
1757 Option<&'static UnsafeCell<NotZerocopy>>,
1758 Option<&'static mut UnsafeCell<NotZerocopy>>,
1759 Option<NonNull<UnsafeCell<NotZerocopy>>>,
1760 Option<Box<UnsafeCell<NotZerocopy>>>,
1767 CoreMaybeUninit<UnsafeCell<()>>,
1768 ManuallyDrop<UnsafeCell<()>>,
1769 ManuallyDrop<[UnsafeCell<u8>]>,
1770 ManuallyDrop<[UnsafeCell<bool>]>,
1771 Wrapping<UnsafeCell<()>>,
2222 assert_impls!(Option<Box<UnsafeCell<NotZerocopy>>>: KnownLayout, Immutable, TryFromBytes, FromZeros, !FromBytes, !IntoBytes, !Unaligned);
2223 assert_impls!(Option<Box<[UnsafeCell<NotZerocopy>]>>: KnownLayout, !Immutable, !TryFromBytes, !FromZeros, !FromBytes, !IntoBytes, !Unaligned);
2224 assert_impls!(Option<&'static UnsafeCell<NotZerocopy>>: KnownLayout, Immutable, TryFromBytes, FromZeros, !FromBytes, !IntoBytes, !Unaligned);
2225 assert_impls!(Option<&'static [UnsafeCell<NotZerocopy>]>: KnownLayout, Immutable, !TryFromBytes, !FromZeros, !FromBytes, !IntoBytes, !Unaligned);
2226 assert_impls!(Option<&'static mut UnsafeCell<NotZerocopy>>: KnownLayout, Immutable, TryFromBytes, FromZeros, !FromBytes, !IntoBytes, !Unaligned);
2227 assert_impls!(Option<&'static mut [UnsafeCell<NotZerocopy>]>: KnownLayout, Immutable, !TryFromBytes, !FromZeros, !FromBytes, !IntoBytes, !Unaligned);
2228 assert_impls!(Option<NonNull<UnsafeCell<NotZerocopy>>>: KnownLayout, TryFromBytes, FromZeros, Immutable, !FromBytes, !IntoBytes, !Unaligned);
2229 assert_impls!(Option<NonNull<[UnsafeCell<NotZerocopy>]>>: KnownLayout, Immutable, !TryFromBytes, !FromZeros, !FromBytes, !IntoBytes, !Unaligned);
2236 assert_impls!(PhantomData<UnsafeCell<()>>: KnownLayout, Immutable, TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned);
2249 assert_impls!(ManuallyDrop<UnsafeCell<()>>: KnownLayout, TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned, !Immutable);
2250 assert_impls!(ManuallyDrop<[UnsafeCell<u8>]>: KnownLayout, TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned, !Immutable);
2251 assert_impls!(ManuallyDrop<[UnsafeCell<bool>]>: KnownLayout, TryFromBytes, FromZeros, IntoBytes, Unaligned, !Immutable, !FromBytes);
2255 assert_impls!(CoreMaybeUninit<UnsafeCell<()>>: KnownLayout, TryFromBytes, FromZeros, FromBytes, Unaligned, !Immutable, !IntoBytes);
2262 assert_impls!(Wrapping<UnsafeCell<()>>: KnownLayout, TryFromBytes, FromZeros, FromBytes, IntoBytes, Unaligned, !Immutable);