Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

std::pointer::Nonnull should guarantee ABI compatibility for non-null pointer values #145989

Open
Labels
A-raw-pointersArea: raw pointers, MaybeUninit, NonNull C-discussionCategory: 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. T-opsemRelevant to the opsem team
@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>>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-raw-pointersArea: raw pointers, MaybeUninit, NonNull C-discussionCategory: 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. T-opsemRelevant to the opsem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /