about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-19 18:52:03 +0100
committerGitHub <noreply@github.com>2025-02-19 18:52:03 +0100
commit2c380a4661244ea7239399c6adc26fa707d41af6 (patch)
treed2098b93c1d54d16dad9e2259f72b9f7d2e7976b
parentbe36bd288f887b26a0a09b15e83452acf5034935 (diff)
parent7de250f1e34ac18cf616179353a67019dfc2c0d6 (diff)
Rollup merge of #134995 - DaniPopes:stable-const_slice_flatten, r=Amanieu
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: https://github.com/rust-lang/rust/issues/95629

Requires separate FCP, as per https://github.com/rust-lang/rust/issues/95629#issuecomment-2566546257.

Closes https://github.com/rust-lang/rust/issues/95629.

`````@rustbot````` modify labels: +T-libs-api

Happy new year!
-rw-r--r--library/core/src/slice/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index ed45e26256e..7b9a76e814a 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -4796,7 +4796,7 @@ impl<T, const N: usize> [[T; N]] {
     /// assert!(empty_slice_of_arrays.as_flattened().is_empty());
     /// ```
     #[stable(feature = "slice_flatten", since = "1.80.0")]
-    #[rustc_const_unstable(feature = "const_slice_flatten", issue = "95629")]
+    #[rustc_const_stable(feature = "const_slice_flatten", since = "CURRENT_RUSTC_VERSION")]
     pub const fn as_flattened(&self) -> &[T] {
         let len = if T::IS_ZST {
             self.len().checked_mul(N).expect("slice len overflow")
@@ -4833,7 +4833,7 @@ impl<T, const N: usize> [[T; N]] {
     /// assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]);
     /// ```
     #[stable(feature = "slice_flatten", since = "1.80.0")]
-    #[rustc_const_unstable(feature = "const_slice_flatten", issue = "95629")]
+    #[rustc_const_stable(feature = "const_slice_flatten", since = "CURRENT_RUSTC_VERSION")]
     pub const fn as_flattened_mut(&mut self) -> &mut [T] {
         let len = if T::IS_ZST {
             self.len().checked_mul(N).expect("slice len overflow")