@@ -11,7 +11,7 @@ use crate::{
11
11
/// A by-value [array] iterator.
12
12
///
13
13
/// [array]: ../../std/primitive.array.html
14
- #[ unstable ( feature = "array_value_iter" , issue = "65798 " ) ]
14
+ #[ stable ( feature = "array_value_iter" , since = "1.51.0 " ) ]
15
15
pub struct IntoIter < T , const N : usize > {
16
16
/// This is the array we are iterating over.
17
17
///
@@ -38,10 +38,21 @@ pub struct IntoIter<T, const N: usize> {
38
38
impl < T , const N : usize > IntoIter < T , N > {
39
39
/// Creates a new iterator over the given `array`.
40
40
///
41
- /// *Note*: this method might never get stabilized and/or removed in the
42
- /// future as there will likely be another, preferred way of obtaining this
43
- /// iterator (either via `IntoIterator` for arrays or via another way).
44
- #[ unstable( feature = "array_value_iter" , issue = "65798" ) ]
41
+ /// *Note*: this method might be deprecated in the future,
42
+ /// after [`IntoIterator` is implemented for arrays][array-into-iter].
43
+ ///
44
+ /// # Examples
45
+ ///
46
+ /// ```
47
+ /// use std::array;
48
+ ///
49
+ /// for value in array::IntoIter::new([1, 2, 3, 4, 5]) {
50
+ /// // The type of `value` is a `i32` here, instead of `&i32`
51
+ /// let _: i32 = value;
52
+ /// }
53
+ /// ```
54
+ /// [array-into-iter]: https://github.com/rust-lang/rust/pull/65819
55
+ #[ stable( feature = "array_value_iter" , since = "1.51.0" ) ]
45
56
pub fn new ( array : [ T ; N ] ) -> Self {
46
57
// SAFETY: The transmute here is actually safe. The docs of `MaybeUninit`
47
58
// promise:
@@ -69,7 +80,7 @@ impl<T, const N: usize> IntoIter<T, N> {
69
80
70
81
/// Returns an immutable slice of all elements that have not been yielded
71
82
/// yet.
72
- #[ unstable ( feature = "array_value_iter_slice " , issue = "65798 " ) ]
83
+ #[ stable ( feature = "array_value_iter " , since = "1.51.0 " ) ]
73
84
pub fn as_slice ( & self ) -> & [ T ] {
74
85
// SAFETY: We know that all elements within `alive` are properly initialized.
75
86
unsafe {
@@ -79,7 +90,7 @@ impl<T, const N: usize> IntoIter<T, N> {
79
90
}
80
91
81
92
/// Returns a mutable slice of all elements that have not been yielded yet.
82
- #[ unstable ( feature = "array_value_iter_slice " , issue = "65798 " ) ]
93
+ #[ stable ( feature = "array_value_iter " , since = "1.51.0 " ) ]
83
94
pub fn as_mut_slice ( & mut self ) -> & mut [ T ] {
84
95
// SAFETY: We know that all elements within `alive` are properly initialized.
85
96
unsafe {
0 commit comments