refactor: moving AsIntoIter into into_iter.rs

This commit is contained in:
C 2020-12-05 00:47:54 +00:00
parent 93613901d0
commit 2a1248976a
2 changed files with 16 additions and 15 deletions

View File

@ -268,3 +268,18 @@ unsafe impl<T, A: Allocator> SourceIter for IntoIter<T, A> {
self
}
}
// internal helper trait for in-place iteration specialization.
#[rustc_specialization_trait]
pub(crate) trait AsIntoIter {
type Item;
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item>;
}
impl<T> AsIntoIter for IntoIter<T> {
type Item = T;
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item> {
self
}
}

View File

@ -93,6 +93,7 @@ mod cow;
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::into_iter::IntoIter;
pub (crate) use self::into_iter::AsIntoIter;
mod into_iter;
@ -3019,18 +3020,3 @@ impl<T, A: Allocator, const N: usize> TryFrom<Vec<T, A>> for [T; N] {
Ok(array)
}
}
// internal helper trait for in-place iteration specialization.
#[rustc_specialization_trait]
pub(crate) trait AsIntoIter {
type Item;
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item>;
}
impl<T> AsIntoIter for IntoIter<T> {
type Item = T;
fn as_into_iter(&mut self) -> &mut IntoIter<Self::Item> {
self
}
}