Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 2a12489

Browse files
committed
refactor: moving AsIntoIter into into_iter.rs
1 parent 9361390 commit 2a12489

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

library/alloc/src/vec/into_iter.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,18 @@ unsafe impl<T, A: Allocator> SourceIter for IntoIter<T, A> {
268268
self
269269
}
270270
}
271+
272+
// internal helper trait for in-place iteration specialization.
273+
#[rustc_specialization_trait]
274+
pub(crate) trait AsIntoIter {
275+
type Item;
276+
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item>;
277+
}
278+
279+
impl<T> AsIntoIter for IntoIter<T> {
280+
type Item = T;
281+
282+
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item> {
283+
self
284+
}
285+
}

library/alloc/src/vec/mod.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ mod cow;
9393

9494
#[stable(feature = "rust1", since = "1.0.0")]
9595
pub use self::into_iter::IntoIter;
96+
pub (crate) use self::into_iter::AsIntoIter;
9697

9798
mod into_iter;
9899

@@ -3019,18 +3020,3 @@ impl<T, A: Allocator, const N: usize> TryFrom<Vec<T, A>> for [T; N] {
30193020
Ok(array)
30203021
}
30213022
}
3022-
3023-
// internal helper trait for in-place iteration specialization.
3024-
#[rustc_specialization_trait]
3025-
pub(crate) trait AsIntoIter {
3026-
type Item;
3027-
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item>;
3028-
}
3029-
3030-
impl<T> AsIntoIter for IntoIter<T> {
3031-
type Item = T;
3032-
3033-
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item> {
3034-
self
3035-
}
3036-
}

0 commit comments

Comments
 (0)