Skip to content

Commit 77d5683

Browse files
authored
Rollup merge of #86593 - jhpratt:stabilize-const_slice_first_last, r=m-ou-se
Partially stabilize `const_slice_first_last` This stabilizes the non-`mut` methods of `const_slice_first_last` as `const`. These methods are trivial to implement and have no blockers that I am aware of. `@rustbot` label +A-const-fn +S-waiting-on-review +T-libs-api
2 parents 1176d30 + 9854d30 commit 77d5683

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/core/src/slice/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<T> [T] {
139139
/// assert_eq!(None, w.first());
140140
/// ```
141141
#[stable(feature = "rust1", since = "1.0.0")]
142-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
142+
#[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")]
143143
#[inline]
144144
pub const fn first(&self) -> Option<&T> {
145145
if let [first, ..] = self { Some(first) } else { None }
@@ -177,7 +177,7 @@ impl<T> [T] {
177177
/// }
178178
/// ```
179179
#[stable(feature = "slice_splits", since = "1.5.0")]
180-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
180+
#[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")]
181181
#[inline]
182182
pub const fn split_first(&self) -> Option<(&T, &[T])> {
183183
if let [first, tail @ ..] = self { Some((first, tail)) } else { None }
@@ -217,7 +217,7 @@ impl<T> [T] {
217217
/// }
218218
/// ```
219219
#[stable(feature = "slice_splits", since = "1.5.0")]
220-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
220+
#[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")]
221221
#[inline]
222222
pub const fn split_last(&self) -> Option<(&T, &[T])> {
223223
if let [init @ .., last] = self { Some((last, init)) } else { None }
@@ -256,7 +256,7 @@ impl<T> [T] {
256256
/// assert_eq!(None, w.last());
257257
/// ```
258258
#[stable(feature = "rust1", since = "1.0.0")]
259-
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
259+
#[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")]
260260
#[inline]
261261
pub const fn last(&self) -> Option<&T> {
262262
if let [.., last] = self { Some(last) } else { None }

0 commit comments

Comments
 (0)