Skip to content

Commit

Permalink
Fallout from stabilization
Browse files Browse the repository at this point in the history
  • Loading branch information
aturon committed Nov 26, 2014
1 parent a86f72d commit b299c2b
Show file tree
Hide file tree
Showing 58 changed files with 105 additions and 103 deletions.
4 changes: 2 additions & 2 deletions src/libcollections/binary_heap.rs
Expand Up @@ -585,10 +585,10 @@ impl<T> DoubleEndedIterator<T> for MoveItems<T> {
fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
}

impl<T> ExactSize<T> for MoveItems<T> {}
impl<T> ExactSizeIterator<T> for MoveItems<T> {}

impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
fn from_iter<Iter: Iterator<T>>(mut iter: Iter) -> BinaryHeap<T> {
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> BinaryHeap<T> {
let vec: Vec<T> = iter.collect();
BinaryHeap::from_vec(vec)
}
Expand Down
12 changes: 6 additions & 6 deletions src/libcollections/bit.rs
Expand Up @@ -68,7 +68,7 @@ use core::prelude::*;
use core::cmp;
use core::default::Default;
use core::fmt;
use core::iter::{Chain, Enumerate, Repeat, Skip, Take};
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat};
use core::iter;
use core::num::Int;
use core::slice;
Expand All @@ -88,11 +88,11 @@ fn match_words <'a,'b>(a: &'a Bitv, b: &'b Bitv) -> (MatchWords<'a>, MatchWords<

// have to uselessly pretend to pad the longer one for type matching
if a_len < b_len {
(a.mask_words(0).chain(Repeat::new(0u32).enumerate().take(b_len).skip(a_len)),
b.mask_words(0).chain(Repeat::new(0u32).enumerate().take(0).skip(0)))
(a.mask_words(0).chain(repeat(0u32).enumerate().take(b_len).skip(a_len)),
b.mask_words(0).chain(repeat(0u32).enumerate().take(0).skip(0)))
} else {
(a.mask_words(0).chain(Repeat::new(0u32).enumerate().take(0).skip(0)),
b.mask_words(0).chain(Repeat::new(0u32).enumerate().take(a_len).skip(b_len)))
(a.mask_words(0).chain(repeat(0u32).enumerate().take(0).skip(0)),
b.mask_words(0).chain(repeat(0u32).enumerate().take(a_len).skip(b_len)))
}
}

Expand Down Expand Up @@ -943,7 +943,7 @@ impl<'a> DoubleEndedIterator<bool> for Bits<'a> {
}
}

impl<'a> ExactSize<bool> for Bits<'a> {}
impl<'a> ExactSizeIterator<bool> for Bits<'a> {}

impl<'a> RandomAccessIterator<bool> for Bits<'a> {
#[inline]
Expand Down
8 changes: 4 additions & 4 deletions src/libcollections/btree/map.rs
Expand Up @@ -863,7 +863,7 @@ impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
// Note that the design of these iterators permits an *arbitrary* initial pair of min and max,
// making these arbitrary sub-range iterators. However the logic to construct these paths
// efficiently is fairly involved, so this is a FIXME. The sub-range iterators also wouldn't be
// able to accurately predict size, so those iterators can't implement ExactSize.
// able to accurately predict size, so those iterators can't implement ExactSizeIterator.
fn next(&mut self) -> Option<(K, V)> {
loop {
// We want the smallest element, so try to get the top of the left stack
Expand Down Expand Up @@ -963,7 +963,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a V)> for Entries<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next_back() }
}
impl<'a, K, V> ExactSize<(&'a K, &'a V)> for Entries<'a, K, V> {}
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a V)> for Entries<'a, K, V> {}


impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
Expand All @@ -973,7 +973,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next_back() }
}
impl<'a, K, V> ExactSize<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {}
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {}


impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> {
Expand All @@ -983,7 +983,7 @@ impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> {
impl<K, V> DoubleEndedIterator<(K, V)> for MoveEntries<K, V> {
fn next_back(&mut self) -> Option<(K, V)> { self.inner.next_back() }
}
impl<K, V> ExactSize<(K, V)> for MoveEntries<K, V> {}
impl<K, V> ExactSizeIterator<(K, V)> for MoveEntries<K, V> {}



Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/dlist.rs
Expand Up @@ -607,7 +607,7 @@ impl<'a, A> DoubleEndedIterator<&'a A> for Items<'a, A> {
}
}

impl<'a, A> ExactSize<&'a A> for Items<'a, A> {}
impl<'a, A> ExactSizeIterator<&'a A> for Items<'a, A> {}

