Skip to content

Commit

Permalink
library: Stabilize const_slice_first_last
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Sep 28, 2024
1 parent 94e8677 commit a377b36
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ impl<T> [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> {
Expand Down Expand Up @@ -214,7 +215,8 @@ impl<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])> {
Expand Down Expand Up @@ -256,7 +258,8 @@ impl<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])> {
Expand Down Expand Up @@ -298,7 +301,8 @@ impl<T> [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> {
Expand Down

0 comments on commit a377b36

Please sign in to comment.