1- use core:: cell:: UnsafeCell ;
1+ use core:: cell:: { Cell , UnsafeCell } ;
22use core:: ffi:: c_void;
33use core:: mem:: { self , ManuallyDrop , MaybeUninit } ;
44use core:: num:: {
@@ -459,6 +459,9 @@ encode_impls_transparent! {
459459 // (e.g. an `Option<UnsafeCell<&u8>>` impl is not available).
460460 UnsafeCell <T : ?Sized >,
461461
462+ // SAFETY: Guaranteed to have the same layout as `UnsafeCell<T>`.
463+ Cell <T : ?Sized >,
464+
462465 // The inner field is not public, so may not be safe.
463466 // TODO: Pin<T>,
464467
@@ -468,9 +471,6 @@ encode_impls_transparent! {
468471 // SAFETY: Guaranteed to have the same layout and ABI as `T`.
469472 Wrapping <T >,
470473
471- // It might have requirements that would disourage this impl?
472- // TODO: Cell<T>
473-
474474 // TODO: Types that need to be made repr(transparent) first:
475475 // - core::cell::Ref?
476476 // - core::cell::RefCell?
@@ -798,6 +798,9 @@ mod tests {
798798 assert_eq ! ( <& ManuallyDrop <Option <& u8 >>>:: ENCODING , <&&u8 >:: ENCODING ) ;
799799
800800 assert_eq ! ( <UnsafeCell <u8 >>:: ENCODING , u8 :: ENCODING ) ;
801+ assert_eq ! ( <UnsafeCell <& u8 >>:: ENCODING , <& u8 >:: ENCODING ) ;
802+ assert_eq ! ( <Cell <u8 >>:: ENCODING , u8 :: ENCODING ) ;
803+ assert_eq ! ( <Cell <& u8 >>:: ENCODING , <& u8 >:: ENCODING ) ;
801804 // assert_eq!(<Pin<u8>>::ENCODING, u8::ENCODING);
802805 assert_eq ! ( <MaybeUninit <u8 >>:: ENCODING , u8 :: ENCODING ) ;
803806 assert_eq ! ( <Wrapping <u8 >>:: ENCODING , u8 :: ENCODING ) ;
0 commit comments