about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-11-23 20:19:54 +0800
committerGitHub <noreply@github.com>2024-11-23 20:19:54 +0800
commit8036ff1302245cad6a2501e84d337019a184b1a0 (patch)
treef1fcdf83869252f50cc6f97b04e87a44c00f2049
parent4d9cd661c73fd57c58751ae2909adde64f9bdedb (diff)
parentc85a742cb12491b1f138c5d208f9c0cc5434dd77 (diff)
downloadrust-8036ff1302245cad6a2501e84d337019a184b1a0.tar.gz
rust-8036ff1302245cad6a2501e84d337019a184b1a0.zip
Rollup merge of #133332 - bjoernager:const-array-as-mut-slice, r=jhpratt
Mark `<[T; N]>::as_mut_slice` with the `const` specifier.

Tracking issue: #133333

`<[T; N]>::as_mut_slice` can have the `const` specifier without any changes to the function body.
-rw-r--r--library/core/src/array/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 71dcab3423c..67fbda34bb9 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -579,7 +579,8 @@ impl<T, const N: usize> [T; N] {
     /// Returns a mutable slice containing the entire array. Equivalent to
     /// `&mut s[..]`.
     #[stable(feature = "array_as_slice", since = "1.57.0")]
-    pub fn as_mut_slice(&mut self) -> &mut [T] {
+    #[rustc_const_unstable(feature = "const_array_as_mut_slice", issue = "133333")]
+    pub const fn as_mut_slice(&mut self) -> &mut [T] {
         self
     }