As per title, since the addition of T: NoUninit pointers are no longer allowed inside an Atomic<...>.
This is per definition of NoUninit, which I quote:
It is disallowed for types to contain pointer types, Cell, UnsafeCell, atomics, and any other forms of interior mutability.
It is unclear to me why pointer types are disallowed inside a NoUninit as they do not provide interior mutability directly. Anyway this is clearly limiting, as pointer inside atomics are allowed (proved by the existence of AtomicPtr).
My specific use case is something akin to this:
struct BarPtr(NonNull<Bar>);
// ...
struct Foo {
// ...
bar: Atomic<Option<BarPtr>>,
// ...
}
I think that a way to fix this is to have this crate contain its own trait asserting that a type "is safe inside an Atomic<...>", implement it for all T: NoUninit but still allowing for unsafe manual implementation. This could also be used to make the dependency bytemuck optional.
As per title, since the addition of
T: NoUninitpointers are no longer allowed inside anAtomic<...>.This is per definition of
NoUninit, which I quote:It is unclear to me why pointer types are disallowed inside a
NoUninitas they do not provide interior mutability directly. Anyway this is clearly limiting, as pointer inside atomics are allowed (proved by the existence ofAtomicPtr).My specific use case is something akin to this:
I think that a way to fix this is to have this crate contain its own trait asserting that a type "is safe inside an Atomic<...>", implement it for all
T: NoUninitbut still allowing for unsafe manual implementation. This could also be used to make the dependencybytemuckoptional.