-
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 len
and slice_from_raw_parts
to NonNull<[T]>
#71940
Conversation
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
I’m speculatively opening a tracking issue #71941 for |
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.
r=me with minor nits.
also
tidy error: /checkout/src/libcore/ptr/non_null.rs:175: undocumented unsafe
This comment has been minimized.
This comment has been minimized.
52526cd
to
fe7217b
Compare
|
This comment has been minimized.
This comment has been minimized.
src/libcore/ptr/non_null.rs
Outdated
/// This function is safe, but dereferencing the return value is unsafe. | ||
/// See the documentation of [`slice::from_raw_parts`] for slice safety requirements. | ||
/// | ||
/// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html |
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.
/// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html | |
/// [`slice::from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html |
This follows the precedent of the recently-added `<*const [T]>::len` (adding to its tracking issue rust-lang#71146) and `ptr::slice_from_raw_parts`.
Co-authored-by: kennytm <kennytm@gmail.com>
What's the status of this? Is there anything preventing this to be merged? |
📌 Commit 861dfaa has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#71940 (Add `len` and `slice_from_raw_parts` to `NonNull<[T]>`) - rust-lang#72525 (Miri casts: do not blindly rely on dest type) - rust-lang#72537 (Fix InlineAsmOperand expresions being visited twice during liveness checking) - rust-lang#72544 (librustc_middle: Rename upvars query to upvars_mentioned) - rust-lang#72551 (First draft documenting Debug stability.) Failed merges: r? @ghost
This follows the precedent of the recently-added
<*const [T]>::len
(adding to its tracking issue #71146) andptr::slice_from_raw_parts
.