-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-opsemRelevant to the opsem teamRelevant to the opsem team
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>>.
Metadata
Metadata
Assignees
Labels
A-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-opsemRelevant to the opsem teamRelevant to the opsem team