about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniPopes <57450786+DaniPopes@users.noreply.github.com>2024-12-30 18:16:28 +0100
committerDaniPopes <57450786+DaniPopes@users.noreply.github.com>2024-12-30 18:16:49 +0100
commit26f523edfc0286f6065d1467e0c524afaecfe681 (patch)
tree27d5b2bfb946284969234046e1189078c5e25178
parentf95c9967506712bdf8e86b08d8b17accbde2d985 (diff)
Make slice::as_flattened_mut unstably const
Tracking issue: https://github.com/rust-lang/rust/issues/95629

Unblocked by const_mut_refs being stabilized: https://github.com/rust-lang/rust/pull/129195
-rw-r--r--library/core/src/slice/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index ab65f9d6d2f..ca7d20e7150 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -4821,7 +4821,8 @@ 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")]
-    pub fn as_flattened_mut(&mut self) -> &mut [T] {
+    #[rustc_const_unstable(feature = "const_slice_flatten", issue = "95629")]
+    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")
         } else {