Skip to content

Commit 5a6b0d1

Browse files
committed
Stabilize const_slice_split_at_mut and const_slice_first_last_chunk
1 parent 42ff2ee commit 5a6b0d1

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150
#![feature(const_size_of_val_raw)]
151151
#![feature(const_slice_from_raw_parts_mut)]
152152
#![feature(const_slice_from_ref)]
153-
#![feature(const_slice_split_at_mut)]
154153
#![feature(const_str_as_mut)]
155154
#![feature(const_str_from_utf8_unchecked_mut)]
156155
#![feature(const_strict_overflow_ops)]

library/core/src/slice/mod.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ impl<T> [T] {
353353
/// ```
354354
#[inline]
355355
#[stable(feature = "slice_first_last_chunk", since = "1.77.0")]
356-
#[rustc_const_unstable(feature = "const_slice_first_last_chunk", issue = "111774")]
356+
#[rustc_const_stable(feature = "const_slice_first_last_chunk", since = "CURRENT_RUSTC_VERSION")]
357+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
357358
pub const fn first_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]> {
358359
if self.len() < N {
359360
None
@@ -384,6 +385,7 @@ impl<T> [T] {
384385
#[inline]
385386
#[stable(feature = "slice_first_last_chunk", since = "1.77.0")]
386387
#[rustc_const_stable(feature = "slice_first_last_chunk", since = "1.77.0")]
388+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
387389
pub const fn split_first_chunk<const N: usize>(&self) -> Option<(&[T; N], &[T])> {
388390
if self.len() < N {
389391
None
@@ -418,7 +420,8 @@ impl<T> [T] {
418420
/// ```
419421
#[inline]
420422
#[stable(feature = "slice_first_last_chunk", since = "1.77.0")]
421-
#[rustc_const_unstable(feature = "const_slice_first_last_chunk", issue = "111774")]
423+
#[rustc_const_stable(feature = "const_slice_first_last_chunk", since = "CURRENT_RUSTC_VERSION")]
424+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
422425
pub const fn split_first_chunk_mut<const N: usize>(
423426
&mut self,
424427
) -> Option<(&mut [T; N], &mut [T])> {
@@ -454,6 +457,7 @@ impl<T> [T] {
454457
#[inline]
455458
#[stable(feature = "slice_first_last_chunk", since = "1.77.0")]
456459
#[rustc_const_stable(feature = "slice_first_last_chunk", since = "1.77.0")]
460+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
457461
pub const fn split_last_chunk<const N: usize>(&self) -> Option<(&[T], &[T; N])> {
458462
if self.len() < N {
459463
None
@@ -488,7 +492,8 @@ impl<T> [T] {
488492
/// ```
489493
#[inline]
490494
#[stable(feature = "slice_first_last_chunk", since = "1.77.0")]
491-
#[rustc_const_unstable(feature = "const_slice_first_last_chunk", issue = "111774")]
495+
#[rustc_const_stable(feature = "const_slice_first_last_chunk", since = "CURRENT_RUSTC_VERSION")]
496+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
492497
pub const fn split_last_chunk_mut<const N: usize>(
493498
&mut self,
494499
) -> Option<(&mut [T], &mut [T; N])> {
@@ -524,6 +529,7 @@ impl<T> [T] {
524529
#[inline]
525530
#[stable(feature = "slice_first_last_chunk", since = "1.77.0")]
526531
#[rustc_const_stable(feature = "const_slice_last_chunk", since = "1.80.0")]
532+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
527533
pub const fn last_chunk<const N: usize>(&self) -> Option<&[T; N]> {
528534
if self.len() < N {
529535
None
@@ -557,7 +563,8 @@ impl<T> [T] {
557563
/// ```
558564
#[inline]
559565
#[stable(feature = "slice_first_last_chunk", since = "1.77.0")]
560-
#[rustc_const_unstable(feature = "const_slice_first_last_chunk", issue = "111774")]
566+
#[rustc_const_stable(feature = "const_slice_first_last_chunk", since = "CURRENT_RUSTC_VERSION")]
567+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
561568
pub const fn last_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]> {
562569
if self.len() < N {
563570
None
@@ -1900,7 +1907,8 @@ impl<T> [T] {
19001907
#[inline]
19011908
#[track_caller]
19021909
#[must_use]
1903-
#[rustc_const_unstable(feature = "const_slice_split_at_mut", issue = "101804")]
1910+
#[rustc_const_stable(feature = "const_slice_split_at_mut", since = "CURRENT_RUSTC_VERSION")]
1911+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
19041912
pub const fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) {
19051913
match self.split_at_mut_checked(mid) {
19061914
Some(pair) => pair,
@@ -2002,7 +2010,8 @@ impl<T> [T] {
20022010
/// assert_eq!(v, [1, 2, 3, 4, 5, 6]);
20032011
/// ```
20042012
#[stable(feature = "slice_split_at_unchecked", since = "1.79.0")]
2005-
#[rustc_const_unstable(feature = "const_slice_split_at_mut", issue = "101804")]
2013+
#[rustc_const_stable(feature = "const_slice_split_at_mut", since = "CURRENT_RUSTC_VERSION")]
2014+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
20062015
#[inline]
20072016
#[must_use]
20082017
pub const unsafe fn split_at_mut_unchecked(&mut self, mid: usize) -> (&mut [T], &mut [T]) {
@@ -2102,7 +2111,8 @@ impl<T> [T] {
21022111
/// assert_eq!(None, v.split_at_mut_checked(7));
21032112
/// ```
21042113
#[stable(feature = "split_at_checked", since = "1.80.0")]
2105-
#[rustc_const_unstable(feature = "const_slice_split_at_mut", issue = "101804")]
2114+
#[rustc_const_stable(feature = "const_slice_split_at_mut", since = "CURRENT_RUSTC_VERSION")]
2115+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
21062116
#[inline]
21072117
#[must_use]
21082118
pub const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut [T], &mut [T])> {

0 commit comments

Comments
 (0)