Skip to content

Commit 30c4a25

Browse files
Add IntoIterator impl for [T; N] (arrays by value)
1 parent 50f8aad commit 30c4a25

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/libcore/array/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,20 @@ where
200200
}
201201
}
202202

203+
#[cfg(not(bootstrap))]
204+
#[stable(feature = "array_into_iter_impl", since = "1.41.0")]
205+
impl<T, const N: usize> IntoIterator for [T; N]
206+
where
207+
[T; N]: LengthAtMost32,
208+
{
209+
type Item = T;
210+
type IntoIter = IntoIter<T, {N}>;
211+
212+
fn into_iter(self) -> Self::IntoIter {
213+
IntoIter::new(self)
214+
}
215+
}
216+
203217
#[stable(feature = "rust1", since = "1.0.0")]
204218
impl<'a, T, const N: usize> IntoIterator for &'a [T; N]
205219
where

0 commit comments

Comments
 (0)