Skip to content

Commit 26013cd

Browse files
library: Stabilize const_slice_first_last
Const-stabilizes: - `slice::first_mut` - `slice::split_first_mut` - `slice::last_mut` - `slice::split_last_mut`
1 parent 51ed903 commit 26013cd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

core/src/slice/mod.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ impl<T> [T] {
172172
/// assert_eq!(None, y.first_mut());
173173
/// ```
174174
#[stable(feature = "rust1", since = "1.0.0")]
175-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
175+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
176+
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
176177
#[inline]
177178
#[must_use]
178179
pub const fn first_mut(&mut self) -> Option<&mut T> {
@@ -214,7 +215,8 @@ impl<T> [T] {
214215
/// assert_eq!(x, &[3, 4, 5]);
215216
/// ```
216217
#[stable(feature = "slice_splits", since = "1.5.0")]
217-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
218+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
219+
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
218220
#[inline]
219221
#[must_use]
220222
pub const fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])> {
@@ -256,7 +258,8 @@ impl<T> [T] {
256258
/// assert_eq!(x, &[4, 5, 3]);
257259
/// ```
258260
#[stable(feature = "slice_splits", since = "1.5.0")]
259-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
261+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
262+
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
260263
#[inline]
261264
#[must_use]
262265
pub const fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])> {
@@ -298,7 +301,8 @@ impl<T> [T] {
298301
/// assert_eq!(None, y.last_mut());
299302
/// ```
300303
#[stable(feature = "rust1", since = "1.0.0")]
301-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
304+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
305+
#[rustc_const_stable(feature = "const_slice_first_last", since = "CURRENT_RUSTC_VERSION")]
302306
#[inline]
303307
#[must_use]
304308
pub const fn last_mut(&mut self) -> Option<&mut T> {

0 commit comments

Comments
 (0)