impl<'a, A> Iterator<&'a mut A> for MutItems<'a, A> {
#[inline]
Expand Down Expand Up @@ -645,7 +645,7 @@ impl<'a, A> DoubleEndedIterator<&'a mut A> for MutItems<'a, A> {
}
}

impl<'a, A> ExactSize<&'a mut A> for MutItems<'a, A> {}
impl<'a, A> ExactSizeIterator<&'a mut A> for MutItems<'a, A> {}

/// Allows mutating a `DList` while iterating.
pub trait ListInsertion<A> {
Expand Down
7 changes: 3 additions & 4 deletions src/libcollections/ring_buf.rs
Expand Up @@ -695,8 +695,7 @@ impl<'a, T> DoubleEndedIterator<&'a T> for Items<'a, T> {
}
}


impl<'a, T> ExactSize<&'a T> for Items<'a, T> {}
impl<'a, T> ExactSizeIterator<&'a T> for Items<'a, T> {}

impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
#[inline]
Expand Down Expand Up @@ -763,7 +762,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
}
}

impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {}
impl<'a, T> ExactSizeIterator<&'a mut T> for MutItems<'a, T> {}

impl<A: PartialEq> PartialEq for RingBuf<A> {
fn eq(&self, other: &RingBuf<A>) -> bool {
Expand Down Expand Up @@ -1322,7 +1321,7 @@ mod tests {
let u: Vec<int> = deq.iter().map(|&x| x).collect();
assert_eq!(u, v);

let mut seq = iter::count(0u, 2).take(256);
let seq = iter::count(0u, 2).take(256);
let deq: RingBuf<uint> = seq.collect();
for (i, &x) in deq.iter().enumerate() {
assert_eq!(2*i, x);
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/slice.rs
Expand Up @@ -94,7 +94,7 @@ use core::cmp;
use core::kinds::Sized;
use core::mem::size_of;
use core::mem;
use core::prelude::{Clone, Greater, Iterator, Less, None, Option};
use core::prelude::{Clone, Greater, Iterator, IteratorExt, Less, None, Option};
use core::prelude::{Ord, Ordering, RawPtr, Some, range};
use core::ptr;
use core::iter::{range_step, MultiplicativeIterator};
Expand Down
21 changes: 12 additions & 9 deletions src/libcollections/str.rs
Expand Up @@ -61,7 +61,7 @@ use core::cmp;
use core::iter::AdditiveIterator;
use core::kinds::Sized;
use core::prelude::{Char, Clone, Eq, Equiv};
use core::prelude::{Iterator, SlicePrelude, None, Option, Ord, Ordering};
use core::prelude::{Iterator, IteratorExt, SlicePrelude, None, Option, Ord, Ordering};
use core::prelude::{PartialEq, PartialOrd, Result, AsSlice, Some, Tuple2};
use core::prelude::{range};

Expand Down Expand Up @@ -794,7 +794,7 @@ mod tests {
use std::cmp::{Equal, Greater, Less, Ord, PartialOrd, Equiv};
use std::option::{Some, None};
use std::ptr::RawPtr;
use std::iter::{Iterator, DoubleEndedIterator};
use std::iter::{Iterator, IteratorExt, DoubleEndedIteratorExt};

use super::*;
use std::slice::{AsSlice, SlicePrelude};
Expand Down Expand Up @@ -2143,12 +2143,15 @@ mod tests {
let gr_inds = s.grapheme_indices(true).rev().collect::<Vec<(uint, &str)>>();
let b: &[_] = &[(11, "\r\n"), (6, "ö̲"), (3, "é"), (0u, "a̐")];
assert_eq!(gr_inds.as_slice(), b);
let mut gr_inds = s.grapheme_indices(true);
let e1 = gr_inds.size_hint();
assert_eq!(e1, (1, Some(13)));
let c = gr_inds.count();
assert_eq!(c, 4);
let e2 = gr_inds.size_hint();
let mut gr_inds_iter = s.grapheme_indices(true);
{
let gr_inds = gr_inds_iter.by_ref();
let e1 = gr_inds.size_hint();
assert_eq!(e1, (1, Some(13)));
let c = gr_inds.count();
assert_eq!(c, 4);
}
let e2 = gr_inds_iter.size_hint();
assert_eq!(e2, (0, Some(0)));

// make sure the reverse iterator does the right thing with "\n" at beginning of string
Expand Down Expand Up @@ -2285,7 +2288,7 @@ mod bench {
use test::Bencher;
use test::black_box;
use super::*;
use std::iter::{Iterator, DoubleEndedIterator};
use std::iter::{IteratorExt, DoubleEndedIteratorExt};
use std::str::StrPrelude;
use std::slice::SlicePrelude;

Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/vec.rs
Expand Up @@ -1319,7 +1319,7 @@ impl<T> DoubleEndedIterator<T> for MoveItems<T> {
}
}

impl<T> ExactSize<T> for MoveItems<T> {}
impl<T> ExactSizeIterator<T> for MoveItems<T> {}

#[unsafe_destructor]
impl<T> Drop for MoveItems<T> {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/float.rs
Expand Up @@ -17,7 +17,7 @@ pub use self::SignFormat::*;
use char;
use char::Char;
use fmt;
use iter::{range, DoubleEndedIterator};
use iter::{range, DoubleEndedIteratorExt};
use num::{Float, FPNaN, FPInfinite, ToPrimitive};
use num::cast;
use result::Ok;
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/mod.rs
Expand Up @@ -14,7 +14,7 @@

use any;
use cell::{Cell, Ref, RefMut};
use iter::{Iterator, range};
use iter::{Iterator, IteratorExt, range};
use kinds::{Copy, Sized};
use mem;
use option::{Option, Some, None};
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/num.rs
Expand Up @@ -15,7 +15,7 @@
#![allow(unsigned_negation)]

use fmt;
use iter::DoubleEndedIterator;
use iter::DoubleEndedIteratorExt;
use num::{Int, cast};
use slice::SlicePrelude;

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/num/mod.rs
Expand Up @@ -25,7 +25,7 @@ use clone::Clone;
use cmp::{PartialEq, Eq};
use cmp::{PartialOrd, Ord};
use intrinsics;
use iter::Iterator;
use iter::IteratorExt;
use kinds::Copy;
use mem::size_of;
use ops::{Add, Sub, Mul, Div, Rem, Neg};
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/option.rs
Expand Up @@ -147,7 +147,7 @@ pub use self::Option::*;

use cmp::{Eq, Ord};
use default::Default;
use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize};
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator};
use mem;
use result::{Result, Ok, Err};
use slice;
Expand Down Expand Up @@ -797,7 +797,7 @@ impl<A> DoubleEndedIterator<A> for Item<A> {
}
}

impl<A> ExactSize<A> for Item<A> {}
impl<A> ExactSizeIterator<A> for Item<A> {}

/////////////////////////////////////////////////////////////////////////////
// FromIterator
Expand Down
9 changes: 5 additions & 4 deletions src/libcore/prelude.rs
Expand Up @@ -39,7 +39,7 @@ pub use ops::{Slice, SliceMut};
pub use ops::{Fn, FnMut, FnOnce};

// Reexported functions
pub use iter::{range, repeat};
pub use iter::range;
pub use mem::drop;
pub use str::from_str;

Expand All @@ -50,9 +50,10 @@ pub use clone::Clone;
pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
pub use cmp::{Ordering, Equiv};
pub use cmp::Ordering::{Less, Equal, Greater};
pub use iter::{FromIterator, Extend};
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
pub use iter::{FromIterator, Extend, IteratorExt};
pub use iter::{Iterator, DoubleEndedIterator, DoubleEndedIteratorExt, RandomAccessIterator};
pub use iter::{IteratorCloneExt, CloneIteratorExt};
pub use iter::{IteratorOrdExt, MutableDoubleEndedIterator, ExactSizeIterator};
pub use num::{ToPrimitive, FromPrimitive};
pub use option::Option;
pub use option::Option::{Some, None};
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/result.rs
Expand Up @@ -235,7 +235,7 @@ pub use self::Result::*;
use std::fmt::Show;
use slice;
use slice::AsSlice;
use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize};
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator};
use option::{None, Option, Some};

/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
Expand Down Expand Up @@ -831,7 +831,7 @@ impl<A> DoubleEndedIterator<A> for Item<A> {
}
}

impl<A> ExactSize<A> for Item<A> {}
impl<A> ExactSizeIterator<A> for Item<A> {}

/////////////////////////////////////////////////////////////////////////////
// FromIterator
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/slice.rs
Expand Up @@ -1160,7 +1160,7 @@ impl<'a, T> Items<'a, T> {
iterator!{struct Items -> *const T, &'a T}

#[experimental = "needs review"]
impl<'a, T> ExactSize<&'a T> for Items<'a, T> {}
impl<'a, T> ExactSizeIterator<&'a T> for Items<'a, T> {}

#[experimental = "needs review"]
impl<'a, T> Clone for Items<'a, T> {
Expand Down Expand Up @@ -1255,7 +1255,7 @@ impl<'a, T> MutItems<'a, T> {
iterator!{struct MutItems -> *mut T, &'a mut T}

#[experimental = "needs review"]
impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {}
impl<'a, T> ExactSizeIterator<&'a mut T> for MutItems<'a, T> {}

/// An abstraction over the splitting iterators, so that splitn, splitn_mut etc
/// can be implemented once.
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/str.rs
Expand Up @@ -23,9 +23,9 @@ use char::Char;
use char;
use cmp::{Eq, mod};
use default::Default;
use iter::{Map, Iterator, IteratorExt, DoubleEndedIterator};
use iter::{DoubleEndedIteratorExt, ExactSizeIterator};
use iter::range;
use iter::{DoubleEndedIterator, ExactSize};
use iter::{Map, Iterator};
use kinds::Sized;
use mem;
use num::Int;
Expand Down Expand Up @@ -1210,7 +1210,7 @@ Section: Trait implementations
#[allow(missing_docs)]
pub mod traits {
use cmp::{Ord, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, Eq};
use iter::Iterator;
use iter::IteratorExt;
use option::{Option, Some};
use ops;
use str::{Str, StrPrelude, eq_slice};
Expand Down
2 changes: 1 addition & 1 deletion src/libgetopts/lib.rs
Expand Up @@ -710,7 +710,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {

let desc_sep = format!("\n{}", " ".repeat(24));

let mut rows = opts.iter().map(|optref| {
let rows = opts.iter().map(|optref| {
let OptGroup{short_name,
long_name,
hint,
Expand Down
6 changes: 3 additions & 3 deletions src/librand/isaac.rs
Expand Up @@ -11,8 +11,8 @@
//! The ISAAC random number generator.

use core::prelude::*;
use core::iter::{range_step, Repeat};
use core::slice;
use core::iter::{range_step, repeat};

use {Rng, SeedableRng, Rand};

Expand Down Expand Up @@ -205,7 +205,7 @@ impl<'a> SeedableRng<&'a [u32]> for IsaacRng {
fn reseed(&mut self, seed: &'a [u32]) {
// make the seed into [seed[0], seed[1], ..., seed[seed.len()
// - 1], 0, 0, ...], to fill rng.rsl.
let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u32));
let seed_iter = seed.iter().map(|&x| x).chain(repeat(0u32));

for (rsl_elem, seed_elem) in self.rsl.iter_mut().zip(seed_iter) {
*rsl_elem = seed_elem;
Expand Down Expand Up @@ -438,7 +438,7 @@ impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng {
fn reseed(&mut self, seed: &'a [u64]) {
// make the seed into [seed[0], seed[1], ..., seed[seed.len()
// - 1], 0, 0, ...], to fill rng.rsl.
let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u64));
let seed_iter = seed.iter().map(|&x| x).chain(repeat(0u64));

for (rsl_elem, seed_elem) in self.rsl.iter_mut().zip(seed_iter) {
*rsl_elem = seed_elem;
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/cfg/construct.rs
Expand Up @@ -154,7 +154,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
pats: I,
pred: CFGIndex) -> CFGIndex {
//! Handles case where all of the patterns must match.
let mut pats = pats;
pats.fold(pred, |pred, pat| self.pat(&**pat, pred))
}

Expand Down Expand Up @@ -527,7 +526,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
}

fn exprs<'a, I: Iterator<&'a ast::Expr>>(&mut self,
mut exprs: I,
exprs: I,
pred: CFGIndex) -> CFGIndex {
//! Constructs graph for `exprs` evaluated in order
exprs.fold(pred, |p, e| self.expr(e, p))
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/check_match.rs
Expand Up @@ -93,7 +93,7 @@ impl<'a> fmt::Show for Matrix<'a> {
}

impl<'a> FromIterator<Vec<&'a Pat>> for Matrix<'a> {
fn from_iter<T: Iterator<Vec<&'a Pat>>>(mut iterator: T) -> Matrix<'a> {
fn from_iter<T: Iterator<Vec<&'a Pat>>>(iterator: T) -> Matrix<'a> {
Matrix(iterator.collect())
}
}
Expand Down Expand Up @@ -1091,4 +1091,3 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for AtBindingPatternVisitor<'a, 'b, 'tcx> {
}
}
}

9 comments on commit b299c2b

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at aturon@b299c2b

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging aturon/rust/stab-iter = b299c2b into auto

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aturon/rust/stab-iter = b299c2b merged ok, testing candidate = 7bfa6917

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at aturon@b299c2b

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging aturon/rust/stab-iter = b299c2b into auto

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aturon/rust/stab-iter = b299c2b merged ok, testing candidate = 1a44875

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on b299c2b Nov 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 1a44875

Please sign in to comment.