diff options
| author | C <DeveloperC@protonmail.com> | 2020-12-05 00:47:54 +0000 |
|---|---|---|
| committer | C <DeveloperC@protonmail.com> | 2020-12-29 14:03:29 +0000 |
| commit | 2a1248976a00429994d5965bb31d6dcc1b7dcd68 (patch) | |
| tree | 5a27b90f5bc6ac0356e020f5a78f2ef376b5ec00 /library/alloc/src/vec/into_iter.rs | |
| parent | 93613901d004ccf0b8a240bf328559a4128ac3b2 (diff) | |
| download | rust-2a1248976a00429994d5965bb31d6dcc1b7dcd68.tar.gz rust-2a1248976a00429994d5965bb31d6dcc1b7dcd68.zip | |
refactor: moving AsIntoIter into into_iter.rs
Diffstat (limited to 'library/alloc/src/vec/into_iter.rs')
| -rw-r--r-- | library/alloc/src/vec/into_iter.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 623792a6316..c4330df4ad9 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -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 + } +} |
