-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add expose_provenance and from_exposed_provenance on NonNull #518
Comments
while impl<T: ?Sized> NonNull<T> {
pub fn expose_provenance(self) -> NonZero<usize>;
}
impl<T> NonNull<T> { // or better T: ?Sized + Thin
pub fn from_exposed_provenance(addr: NonZero<usize>) -> Self;
} |
This was discussed in the libs-api call today. The conclusion was, "ship it, inclusive of the minor fix mentioned by @kennytm." That is, this ACP is accepted, modulo that fix. |
Turns out there's another function missing on |
Tracking issue: rust-lang/rust#135243 |
…ratt add missing provenance APIs on NonNull This adds some provenance APIs that exist on raw pointers but have been forgotten on `NonNull`: ```rust 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: rust-lang#135243
…ratt add missing provenance APIs on NonNull This adds some provenance APIs that exist on raw pointers but have been forgotten on `NonNull`: ```rust 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: rust-lang#135243
Rollup merge of rust-lang#135242 - RalfJung:nonnull-provenance, r=jhpratt add missing provenance APIs on NonNull This adds some provenance APIs that exist on raw pointers but have been forgotten on `NonNull`: ```rust 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: rust-lang#135243
Proposal
Problem statement
expose_provenance and from_exposed_provenance exist on raw pointers but not on NonNull.
Motivating examples or use cases
This seems like a simple oversight; to my knowledge we generally aim for API consistency between NonNull and raw pointers.
Solution sketch
Alternatives
We could do nothing.
Links and related work
What happens now?
This issue contains an API change proposal (or ACP) and is part of the libs-api team feature lifecycle. Once this issue is filed, the libs-api team will review open proposals as capability becomes available. Current response times do not have a clear estimate, but may be up to several months.
Possible responses
The libs team may respond in various different ways. First, the team will consider the problem (this doesn't require any concrete solution or alternatives to have been proposed):
Second, if there's a concrete solution:
The text was updated successfully, but these errors were encountered: