Skip to content

Conversation

SimonSapin
Copy link
Contributor

This follows the precedent of the recently-added <*const [T]>::len (adding to its tracking issue #71146) and ptr::slice_from_raw_parts.

@SimonSapin SimonSapin added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. B-unstable Blocker: Implemented in the nightly compiler and unstable. labels May 6, 2020
@rust-highfive
Copy link
Contributor

r? @kennytm

(rust_highfive has picked a reviewer for you, use r? to override)

@SimonSapin
Copy link
Contributor Author

I’m speculatively opening a tracking issue #71941 for NonNull<[T]>::slice_from_raw_parts, assuming that its existence is uncontroversial based on the ptr::slice_from_raw_parts precedent.

Copy link
Member

@kennytm kennytm left a 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

@rust-highfive

This comment has been minimized.

@SimonSapin SimonSapin force-pushed the nonnull-slice branch 2 times, most recently from 52526cd to fe7217b Compare May 7, 2020 05:49
@kennytm
Copy link
Member

kennytm commented May 7, 2020

error: `[slice::from_raw_parts]` cannot be resolved, ignoring it.
   --> src/libcore/ptr/non_null.rs:151:35
    |
151 |     /// See the documentation of [`slice::from_raw_parts`] for slice safety requirements.
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
    |
note: the lint level is defined here
   --> src/libcore/lib.rs:64:9
    |
64  | #![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

@rust-highfive

This comment has been minimized.

/// 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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html
/// [`slice::from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html

SimonSapin and others added 2 commits May 18, 2020 21:29
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`.
@TimDiekmann
Copy link
Member

What's the status of this? Is there anything preventing this to be merged?

@RalfJung
Copy link
Member

@kennytm wrote

r=me with minor nits.

So I suppose we can
@bors r=kennytm

@bors
Copy link
Collaborator

bors commented May 25, 2020

📌 Commit 861dfaa has been approved by kennytm

@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 May 25, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request May 25, 2020
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
@bors bors merged commit bf816e0 into rust-lang:master May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. 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.

7 participants