diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index 2ab52a4d584..ef5bef0253a 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -151,7 +151,7 @@ use core::ptr; use crate::collections::TryReserveError; use crate::slice; -use crate::vec::{self, AsIntoIter, Vec}; +use crate::vec::{self, AsVecIntoIter, Vec}; use super::SpecExtend; @@ -1418,7 +1418,7 @@ unsafe impl SourceIter for IntoIter { #[doc(hidden)] unsafe impl InPlaceIterable for IntoIter {} -unsafe impl AsIntoIter for IntoIter { +unsafe impl AsVecIntoIter for IntoIter { type Item = I; fn as_into_iter(&mut self) -> &mut vec::IntoIter { diff --git a/library/alloc/src/vec/in_place_collect.rs b/library/alloc/src/vec/in_place_collect.rs index 59f7cc6b004..6dc548fc8e9 100644 --- a/library/alloc/src/vec/in_place_collect.rs +++ b/library/alloc/src/vec/in_place_collect.rs @@ -16,7 +16,7 @@ //! `FromIterator` implementation benefit from this too. //! //! Access to the underlying source goes through a further layer of indirection via the private -//! trait [`AsIntoIter`] to hide the implementation detail that other collections may use +//! trait [`AsVecIntoIter`] to hide the implementation detail that other collections may use //! `vec::IntoIter` internally. //! //! In-place iteration depends on the interaction of several unsafe traits, implementation @@ -142,16 +142,16 @@ impl InPlaceIterableMarker for T where T: InPlaceIterable {} impl SpecFromIter for Vec where - I: Iterator + SourceIter + InPlaceIterableMarker, + I: Iterator + SourceIter + InPlaceIterableMarker, { default fn from_iter(mut iterator: I) -> Self { // See "Layout constraints" section in the module documentation. We rely on const // optimization here since these conditions currently cannot be expressed as trait bounds if mem::size_of::() == 0 || mem::size_of::() - != mem::size_of::<<::Source as AsIntoIter>::Item>() + != mem::size_of::<<::Source as AsVecIntoIter>::Item>() || mem::align_of::() - != mem::align_of::<<::Source as AsIntoIter>::Item>() + != mem::align_of::<<::Source as AsVecIntoIter>::Item>() { // fallback to more generic implementations return SpecFromIterNested::from_iter(iterator); @@ -289,7 +289,7 @@ where /// In-place iteration relies on implementation details of `vec::IntoIter`, most importantly that /// it does not create references to the whole allocation during iteration, only raw pointers #[rustc_specialization_trait] -pub(crate) unsafe trait AsIntoIter { +pub(crate) unsafe trait AsVecIntoIter { type Item; fn as_into_iter(&mut self) -> &mut super::IntoIter; } diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index f80d22d6bdb..f17b8d71b3a 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -1,5 +1,5 @@ #[cfg(not(no_global_oom_handling))] -use super::AsIntoIter; +use super::AsVecIntoIter; use crate::alloc::{Allocator, Global}; use crate::raw_vec::RawVec; use core::fmt; @@ -346,7 +346,7 @@ unsafe impl SourceIter for IntoIter { } #[cfg(not(no_global_oom_handling))] -unsafe impl AsIntoIter for IntoIter { +unsafe impl AsVecIntoIter for IntoIter { type Item = T; fn as_into_iter(&mut self) -> &mut IntoIter { diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 0b305b49d51..9a66e69bdc0 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -96,7 +96,7 @@ mod drain; mod cow; #[cfg(not(no_global_oom_handling))] -pub(crate) use self::in_place_collect::AsIntoIter; +pub(crate) use self::in_place_collect::AsVecIntoIter; #[stable(feature = "rust1", since = "1.0.0")] pub use self::into_iter::IntoIter;