Rollup merge of #148814 - bend-n:stabilize_array_windows, r=scottmcm

stabilize `array_windows`

Tracking issue: rust-lang/rust#75027
Closes: rust-lang/rust#75027
FCP completed: https://github.com/rust-lang/rust/issues/75027#issuecomment-3477510526
This commit is contained in:
Matthias Krüger 2025-12-06 09:57:59 +01:00 committed by GitHub
commit 8a6f82efac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 23 additions and 25 deletions

View file

@ -5,8 +5,8 @@
//! This API is completely unstable and subject to change.
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(array_windows))]
#![doc(test(attr(deny(warnings), allow(internal_features))))]
#![feature(array_windows)]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(if_let_guard)]

View file

@ -10,9 +10,9 @@
#![allow(internal_features)]
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(allocator_api)]
#![feature(array_windows)]
#![feature(ascii_char)]
#![feature(ascii_char_variants)]
#![feature(assert_matches)]

View file

@ -7,7 +7,7 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(assert_matches)]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]

View file

@ -1,7 +1,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(associated_type_defaults)]
#![feature(if_let_guard)]
#![feature(macro_metavar_expr)]

View file

@ -21,7 +21,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(if_let_guard)]

View file

@ -29,8 +29,8 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(allocator_api)]
#![feature(array_windows)]
#![feature(assert_matches)]
#![feature(associated_type_defaults)]
#![feature(box_as_ptr)]

View file

@ -1,5 +1,5 @@
// tidy-alphabetical-start
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(const_type_name)]

View file

@ -1,5 +1,5 @@
// tidy-alphabetical-start
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(file_buffered)]
#![feature(if_let_guard)]
#![feature(impl_trait_in_assoc_type)]

View file

@ -17,8 +17,8 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![cfg_attr(target_arch = "loongarch64", feature(stdarch_loongarch))]
#![feature(array_windows)]
#![feature(cfg_select)]
#![feature(core_io_borrowed_buf)]
#![feature(if_let_guard)]

View file

@ -89,7 +89,6 @@
#![feature(alloc_layout_extra)]
#![feature(allocator_api)]
#![feature(array_into_iter_constructors)]
#![feature(array_windows)]
#![feature(ascii_char)]
#![feature(assert_matches)]
#![feature(async_fn_traits)]

View file

@ -18,7 +18,7 @@ use core::cmp::Ordering::{self, Less};
use core::mem::MaybeUninit;
#[cfg(not(no_global_oom_handling))]
use core::ptr;
#[unstable(feature = "array_windows", issue = "75027")]
#[stable(feature = "array_windows", since = "CURRENT_RUSTC_VERSION")]
pub use core::slice::ArrayWindows;
#[stable(feature = "inherent_ascii_escape", since = "1.60.0")]
pub use core::slice::EscapeAscii;

View file

@ -2165,8 +2165,6 @@ unsafe impl<T> Sync for ChunksExactMut<'_, T> where T: Sync {}
/// # Example
///
/// ```
/// #![feature(array_windows)]
///
/// let slice = [0, 1, 2, 3];
/// let mut iter = slice.array_windows::<2>();
/// assert_eq!(iter.next(), Some(&[0, 1]));
@ -2178,7 +2176,7 @@ unsafe impl<T> Sync for ChunksExactMut<'_, T> where T: Sync {}
/// [`array_windows`]: slice::array_windows
/// [slices]: slice
#[derive(Debug, Clone, Copy)]
#[unstable(feature = "array_windows", issue = "75027")]
#[stable(feature = "array_windows", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct ArrayWindows<'a, T: 'a, const N: usize> {
v: &'a [T],
@ -2191,7 +2189,7 @@ impl<'a, T: 'a, const N: usize> ArrayWindows<'a, T, N> {
}
}
#[unstable(feature = "array_windows", issue = "75027")]
#[stable(feature = "array_windows", since = "CURRENT_RUSTC_VERSION")]
impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N> {
type Item = &'a [T; N];
@ -2228,7 +2226,7 @@ impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N> {
}
}
#[unstable(feature = "array_windows", issue = "75027")]
#[stable(feature = "array_windows", since = "CURRENT_RUSTC_VERSION")]
impl<'a, T, const N: usize> DoubleEndedIterator for ArrayWindows<'a, T, N> {
#[inline]
fn next_back(&mut self) -> Option<&'a [T; N]> {
@ -2247,7 +2245,7 @@ impl<'a, T, const N: usize> DoubleEndedIterator for ArrayWindows<'a, T, N> {
}
}
#[unstable(feature = "array_windows", issue = "75027")]
#[stable(feature = "array_windows", since = "CURRENT_RUSTC_VERSION")]
impl<T, const N: usize> ExactSizeIterator for ArrayWindows<'_, T, N> {
fn is_empty(&self) -> bool {
self.v.len() < N

View file

@ -51,7 +51,7 @@ pub use ascii::is_ascii_simple;
pub use index::SliceIndex;
#[unstable(feature = "slice_range", issue = "76393")]
pub use index::{range, try_range};
#[unstable(feature = "array_windows", issue = "75027")]
#[stable(feature = "array_windows", since = "CURRENT_RUSTC_VERSION")]
pub use iter::ArrayWindows;
#[stable(feature = "slice_group_by", since = "1.77.0")]
pub use iter::{ChunkBy, ChunkByMut};
@ -1620,13 +1620,15 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
/// Panics if `N` is zero.
///
/// Note that this check is against a const generic parameter, not a runtime
/// value, and thus a particular monomorphization will either always panic
/// or it will never panic.
///
/// # Examples
///
/// ```
/// #![feature(array_windows)]
/// let slice = [0, 1, 2, 3];
/// let mut iter = slice.array_windows();
/// assert_eq!(iter.next().unwrap(), &[0, 1]);
@ -1636,7 +1638,7 @@ impl<T> [T] {
/// ```
///
/// [`windows`]: slice::windows
#[unstable(feature = "array_windows", issue = "75027")]
#[stable(feature = "array_windows", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
#[track_caller]

View file

@ -5,7 +5,6 @@
#![feature(array_ptr_get)]
#![feature(array_try_from_fn)]
#![feature(array_try_map)]
#![feature(array_windows)]
#![feature(ascii_char)]
#![feature(ascii_char_variants)]
#![feature(async_iter_from_iter)]

View file

@ -1,4 +1,4 @@
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(box_patterns)]
#![feature(macro_metavar_expr_concat)]
#![feature(f128)]

View file

@ -5,7 +5,7 @@
#![feature(rustc_private)]
#![feature(assert_matches)]
#![feature(unwrap_infallible)]
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![recursion_limit = "512"]
#![allow(
clippy::missing_errors_doc,