Skip to content

Commit cea0bb4

Browse files
DaniPopesgitbot
authored and
gitbot
committedMar 4, 2025
Stabilize const_slice_flatten
Const-stabilizes `slice::as_flattened{,_mut}`: ```rust // core::slice impl<T, const N: usize> [[T; N]] { pub const fn as_flattened(&self) -> &[T]; pub const fn as_flattened_mut(&mut self) -> &mut [T]; } ``` Tracking issue: rust-lang#95629 Requires separate libs-api FCP, as per rust-lang#95629 (comment). Closes rust-lang#95629.
1 parent 70a6fab commit cea0bb4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎core/src/slice/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4796,7 +4796,7 @@ impl<T, const N: usize> [[T; N]] {
47964796
/// assert!(empty_slice_of_arrays.as_flattened().is_empty());
47974797
/// ```
47984798
#[stable(feature = "slice_flatten", since = "1.80.0")]
4799-
#[rustc_const_unstable(feature = "const_slice_flatten", issue = "95629")]
4799+
#[rustc_const_stable(feature = "const_slice_flatten", since = "CURRENT_RUSTC_VERSION")]
48004800
pub const fn as_flattened(&self) -> &[T] {
48014801
let len = if T::IS_ZST {
48024802
self.len().checked_mul(N).expect("slice len overflow")
@@ -4833,7 +4833,7 @@ impl<T, const N: usize> [[T; N]] {
48334833
/// assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]);
48344834
/// ```
48354835
#[stable(feature = "slice_flatten", since = "1.80.0")]
4836-
#[rustc_const_unstable(feature = "const_slice_flatten", issue = "95629")]
4836+
#[rustc_const_stable(feature = "const_slice_flatten", since = "CURRENT_RUSTC_VERSION")]
48374837
pub const fn as_flattened_mut(&mut self) -> &mut [T] {
48384838
let len = if T::IS_ZST {
48394839
self.len().checked_mul(N).expect("slice len overflow")

0 commit comments

Comments
 (0)