std::num::NonZero<T> guarantees that it is ABI compatible with T for all non-zero values. As far as I can tell:
-
There is no such guarantee for std::ptr::NonNull.
-
…but it actually does hold in practice, given the repr(transparent) implementation.
Is the fact that this isn't guaranteed just an oversight, or is it on purpose?
std::num::NonZero<T>guarantees that it is ABI compatible withTfor all non-zero values. As far as I can tell:There is no such guarantee for
std::ptr::NonNull.…but it actually does hold in practice, given the
repr(transparent)implementation.Is the fact that this isn't guaranteed just an oversight, or is it on purpose?