Skip to content

Commit 989e328

Browse files
committed
Stabilize by-value [T; N] iterator core::array::IntoIter
Tracking issue: rust-lang#65798 This is unblocked now that `min_const_generics` has been stabilized in rust-lang#79135. This PR does *not* include the corresponding `IntoIterator` impl, which is rust-lang#65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.
1 parent 7b2eeca commit 989e328

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
#![feature(allocator_api)]
8080
#![feature(array_chunks)]
8181
#![feature(array_methods)]
82-
#![feature(array_value_iter)]
8382
#![feature(array_windows)]
8483
#![feature(allow_internal_unstable)]
8584
#![feature(arbitrary_self_types)]

core/src/array/iter.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
/// A by-value [array] iterator.
1212
///
1313
/// [array]: ../../std/primitive.array.html
14-
#[unstable(feature = "array_value_iter", issue = "65798")]
14+
#[stable(feature = "array_value_iter", since = "1.51.0")]
1515
pub struct IntoIter<T, const N: usize> {
1616
/// This is the array we are iterating over.
1717
///
@@ -38,10 +38,11 @@ pub struct IntoIter<T, const N: usize> {
3838
impl<T, const N: usize> IntoIter<T, N> {
3939
/// Creates a new iterator over the given `array`.
4040
///
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+
/// [array-into-iter]: https://github.com/rust-lang/rust/pull/65819
45+
#[stable(feature = "array_value_iter", since = "1.51.0")]
4546
pub fn new(array: [T; N]) -> Self {
4647
// SAFETY: The transmute here is actually safe. The docs of `MaybeUninit`
4748
// promise:
@@ -69,7 +70,7 @@ impl<T, const N: usize> IntoIter<T, N> {
6970

7071
/// Returns an immutable slice of all elements that have not been yielded
7172
/// yet.
72-
#[unstable(feature = "array_value_iter_slice", issue = "65798")]
73+
#[stable(feature = "array_value_iter", since = "1.51.0")]
7374
pub fn as_slice(&self) -> &[T] {
7475
// SAFETY: We know that all elements within `alive` are properly initialized.
7576
unsafe {
@@ -79,7 +80,7 @@ impl<T, const N: usize> IntoIter<T, N> {
7980
}
8081

8182
/// Returns a mutable slice of all elements that have not been yielded yet.
82-
#[unstable(feature = "array_value_iter_slice", issue = "65798")]
83+
#[stable(feature = "array_value_iter", since = "1.51.0")]
8384
pub fn as_mut_slice(&mut self) -> &mut [T] {
8485
// SAFETY: We know that all elements within `alive` are properly initialized.
8586
unsafe {

core/src/array/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::slice::{Iter, IterMut};
1717

1818
mod iter;
1919

20-
#[unstable(feature = "array_value_iter", issue = "65798")]
20+
#[stable(feature = "array_value_iter", since = "1.51.0")]
2121
pub use iter::IntoIter;
2222

2323
/// Converts a reference to `T` into a reference to an array of length 1 (without copying).

core/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#![feature(slice_internals)]
4646
#![feature(slice_partition_dedup)]
4747
#![feature(int_error_matching)]
48-
#![feature(array_value_iter)]
4948
#![feature(iter_advance_by)]
5049
#![feature(iter_partition_in_place)]
5150
#![feature(iter_is_partitioned)]

0 commit comments

Comments
 (0)