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

Non null convenience ops #117697

Merged
merged 6 commits into from Nov 26, 2023
Merged

Conversation

WaffleLapkin
Copy link
Member

Based on rust-lang/libs-team#251.

I went through all of the methods on *mut and added every method, which does not require additional safety conditions, to NonNull. (exceptions: guaranteed_eq, guaranteed_ne, with_metadata_of, it's unclear if they are useful here...)

I'm also not sure what types should the "second pointer parameter" be. *mut/*const might be more permissible, but given that NonNull doesn't coerce to them, it might also be annoying. For now I chose the "use NonNull everywhere" path, but I'm not sure it's the correct one...

I'm eepy, so I probably messed up somewhere while copying...

cc @scottmcm
r? libs-api

@WaffleLapkin WaffleLapkin added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. A-raw-pointers Area: raw pointers, MaybeUninit, NonNull labels Nov 8, 2023
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 8, 2023
@bors
Copy link
Contributor

bors commented Nov 18, 2023

☔ The latest upstream changes (presumably #117525) made this pull request unmergeable. Please resolve the merge conflicts.

@Amanieu
Copy link
Member

Amanieu commented Nov 23, 2023

Sorry this somehow fell off my queue.

r=me once conflicts are resolved.

@WaffleLapkin
Copy link
Member Author

@bors r=Amanieu

@bors
Copy link
Contributor

bors commented Nov 26, 2023

📌 Commit e1b4e8a has been approved by Amanieu

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 Nov 26, 2023
Comment on lines +947 to +948
// #[unstable(feature = "ptr_sub_ptr", issue = "95892")]
// #[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented out code

/// [`ptr::write`]: crate::ptr::write()
#[unstable(feature = "non_null_convenience", issue = "117691")]
#[rustc_const_unstable(feature = "non_null_convenience", issue = "117691")]
//#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

#[doc(alias = "memset")]
#[unstable(feature = "non_null_convenience", issue = "117691")]
#[rustc_const_unstable(feature = "non_null_convenience", issue = "117691")]
//#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

/// [`ptr::write_unaligned`]: crate::ptr::write_unaligned()
#[unstable(feature = "non_null_convenience", issue = "117691")]
#[rustc_const_unstable(feature = "non_null_convenience", issue = "117691")]
//#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

/// [`ptr::swap`]: crate::ptr::swap()
#[unstable(feature = "non_null_convenience", issue = "117691")]
#[rustc_const_unstable(feature = "non_null_convenience", issue = "117691")]
//#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too

/// ```
#[unstable(feature = "non_null_convenience", issue = "117691")]
#[rustc_const_unstable(feature = "non_null_convenience", issue = "117691")]
//#[rustc_const_unstable(feature = "const_align_offset", issue = "90962")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

@WaffleLapkin
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 26, 2023
@WaffleLapkin
Copy link
Member Author

wait, no, it's actually fine.

@klensy all of those are "this is unstable under two features at the same time", kind of thing. If non_null_convenience gets stabilized before the commented-out ones, we need to not forget to consider moving those methods to the other unstable features.

@bors r=Amanieu

@bors
Copy link
Contributor

bors commented Nov 26, 2023

📌 Commit e1b4e8a has been approved by Amanieu

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 26, 2023
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 26, 2023
@bors
Copy link
Contributor

bors commented Nov 26, 2023

⌛ Testing commit e1b4e8a with merge 1bcbb7c...

@bors
Copy link
Contributor

bors commented Nov 26, 2023

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing 1bcbb7c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 26, 2023
@bors bors merged commit 1bcbb7c into rust-lang:master Nov 26, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Nov 26, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1bcbb7c): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.6% [2.3%, 4.8%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.6% [-5.0%, -4.1%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 50
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 4
All ❌✅ (primary) -0.1% [-0.1%, -0.0%] 50

Bootstrap: 676.117s -> 676.261s (0.02%)
Artifact size: 313.33 MiB -> 313.37 MiB (0.01%)

@WaffleLapkin WaffleLapkin deleted the non-null-convenience-ops branch November 27, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-raw-pointers Area: raw pointers, MaybeUninit, NonNull merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants