Skip to content

std: Small stability tweaks to iter #22125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,15 +656,15 @@ impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
}

impl<T: Ord> IntoIterator for BinaryHeap<T> {
type Iter = IntoIter<T>;
type IntoIter = IntoIter<T>;

fn into_iter(self) -> IntoIter<T> {
self.into_iter()
}
}

impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ impl<'a> RandomAccessIterator for Iter<'a> {
}

impl<'a> IntoIterator for &'a Bitv {
type Iter = Iter<'a>;
type IntoIter = Iter<'a>;

fn into_iter(self) -> Iter<'a> {
self.iter()
Expand Down Expand Up @@ -1883,7 +1883,7 @@ impl<'a> Iterator for SymmetricDifference<'a> {
}

impl<'a> IntoIterator for &'a BitvSet {
type Iter = SetIter<'a>;
type IntoIter = SetIter<'a>;

fn into_iter(self) -> SetIter<'a> {
self.iter()
Expand Down
6 changes: 3 additions & 3 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,23 +463,23 @@ impl<K: Ord, V> BTreeMap<K, V> {
}

impl<K, V> IntoIterator for BTreeMap<K, V> {
type Iter = IntoIter<K, V>;
type IntoIter = IntoIter<K, V>;

fn into_iter(self) -> IntoIter<K, V> {
self.into_iter()
}
}

impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
type Iter = Iter<'a, K, V>;
type IntoIter = Iter<'a, K, V>;

fn into_iter(self) -> Iter<'a, K, V> {
self.iter()
}
}

