Skip to content

Commit

Permalink
Rollup merge of rust-lang#133332 - bjoernager:const-array-as-mut-slic…
Browse files Browse the repository at this point in the history
…e, r=jhpratt

Mark `<[T; N]>::as_mut_slice` with the `const` specifier.

Tracking issue: rust-lang#133333

`<[T; N]>::as_mut_slice` can have the `const` specifier without any changes to the function body.
  • Loading branch information
matthiaskrgr authored Nov 23, 2024
2 parents 7e42db5 + c85a742 commit a6ac39b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit a6ac39b

Please sign in to comment.