Skip to content

Stabilize (const_)slice_ptr_len and (const_)slice_ptr_is_empty_nonnull #123868

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 13, 2024
Merged

Stabilize (const_)slice_ptr_len and (const_)slice_ptr_is_empty_nonnull #123868

merged 1 commit into from
Apr 13, 2024

Conversation

eduardosm
Copy link
Contributor

Stabilized API:

impl<T> *mut [T] {
    pub const fn len(self) -> usize;
    pub const fn is_empty(self) -> bool;
}

impl<T> *const [T] {
    pub const fn len(self) -> usize;
    pub const fn is_empty(self) -> bool;
}

impl<T> NonNull<[T]> {
    pub const fn is_empty(self) -> bool;
}

FCP completed in tracking issue: #71146

@rustbot
Copy link
Collaborator

rustbot commented Apr 12, 2024

r? @joboet

rustbot has assigned @joboet.
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 12, 2024
@joboet
Copy link
Member

joboet commented Apr 12, 2024

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Apr 12, 2024
@rustbot rustbot assigned joshtriplett and unassigned joboet Apr 12, 2024
@jhpratt
Copy link
Member

jhpratt commented Apr 12, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 12, 2024

📌 Commit fb9e1f7 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 Apr 12, 2024
@jhpratt jhpratt linked an issue Apr 12, 2024 that may be closed by this pull request
7 tasks
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2024
Rollup of 4 pull requests

Successful merges:

 - rust-lang#123835 (Avoid more NonNull-raw-NonNull roundtrips in Vec)
 - rust-lang#123868 (Stabilize (const_)slice_ptr_len and (const_)slice_ptr_is_empty_nonnull)
 - rust-lang#123872 (Fix Pietro's entry in the mailmap)
 - rust-lang#123873 (Merge cuviper in the mailmap)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0518ecc into rust-lang:master Apr 13, 2024
@rustbot rustbot added this to the 1.79.0 milestone Apr 13, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2024
Rollup merge of rust-lang#123868 - eduardosm:stabilize-slice_ptr_len, r=jhpratt

Stabilize (const_)slice_ptr_len and (const_)slice_ptr_is_empty_nonnull

Stabilized API:

```rust
impl<T> *mut [T] {
    pub const fn len(self) -> usize;
    pub const fn is_empty(self) -> bool;
}

impl<T> *const [T] {
    pub const fn len(self) -> usize;
    pub const fn is_empty(self) -> bool;
}

impl<T> NonNull<[T]> {
    pub const fn is_empty(self) -> bool;
}
```

FCP completed in tracking issue: rust-lang#71146
@eduardosm eduardosm deleted the stabilize-slice_ptr_len branch April 13, 2024 19:27
#[rustc_const_unstable(feature = "const_slice_ptr_len", issue = "71146")]
#[stable(feature = "slice_ptr_len", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "const_slice_ptr_len", since = "CURRENT_RUSTC_VERSION")]
#[rustc_allow_const_fn_unstable(ptr_metadata)]
Copy link
Member

Choose a reason for hiding this comment

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

@rust-lang/libs-api please make sure that any time this attribute is added, @rust-lang/wg-const-eval is involved. The point of the attribute is to ensure we don't accidentally expose const-features on stable that are not ready yet for stable; that only works if we get the time to have a look at every new use of this attribute.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. 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.

Tracking Issue for raw slice len() method (slice_ptr_len, const_slice_ptr_len)
7 participants