impl<'a, K, V> IntoIterator for &'a mut BTreeMap<K, V> {
type Iter = IterMut<'a, K, V>;
type IntoIter = IterMut<'a, K, V>;

fn into_iter(mut self) -> IterMut<'a, K, V> {
self.iter_mut()
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,15 @@ impl<T: Ord> FromIterator<T> for BTreeSet<T> {
}

impl<T> IntoIterator for BTreeSet<T> {
type Iter = IntoIter<T>;
type IntoIter = IntoIter<T>;

fn into_iter(self) -> IntoIter<T> {
self.into_iter()
}
}

impl<'a, T> IntoIterator for &'a BTreeSet<T> {
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
Expand Down
6 changes: 3 additions & 3 deletions src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,23 +831,23 @@ impl<A> FromIterator<A> for DList<A> {
}

impl<T> IntoIterator for DList<T> {
type Iter = IntoIter<T>;
type IntoIter = IntoIter<T>;

fn into_iter(self) -> IntoIter<T> {
self.into_iter()
}
}

impl<'a, T> IntoIterator for &'a DList<T> {
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
}
}

impl<'a, T> IntoIterator for &'a mut DList<T> {
type Iter = IterMut<'a, T>;
type IntoIter = IterMut<'a, T>;

fn into_iter(mut self) -> IterMut<'a, T> {
self.iter_mut()
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl<E:CLike> FromIterator<E> for EnumSet<E> {
}

impl<'a, E> IntoIterator for &'a EnumSet<E> where E: CLike {
type Iter = Iter<E>;
type IntoIter = Iter<E>;

fn into_iter(self) -> Iter<E> {
self.iter()
Expand Down
6 changes: 3 additions & 3 deletions src/libcollections/ring_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1608,23 +1608,23 @@ impl<A> FromIterator<A> for RingBuf<A> {
}

impl<T> IntoIterator for RingBuf<T> {
type Iter = IntoIter<T>;
type IntoIter = IntoIter<T>;

fn into_iter(self) -> IntoIter<T> {
self.into_iter()
}
}

impl<'a, T> IntoIterator for &'a RingBuf<T> {
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
}
}

impl<'a, T> IntoIterator for &'a mut RingBuf<T> {
type Iter = IterMut<'a, T>;
type IntoIter = IterMut<'a, T>;

fn into_iter(mut self) -> IterMut<'a, T> {
self.iter_mut()
Expand Down
6 changes: 3 additions & 3 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,23 +1388,23 @@ impl<T> FromIterator<T> for Vec<T> {
}

impl<T> IntoIterator for Vec<T> {
type Iter = IntoIter<T>;
type IntoIter = IntoIter<T>;

fn into_iter(self) -> IntoIter<T> {
self.into_iter()
}
}

impl<'a, T> IntoIterator for &'a Vec<T> {
type Iter = slice::Iter<'a, T>;
type IntoIter = slice::Iter<'a, T>;

fn into_iter(self) -> slice::Iter<'a, T> {
self.iter()
}
}

impl<'a, T> IntoIterator for &'a mut Vec<T> {
type Iter = slice::IterMut<'a, T>;
type IntoIter = slice::IterMut<'a, T>;

fn into_iter(mut self) -> slice::IterMut<'a, T> {
self.iter_mut()
Expand Down
6 changes: 3 additions & 3 deletions src/libcollections/vec_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,23 +669,23 @@ impl<V> FromIterator<(usize, V)> for VecMap<V> {
}

impl<T> IntoIterator for VecMap<T> {
type Iter = IntoIter<T>;
type IntoIter = IntoIter<T>;

fn into_iter(self) -> IntoIter<T> {
self.into_iter()
}
}

impl<'a, T> IntoIterator for &'a VecMap<T> {
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
}
}

impl<'a, T> IntoIterator for &'a mut VecMap<T> {
type Iter = IterMut<'a, T>;
type IntoIter = IterMut<'a, T>;

fn into_iter(mut self) -> IterMut<'a, T> {
self.iter_mut()
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ macro_rules! array_impls {
}

impl<'a, T> IntoIterator for &'a [T; $N] {
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
}
}

impl<'a, T> IntoIterator for &'a mut [T; $N] {
type Iter = IterMut<'a, T>;
type IntoIter = IterMut<'a, T>;

fn into_iter(self) -> IterMut<'a, T> {
self.iter_mut()
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,15 @@ pub trait FromIterator<A> {

/// Conversion into an `Iterator`
pub trait IntoIterator {
type Iter: Iterator;
type IntoIter: Iterator;

/// Consumes `Self` and returns an iterator over it
fn into_iter(self) -> Self::Iter;
#[stable(feature = "rust1", since = "1.0.0")]
fn into_iter(self) -> Self::IntoIter;
}

impl<I> IntoIterator for I where I: Iterator {
type Iter = I;
type IntoIter = I;

fn into_iter(self) -> I {
self
Expand Down Expand Up @@ -967,10 +968,9 @@ pub trait IteratorExt: Iterator + Sized {
/// Creates an iterator that clones the elements it yields. Useful for converting an
/// Iterator<&T> to an Iterator<T>.
#[unstable(feature = "core", reason = "recent addition")]
fn cloned<T, D>(self) -> Cloned<Self> where
Self: Iterator<Item=D>,
D: Deref<Target=T>,
T: Clone,
fn cloned(self) -> Cloned<Self> where
Self::Item: Deref,
<Self::Item as Deref>::Output: Clone,
{
Cloned { it: self }
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,15 @@ impl<'a, T> Default for &'a [T] {
//

impl<'a, T> IntoIterator for &'a [T] {
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
}
}

impl<'a, T> IntoIterator for &'a mut [T] {
type Iter = IterMut<'a, T>;
type IntoIter = IterMut<'a, T>;

fn into_iter(self) -> IterMut<'a, T> {
self.iter_mut()
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S>
S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64>
{
type Iter = Iter<'a, K, V>;
type IntoIter = Iter<'a, K, V>;

fn into_iter(self) -> Iter<'a, K, V> {
self.iter()
Expand All @@ -1389,7 +1389,7 @@ impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S>
S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64>
{
type Iter = IterMut<'a, K, V>;
type IntoIter = IterMut<'a, K, V>;

fn into_iter(mut self) -> IterMut<'a, K, V> {
self.iter_mut()
Expand All @@ -1401,7 +1401,7 @@ impl<K, V, S, H> IntoIterator for HashMap<K, V, S>
S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64>
{
type Iter = IntoIter<K, V>;
type IntoIter = IntoIter<K, V>;

fn into_iter(self) -> IntoIter<K, V> {
self.into_iter()
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S>
S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64>
{
type Iter = Iter<'a, T>;
type IntoIter = Iter<'a, T>;

fn into_iter(self) -> Iter<'a, T> {
self.iter()
Expand All @@ -852,7 +852,7 @@ impl<T, S, H> IntoIterator for HashSet<T, S>
S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64>
{
type Iter = IntoIter<T>;
type IntoIter = IntoIter<T>;

fn into_iter(self) -> IntoIter<T> {
self.into_iter()
Expand Down