Skip to content

Commit 61c49d4

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 6c523a7 commit 61c49d4

File tree

11 files changed

+9
-18
lines changed

11 files changed

+9
-18
lines changed

compiler/rustc_arena/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1212
test(no_crate_inject, attr(deny(warnings)))
1313
)]
14-
#![feature(array_value_iter_slice)]
1514
#![feature(dropck_eyepatch)]
1615
#![feature(new_uninit)]
1716
#![feature(maybe_uninit_slice)]
18-
#![feature(array_value_iter)]
1917
#![cfg_attr(bootstrap, feature(min_const_generics))]
2018
#![feature(min_specialization)]
2119
#![cfg_attr(test, feature(test))]

compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
//! get confused if the spans from leaf AST nodes occur in multiple places
3131
//! in the HIR, especially for multiple identifiers.
3232
33-
#![feature(array_value_iter)]
3433
#![feature(crate_visibility_modifier)]
3534
#![feature(or_patterns)]
3635
#![recursion_limit = "256"]

compiler/rustc_hir/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//!
33
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
44
5-
#![feature(array_value_iter)]
65
#![feature(crate_visibility_modifier)]
76
#![feature(const_fn)] // For the unsizing cast on `&[]`
87
#![feature(const_panic)]

compiler/rustc_trait_selection/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! This API is completely unstable and subject to change.
1212
1313
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
14-
#![feature(array_value_iter)]
1514
#![feature(bool_to_option)]
1615
#![feature(box_patterns)]
1716
#![feature(drain_filter)]

compiler/rustc_typeck/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ This API is completely unstable and subject to change.
5656
*/
5757

5858
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
59-
#![feature(array_value_iter)]
6059
#![feature(bool_to_option)]
6160
#![feature(box_syntax)]
6261
#![feature(crate_visibility_modifier)]

library/alloc/src/lib.rs

-1
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)]

library/core/src/array/iter.rs

+8-7
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 {

library/core/src/array/mod.rs

+1-1
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).

library/core/tests/lib.rs

-1
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)]

src/test/ui/const-generics/array-impls/into-iter-impls-length-32.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// check-pass
22

3-
#![feature(array_value_iter)]
43
#![feature(trusted_len)]
54

65
use std::{

src/test/ui/const-generics/array-impls/into-iter-impls-length-33.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// check-pass
22

3-
#![feature(array_value_iter)]
43
#![feature(trusted_len)]
54

65
use std::{

0 commit comments

Comments
 (0)