Skip to content
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 missing provenance APIs on NonNull #135242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RalfJung
Copy link
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

@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 2025

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 8, 2025
@RalfJung RalfJung force-pushed the nonnull-provenance branch from 5f31569 to 052d578 Compare January 8, 2025 09:50
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the nonnull-provenance branch from 052d578 to b36bce3 Compare January 8, 2025 10:34
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the nonnull-provenance branch from b36bce3 to 2d23601 Compare January 8, 2025 11:49
@jhpratt
Copy link
Member

jhpratt commented Jan 8, 2025

I can't imagine the team would disagree with without_provenance being included due to the omission in the ACP; the intent seems clear.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 8, 2025

📌 Commit 2d23601 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 8, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 9, 2025
…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
jhpratt added a commit to jhpratt/rust that referenced this pull request Jan 9, 2025
…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
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