-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
@jacobsa
Description
Can we rely on NonNull<T>
having the same representation as *mut T
for all non-null values of that type? In particular, can we rely on e.g. NonNull<std::ffi::c_void>
being ABI compatible with C void*
for non-null pointers?
It seems pretty likely that this should work, but the documentation doesn't guarantee it as far as I can see. The representation documentation for Nonnull
only says that an extra byte won't be used for the discriminant in Option<Nonnull<T>>
.