Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 651fd56

Browse files
committedMay 26, 2024
Stabilize slice_flatten
1 parent 48f0011 commit 651fd56

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed
 

‎library/alloc/src/vec/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2643,15 +2643,13 @@ impl<T, A: Allocator, const N: usize> Vec<[T; N], A> {
26432643
/// # Examples
26442644
///
26452645
/// ```
2646-
/// #![feature(slice_flatten)]
2647-
///
26482646
/// let mut vec = vec![[1, 2, 3], [4, 5, 6], [7, 8, 9]];
26492647
/// assert_eq!(vec.pop(), Some([7, 8, 9]));
26502648
///
26512649
/// let mut flattened = vec.into_flattened();
26522650
/// assert_eq!(flattened.pop(), Some(6));
26532651
/// ```
2654-
#[unstable(feature = "slice_flatten", issue = "95629")]
2652+
#[stable(feature = "slice_flatten", since = "CURRENT_RUSTC_VERSION")]
26552653
pub fn into_flattened(self) -> Vec<T, A> {
26562654
let (ptr, len, cap, alloc) = self.into_raw_parts_with_alloc();
26572655
let (new_len, new_cap) = if T::IS_ZST {

‎library/core/src/slice/mod.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -4531,8 +4531,6 @@ impl<T, const N: usize> [[T; N]] {
45314531
/// # Examples
45324532
///
45334533
/// ```
4534-
/// #![feature(slice_flatten)]
4535-
///
45364534
/// assert_eq!([[1, 2, 3], [4, 5, 6]].as_flattened(), &[1, 2, 3, 4, 5, 6]);
45374535
///
45384536
/// assert_eq!(
@@ -4546,7 +4544,7 @@ impl<T, const N: usize> [[T; N]] {
45464544
/// let empty_slice_of_arrays: &[[u32; 10]] = &[];
45474545
/// assert!(empty_slice_of_arrays.as_flattened().is_empty());
45484546
/// ```
4549-
#[unstable(feature = "slice_flatten", issue = "95629")]
4547+
#[stable(feature = "slice_flatten", since = "CURRENT_RUSTC_VERSION")]
45504548
pub const fn as_flattened(&self) -> &[T] {
45514549
let len = if T::IS_ZST {
45524550
self.len().checked_mul(N).expect("slice len overflow")
@@ -4572,8 +4570,6 @@ impl<T, const N: usize> [[T; N]] {
45724570
/// # Examples
45734571
///
45744572
/// ```
4575-
/// #![feature(slice_flatten)]
4576-
///
45774573
/// fn add_5_to_all(slice: &mut [i32]) {
45784574
/// for i in slice {
45794575
/// *i += 5;
@@ -4584,7 +4580,7 @@ impl<T, const N: usize> [[T; N]] {
45844580
/// add_5_to_all(array.as_flattened_mut());
45854581
/// assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]);
45864582
/// ```
4587-
#[unstable(feature = "slice_flatten", issue = "95629")]
4583+
#[stable(feature = "slice_flatten", since = "CURRENT_RUSTC_VERSION")]
45884584
pub fn as_flattened_mut(&mut self) -> &mut [T] {
45894585
let len = if T::IS_ZST {
45904586
self.len().checked_mul(N).expect("slice len overflow")

0 commit comments

Comments
 (0)
Failed to load comments.