]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #88353 - jhpratt:stabilize-array-as-ref, r=joshtriplett
authorManish Goregaokar <manishsmail@gmail.com>
Mon, 4 Oct 2021 06:13:19 +0000 (23:13 -0700)
committerGitHub <noreply@github.com>
Mon, 4 Oct 2021 06:13:19 +0000 (23:13 -0700)
Partially stabilize `array_methods`

This stabilizes `<[T; N]>::as_slice` and `<[T; N]>::as_mut_slice`, which is forms part of the `array_methods` feature: #76118.

This also makes `<[T; N]>::as_slice` const due to its trivial nature.

library/core/src/array/mod.rs

index 8c33a43ab330ebd4d847152d7e188cbb231afbb6..09329247f949228a35fe2fc8e64eb21087b2f530 100644 (file)
@@ -368,14 +368,14 @@ macro_rules! array_impl_default {
     }
 
     /// 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
     }