Skip to content

Commit 94ca877

Browse files
committed
Add reexport of Box<[T; N]>::Iter, add A = Global default to it
1 parent 6e30fbd commit 94ca877

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

library/alloc/src/boxed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ mod iter;
218218
/// [`ThinBox`] implementation.
219219
mod thin;
220220

221+
#[stable(feature = "boxed_array_value_iter", since = "CURRENT_RUSTC_VERSION")]
222+
pub use iter::BoxedArrayIntoIter;
221223
#[unstable(feature = "thin_box", issue = "92791")]
222224
pub use thin::ThinBox;
223225

library/alloc/src/boxed/iter.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use core::pin::Pin;
77
use core::task::{Context, Poll};
88
use core::{ptr, slice};
99

10-
use crate::alloc::Allocator;
10+
use crate::alloc::{Allocator, Global};
1111
#[cfg(not(no_global_oom_handling))]
1212
use crate::borrow::Cow;
1313
use crate::boxed::Box;
@@ -214,7 +214,7 @@ impl<'a, const N: usize, I, A: Allocator> !Iterator for &'a mut Box<[I; N], A> {
214214
/// A by-value `Box<[T; N]>` iterator.
215215
#[stable(feature = "boxed_array_value_iter", since = "CURRENT_RUSTC_VERSION")]
216216
#[rustc_insignificant_dtor]
217-
pub struct BoxedArrayIntoIter<T, const N: usize, A: Allocator> {
217+
pub struct BoxedArrayIntoIter<T, const N: usize, A: Allocator = Global> {
218218
/// This is the array we are iterating over.
219219
///
220220
/// Elements with index `i` where `alive.start <= i < alive.end` have not
@@ -421,6 +421,7 @@ where
421421
const MAY_HAVE_SIDE_EFFECT: bool = false;
422422
}
423423

424+
#[cfg(not(no_global_oom_handling))]
424425
#[stable(feature = "boxed_array_value_iter", since = "CURRENT_RUSTC_VERSION")]
425426
impl<T: Clone, const N: usize, A: Clone + Allocator> Clone for BoxedArrayIntoIter<T, N, A> {
426427
fn clone(&self) -> Self {

0 commit comments

Comments
 (0)