library: Stabilize const_slice_first_last

Const-stabilizes:
- `slice::first_mut`
- `slice::split_first_mut`
- `slice::last_mut`
- `slice::split_last_mut`
This commit is contained in:
Jubilee Young 2024-09-27 13:50:09 -07:00
parent 75db6b29b5
commit ac53f1f242

View File

@ -172,7 +172,8 @@ pub const fn first(&self) -> Option<&T> {
/// assert_eq!(None, y.first_mut());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[must_use]
pub const fn first_mut(&mut self) -> Option<&mut T> {
@ -214,7 +215,8 @@ pub const fn split_first(&self) -> Option<(&T, &[T])> {
/// assert_eq!(x, &[3, 4, 5]);
/// ```
#[stable(feature = "slice_splits", since = "1.5.0")]
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[must_use]
pub const fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])> {
@ -256,7 +258,8 @@ pub const fn split_last(&self) -> Option<(&T, &[T])> {
/// assert_eq!(x, &[4, 5, 3]);
/// ```
#[stable(feature = "slice_splits", since = "1.5.0")]
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[must_use]
pub const fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])> {
@ -298,7 +301,8 @@ pub const fn last(&self) -> Option<&T> {
/// assert_eq!(None, y.last_mut());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[must_use]
pub const fn last_mut(&mut self) -> Option<&mut T> {