diff options
| author | Cyborus <cyborus@cyborus.xyz> | 2024-05-25 20:14:18 -0400 |
|---|---|---|
| committer | Cyborus <cyborus@cyborus.xyz> | 2024-05-26 01:26:24 -0400 |
| commit | 824ffd29eeaf6581eefdce2a1c462c8ab6339bf4 (patch) | |
| tree | 042808cf13352e47db7bf09b55bacb36ed139db9 /library/core/src/slice | |
| parent | 48f00110d0dae38b3046a9ac05d20ea321fd6637 (diff) | |
| download | rust-824ffd29eeaf6581eefdce2a1c462c8ab6339bf4.tar.gz rust-824ffd29eeaf6581eefdce2a1c462c8ab6339bf4.zip | |
Stabilize `slice_flatten`
Diffstat (limited to 'library/core/src/slice')
| -rw-r--r-- | library/core/src/slice/mod.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index f82f965e67c..503107c7480 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -4531,8 +4531,6 @@ impl<T, const N: usize> [[T; N]] { /// # Examples /// /// ``` - /// #![feature(slice_flatten)] - /// /// assert_eq!([[1, 2, 3], [4, 5, 6]].as_flattened(), &[1, 2, 3, 4, 5, 6]); /// /// assert_eq!( @@ -4546,7 +4544,8 @@ impl<T, const N: usize> [[T; N]] { /// let empty_slice_of_arrays: &[[u32; 10]] = &[]; /// assert!(empty_slice_of_arrays.as_flattened().is_empty()); /// ``` - #[unstable(feature = "slice_flatten", issue = "95629")] + #[stable(feature = "slice_flatten", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_unstable(feature = "const_slice_flatten", issue = "95629")] pub const fn as_flattened(&self) -> &[T] { let len = if T::IS_ZST { self.len().checked_mul(N).expect("slice len overflow") @@ -4572,8 +4571,6 @@ impl<T, const N: usize> [[T; N]] { /// # Examples /// /// ``` - /// #![feature(slice_flatten)] - /// /// fn add_5_to_all(slice: &mut [i32]) { /// for i in slice { /// *i += 5; @@ -4584,7 +4581,7 @@ impl<T, const N: usize> [[T; N]] { /// add_5_to_all(array.as_flattened_mut()); /// assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]); /// ``` - #[unstable(feature = "slice_flatten", issue = "95629")] + #[stable(feature = "slice_flatten", since = "CURRENT_RUSTC_VERSION")] pub fn as_flattened_mut(&mut self) -> &mut [T] { let len = if T::IS_ZST { self.len().checked_mul(N).expect("slice len overflow") |
