Skip to content

add missing provenance APIs on NonNull#135242

Merged
bors merged 1 commit into
rust-lang:masterfrom
RalfJung:nonnull-provenance
Jan 9, 2025
Merged

add missing provenance APIs on NonNull#135242
bors merged 1 commit into
rust-lang:masterfrom
RalfJung:nonnull-provenance

Conversation

@RalfJung
Copy link
Copy Markdown
Member

@RalfJung RalfJung commented Jan 8, 2025

This adds some provenance APIs that exist on raw pointers but have been forgotten on NonNull:

impl<T> NonNull<T> {
    pub const fn without_provenance(addr: NonZero<usize>) -> Self;
    pub fn from_exposed_provenance(addr: NonZero<usize>) -> Self;
}
impl<T: ?Sized> NonNull<T> {
    pub fn expose_provenance(self) -> NonZero<usize>;
}

rust-lang/libs-team#518 is the ACP for the two exposed provenance ones; I forgot to include without_provenance there but I hope that, too, is uncontroversial (and anyway this PR only adds things unstably). Cc @rust-lang/libs-api

Tracking issue: #135243

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants