-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 as_(mut_)ptr and as_(mut_)slice to raw array pointers #119411
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Thank you for the PR! This PR contains a public library API change, which should follow the proper process: https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html |
@Nilstrieb thanks for the link! |
9269640
to
05e547e
Compare
I recommend opening an ACP anyways. |
05e547e
to
5456dd6
Compare
☔ The latest upstream changes (presumably #120157) made this pull request unmergeable. Please resolve the merge conflicts. |
5456dd6
to
fd3942d
Compare
@joshtriplett just a friendly ping, in case you missed this one (which makes sense, I opened it on December 29th haha). Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late response. I found some issues which need to be addressed before we can merge this (you don't have to address the "unimportant nit" ones if you don't want to).
Use @rustbot ready
when you've addressed the feedback.
/// let arr: *const [i8; 3] = ptr::null(); | ||
/// assert_eq!(arr.as_ptr(), ptr::null()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unimportant nit: The example could be a bit more useful, showing a pointer to an actual array and then maybe passing as_ptr
to copy_nonoverlapping
to copy out of the array or something like that.
/// let arr: *mut [i8; 3] = ptr::null_mut(); | ||
/// assert_eq!(arr.as_mut_ptr(), ptr::null_mut()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unimportant nit: same here
dd8b7ee
to
8836254
Compare
@Nilstrieb thank you so much for your patient review, and terribly sorry for the silly copy-paste errors that I should have caught earlier. This is my first (somewhat) substantial contribution to rust, so I really appreciate it! I elected to not change the examples for now. Also, made the mut methods const, because why not? If github doesn't GC it, you can see just my CR fixes here: dd8b7ee @rustbot ready |
☔ The latest upstream changes (presumably #120676) made this pull request unmergeable. Please resolve the merge conflicts. |
80b5af7
to
8775a7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good now! I've left a response to your question, but if you can't be bothered to fix it that's okay, just say you're fine with it as-is (because I'm too, I just don't find it quite optimal) and then I'll approve it as-is. If you do want to fix it, fix it and I'll approve it.
8775a7b
to
d0c0887
Compare
Thanks for the review! 🙏 Pushed a fix. |
@bors r+ |
Add as_(mut_)ptr and as_(mut_)slice to raw array pointers Hey, first time contributing to the standard libraries so not completely sure about the process. These functions are complementary to the ones being added in rust-lang#74265 . I found them missing on array pointers. See also: - ACP: rust-lang/libs-team#321 - Tracking issue: rust-lang#119834
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#119411 (Add as_(mut_)ptr and as_(mut_)slice to raw array pointers) - rust-lang#122248 (Respect stage0 sysroot when compiling rmake.rs with COMPILETEST_FORCE_STAGE0) - rust-lang#122295 (mir-opt: always run tests for the current target) - rust-lang#122574 (Register LLVM handlers for bad-alloc / OOM) - rust-lang#122608 (Move check-cfg diagnostic logic into a separate file) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119411 - yotamofek:array-ptr-get, r=Nilstrieb Add as_(mut_)ptr and as_(mut_)slice to raw array pointers Hey, first time contributing to the standard libraries so not completely sure about the process. These functions are complementary to the ones being added in rust-lang#74265 . I found them missing on array pointers. See also: - ACP: rust-lang/libs-team#321 - Tracking issue: rust-lang#119834
Hey, first time contributing to the standard libraries so not completely sure about the process.
These functions are complementary to the ones being added in #74265 . I found them missing on array pointers.
See also: