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

Tracking Issue for const_split_off_first_last #138539

Open
1 of 3 tasks
okaneco opened this issue Mar 15, 2025 · 0 comments
Open
1 of 3 tasks

Tracking Issue for const_split_off_first_last #138539

okaneco opened this issue Mar 15, 2025 · 0 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@okaneco
Copy link
Contributor

okaneco commented Mar 15, 2025

Feature gate: #![feature(const_split_off_first_last)]

This is a tracking issue for using <[T]>::split_off_* functions in const. These functions remove either the first or last element from a slice and return a reference or mutable reference to that element.

The original functions were stabilized with the slice_take feature.
slice_take tracking issue: #62280

Public API

impl<T> [T] {
    pub const fn split_off_first<'a>(self: &mut &'a Self) -> Option<&'a T>;
    pub const fn split_off_first_mut<'a>(self: &mut &'a mut Self) -> Option<&'a mut T>;
    pub const fn split_off_last<'a>(self: &mut &'a Self) -> Option<&'a T>;
    pub const fn split_off_last_mut<'a>(self: &mut &'a mut Self) -> Option<&'a mut T>;
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@okaneco okaneco added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Mar 15, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 19, 2025
…, r=m-ou-se

core/slice: Mark some `split_off` variants unstably const

Tracking issue: rust-lang#138539

Add feature gate `#![feature(const_split_off_first_last)]`
Mark `split_off_first`, `split_off_first_mut`, `split_off_last`, and `split_off_last_mut` slice methods unstably const
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 20, 2025
Rollup merge of rust-lang#138540 - okaneco:const_split_off_first_last, r=m-ou-se

core/slice: Mark some `split_off` variants unstably const

Tracking issue: rust-lang#138539

Add feature gate `#![feature(const_split_off_first_last)]`
Mark `split_off_first`, `split_off_first_mut`, `split_off_last`, and `split_off_last_mut` slice methods unstably const
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant