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