Skip to content

Commit

Permalink
Partially stabilize array_methods
Browse files Browse the repository at this point in the history
This also makes `<[T; N]>::as_slice` const due to its trivial nature.
  • Loading branch information
jhpratt committed Aug 26, 2021
1 parent 76e755c commit 905c2ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,14 @@ impl<T, const N: usize> [T; N] {
}

/// Returns a slice containing the entire array. Equivalent to `&s[..]`.
#[unstable(feature = "array_methods", issue = "76118")]
pub fn as_slice(&self) -> &[T] {
#[stable(feature = "array_as_slice", since = "1.57.0")]
pub const fn as_slice(&self) -> &[T] {
self
}

/// Returns a mutable slice containing the entire array. Equivalent to
/// `&mut s[..]`.
#[unstable(feature = "array_methods", issue = "76118")]
#[stable(feature = "array_as_slice", since = "1.57.0")]
pub fn as_mut_slice(&mut self) -> &mut [T] {
self
}
Expand Down

0 comments on commit 905c2ba

Please sign in to comment.