rust_spec/core_impls/
cells.rs1use core::{
2 cell::{Cell, UnsafeCell},
3 ops::Add,
4};
5
6use crate::{
7 NonOpaque, RustSpec, drop::NoDrop, layout::Robust, mutability::WithInterior,
8 niche::WithoutNiche,
9};
10
11macro_rules! interior_cell {
12 ($($ty:ident),+ $(,)?) => {$(
13 unsafe impl<T: RustSpec + ?Sized> RustSpec for $ty<T>
14 where
15 Robust: Add<T::Trap>,
16 NoDrop: Add<T::Drop>,
17 {
18 type Layout = T::Layout;
19 type Size = T::Size;
20 type Alignment = T::Alignment;
21 type Trap = <Robust as Add<T::Trap>>::Output;
22 type Niche = WithoutNiche;
23 type Drop = <NoDrop as Add<T::Drop>>::Output;
24 type Mutability = WithInterior;
25 type Opacity = NonOpaque;
26 type __IndirectTrap = T::__IndirectTrap;
27 }
28 )+};
29}
30
31interior_cell!(UnsafeCell, Cell);