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.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-11-23 20:19:54 +08:00 committed by GitHub
commit 8036ff1302
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}