提交 c89de2c5 编写于 作者: B bors

Auto merge of #23300 - sfackler:rm-iterator-ext, r=alexcrichton

All methods are inlined into Iterator with `Self: Sized` bounds to make
sure Iterator is still object safe.

[breaking-change]

This is blocked on ICEs: https://gist.github.com/sfackler/5aff7c57cf8d896e2c6f
Seem to be similar to #23281.
...@@ -951,7 +951,7 @@ fn hash<H: Hasher>(&self, state: &mut H) { ...@@ -951,7 +951,7 @@ fn hash<H: Hasher>(&self, state: &mut H) {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::clone::Clone; use std::clone::Clone;
use std::iter::{Iterator, IteratorExt}; use std::iter::Iterator;
use std::option::Option::{Some, None, self}; use std::option::Option::{Some, None, self};
use std::rand; use std::rand;
use std::thread; use std::thread;
......
...@@ -76,7 +76,6 @@ ...@@ -76,7 +76,6 @@
//! iterators. //! iterators.
//! * Further methods that return iterators are `.split()`, `.splitn()`, //! * Further methods that return iterators are `.split()`, `.splitn()`,
//! `.chunks()`, `.windows()` and more. //! `.chunks()`, `.windows()` and more.
#![doc(primitive = "slice")] #![doc(primitive = "slice")]
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
...@@ -85,7 +84,7 @@ ...@@ -85,7 +84,7 @@
use core::clone::Clone; use core::clone::Clone;
use core::cmp::Ordering::{self, Greater, Less}; use core::cmp::Ordering::{self, Greater, Less};
use core::cmp::{self, Ord, PartialEq}; use core::cmp::{self, Ord, PartialEq};
use core::iter::{Iterator, IteratorExt}; use core::iter::Iterator;
use core::iter::MultiplicativeIterator; use core::iter::MultiplicativeIterator;
use core::marker::Sized; use core::marker::Sized;
use core::mem::size_of; use core::mem::size_of;
...@@ -131,7 +130,7 @@ mod hack { ...@@ -131,7 +130,7 @@ mod hack {
use alloc::boxed::Box; use alloc::boxed::Box;
use core::clone::Clone; use core::clone::Clone;
#[cfg(test)] #[cfg(test)]
use core::iter::{Iterator, IteratorExt}; use core::iter::Iterator;
use core::mem; use core::mem;
#[cfg(test)] #[cfg(test)]
use core::option::Option::{Some, None}; use core::option::Option::{Some, None};
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
use core::clone::Clone; use core::clone::Clone;
use core::iter::AdditiveIterator; use core::iter::AdditiveIterator;
use core::iter::{Iterator, IteratorExt, Extend}; use core::iter::{Iterator, Extend};
use core::option::Option::{self, Some, None}; use core::option::Option::{self, Some, None};
use core::result::Result; use core::result::Result;
use core::str as core_str; use core::str as core_str;
......
...@@ -1785,7 +1785,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ...@@ -1785,7 +1785,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use core::iter::{IteratorExt, self}; use core::iter::{Iterator, self};
use core::option::Option::Some; use core::option::Option::Some;
use test; use test;
......
...@@ -66,7 +66,7 @@ pub fn $name(b: &mut ::test::Bencher) { ...@@ -66,7 +66,7 @@ pub fn $name(b: &mut ::test::Bencher) {
($name: ident, $n: expr, $map: ident) => ( ($name: ident, $n: expr, $map: ident) => (
#[bench] #[bench]
pub fn $name(b: &mut ::test::Bencher) { pub fn $name(b: &mut ::test::Bencher) {
use std::iter::IteratorExt; use std::iter::Iterator;
use std::rand::Rng; use std::rand::Rng;
use std::rand; use std::rand;
use std::vec::Vec; use std::vec::Vec;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
use char; use char;
use char::CharExt; use char::CharExt;
use fmt; use fmt;
use iter::IteratorExt; use iter::Iterator;
use num::{cast, Float, ToPrimitive}; use num::{cast, Float, ToPrimitive};
use num::FpCategory as Fp; use num::FpCategory as Fp;
use ops::FnOnce; use ops::FnOnce;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
use any; use any;
use cell::{Cell, RefCell, Ref, RefMut, BorrowState}; use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
use char::CharExt; use char::CharExt;
use iter::{Iterator, IteratorExt}; use iter::Iterator;
use marker::{Copy, PhantomData, Sized}; use marker::{Copy, PhantomData, Sized};
use mem; use mem;
use option::Option; use option::Option;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#![allow(unsigned_negation)] #![allow(unsigned_negation)]
use fmt; use fmt;
use iter::IteratorExt; use iter::Iterator;
use num::{Int, cast}; use num::{Int, cast};
use slice::SliceExt; use slice::SliceExt;
use str; use str;
......
...@@ -71,6 +71,8 @@ ...@@ -71,6 +71,8 @@
use marker::Sized; use marker::Sized;
use usize; use usize;
fn _assert_is_object_safe(_: &Iterator) {}
/// An interface for dealing with "external iterators". These types of iterators /// An interface for dealing with "external iterators". These types of iterators
/// can be resumed at any time as all state is stored internally as opposed to /// can be resumed at any time as all state is stored internally as opposed to
/// being located on the call stack. /// being located on the call stack.
...@@ -101,62 +103,7 @@ pub trait Iterator { ...@@ -101,62 +103,7 @@ pub trait Iterator {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn size_hint(&self) -> (usize, Option<usize>) { (0, None) } fn size_hint(&self) -> (usize, Option<usize>) { (0, None) }
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I {
type Item = I::Item;
fn next(&mut self) -> Option<I::Item> { (**self).next() }
fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() }
}
/// Conversion from an `Iterator`
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
built from an iterator over elements of type `{A}`"]
pub trait FromIterator<A> {
/// Build a container with elements from something iterable.
#[stable(feature = "rust1", since = "1.0.0")]
fn from_iter<T: IntoIterator<Item=A>>(iterator: T) -> Self;
}
/// Conversion into an `Iterator`
#[stable(feature = "rust1", since = "1.0.0")]
pub trait IntoIterator {
/// The type of the elements being iterated
#[stable(feature = "rust1", since = "1.0.0")]
type Item;
/// A container for iterating over elements of type Item
#[stable(feature = "rust1", since = "1.0.0")]
type IntoIter: Iterator<Item=Self::Item>;
/// Consumes `Self` and returns an iterator over it
#[stable(feature = "rust1", since = "1.0.0")]
fn into_iter(self) -> Self::IntoIter;
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<I: Iterator> IntoIterator for I {
type Item = I::Item;
type IntoIter = I;
fn into_iter(self) -> I {
self
}
}
/// A type growable from an `Iterator` implementation
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Extend<A> {
/// Extend a container with the elements yielded by an arbitrary iterator
#[stable(feature = "rust1", since = "1.0.0")]
fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T);
}
/// An extension trait providing numerous methods applicable to all iterators.
#[stable(feature = "rust1", since = "1.0.0")]
pub trait IteratorExt: Iterator + Sized {
/// Counts the number of elements in this iterator. /// Counts the number of elements in this iterator.
/// ///
/// # Examples /// # Examples
...@@ -167,7 +114,7 @@ pub trait IteratorExt: Iterator + Sized { ...@@ -167,7 +114,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn count(self) -> usize { fn count(self) -> usize where Self: Sized {
self.fold(0, |cnt, _x| cnt + 1) self.fold(0, |cnt, _x| cnt + 1)
} }
...@@ -181,7 +128,7 @@ fn count(self) -> usize { ...@@ -181,7 +128,7 @@ fn count(self) -> usize {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn last(self) -> Option<Self::Item> { fn last(self) -> Option<Self::Item> where Self: Sized {
let mut last = None; let mut last = None;
for x in self { last = Some(x); } for x in self { last = Some(x); }
last last
...@@ -200,7 +147,7 @@ fn last(self) -> Option<Self::Item> { ...@@ -200,7 +147,7 @@ fn last(self) -> Option<Self::Item> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn nth(&mut self, mut n: usize) -> Option<Self::Item> { fn nth(&mut self, mut n: usize) -> Option<Self::Item> where Self: Sized {
for x in self.by_ref() { for x in self.by_ref() {
if n == 0 { return Some(x) } if n == 0 { return Some(x) }
n -= 1; n -= 1;
...@@ -225,7 +172,7 @@ fn nth(&mut self, mut n: usize) -> Option<Self::Item> { ...@@ -225,7 +172,7 @@ fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn chain<U>(self, other: U) -> Chain<Self, U> where fn chain<U>(self, other: U) -> Chain<Self, U> where
U: Iterator<Item=Self::Item>, Self: Sized, U: Iterator<Item=Self::Item>,
{ {
Chain{a: self, b: other, flag: false} Chain{a: self, b: other, flag: false}
} }
...@@ -260,7 +207,7 @@ fn chain<U>(self, other: U) -> Chain<Self, U> where ...@@ -260,7 +207,7 @@ fn chain<U>(self, other: U) -> Chain<Self, U> where
/// both produce the same output. /// both produce the same output.
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> { fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> where Self: Sized {
Zip{a: self, b: other} Zip{a: self, b: other}
} }
...@@ -279,7 +226,7 @@ fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> { ...@@ -279,7 +226,7 @@ fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn map<B, F>(self, f: F) -> Map<Self, F> where fn map<B, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> B, Self: Sized, F: FnMut(Self::Item) -> B,
{ {
Map{iter: self, f: f} Map{iter: self, f: f}
} }
...@@ -299,7 +246,7 @@ fn map<B, F>(self, f: F) -> Map<Self, F> where ...@@ -299,7 +246,7 @@ fn map<B, F>(self, f: F) -> Map<Self, F> where
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn filter<P>(self, predicate: P) -> Filter<Self, P> where fn filter<P>(self, predicate: P) -> Filter<Self, P> where
P: FnMut(&Self::Item) -> bool, Self: Sized, P: FnMut(&Self::Item) -> bool,
{ {
Filter{iter: self, predicate: predicate} Filter{iter: self, predicate: predicate}
} }
...@@ -319,7 +266,7 @@ fn filter<P>(self, predicate: P) -> Filter<Self, P> where ...@@ -319,7 +266,7 @@ fn filter<P>(self, predicate: P) -> Filter<Self, P> where
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
F: FnMut(Self::Item) -> Option<B>, Self: Sized, F: FnMut(Self::Item) -> Option<B>,
{ {
FilterMap { iter: self, f: f } FilterMap { iter: self, f: f }
} }
...@@ -341,7 +288,7 @@ fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where ...@@ -341,7 +288,7 @@ fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn enumerate(self) -> Enumerate<Self> { fn enumerate(self) -> Enumerate<Self> where Self: Sized {
Enumerate{iter: self, count: 0} Enumerate{iter: self, count: 0}
} }
...@@ -365,7 +312,7 @@ fn enumerate(self) -> Enumerate<Self> { ...@@ -365,7 +312,7 @@ fn enumerate(self) -> Enumerate<Self> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn peekable(self) -> Peekable<Self> { fn peekable(self) -> Peekable<Self> where Self: Sized {
Peekable{iter: self, peeked: None} Peekable{iter: self, peeked: None}
} }
...@@ -386,7 +333,7 @@ fn peekable(self) -> Peekable<Self> { ...@@ -386,7 +333,7 @@ fn peekable(self) -> Peekable<Self> {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
P: FnMut(&Self::Item) -> bool, Self: Sized, P: FnMut(&Self::Item) -> bool,
{ {
SkipWhile{iter: self, flag: false, predicate: predicate} SkipWhile{iter: self, flag: false, predicate: predicate}
} }
...@@ -407,7 +354,7 @@ fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where ...@@ -407,7 +354,7 @@ fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
P: FnMut(&Self::Item) -> bool, Self: Sized, P: FnMut(&Self::Item) -> bool,
{ {
TakeWhile{iter: self, flag: false, predicate: predicate} TakeWhile{iter: self, flag: false, predicate: predicate}
} }
...@@ -426,7 +373,7 @@ fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where ...@@ -426,7 +373,7 @@ fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn skip(self, n: usize) -> Skip<Self> { fn skip(self, n: usize) -> Skip<Self> where Self: Sized {
Skip{iter: self, n: n} Skip{iter: self, n: n}
} }
...@@ -445,7 +392,7 @@ fn skip(self, n: usize) -> Skip<Self> { ...@@ -445,7 +392,7 @@ fn skip(self, n: usize) -> Skip<Self> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn take(self, n: usize) -> Take<Self> { fn take(self, n: usize) -> Take<Self> where Self: Sized, {
Take{iter: self, n: n} Take{iter: self, n: n}
} }
...@@ -472,7 +419,7 @@ fn take(self, n: usize) -> Take<Self> { ...@@ -472,7 +419,7 @@ fn take(self, n: usize) -> Take<Self> {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where F: FnMut(&mut St, Self::Item) -> Option<B>, where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,
{ {
Scan{iter: self, f: f, state: initial_state} Scan{iter: self, f: f, state: initial_state}
} }
...@@ -495,7 +442,7 @@ fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> ...@@ -495,7 +442,7 @@ fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where U: Iterator, F: FnMut(Self::Item) -> U, where Self: Sized, U: Iterator, F: FnMut(Self::Item) -> U,
{ {
FlatMap{iter: self, f: f, frontiter: None, backiter: None } FlatMap{iter: self, f: f, frontiter: None, backiter: None }
} }
...@@ -529,7 +476,7 @@ fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> ...@@ -529,7 +476,7 @@ fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn fuse(self) -> Fuse<Self> { fn fuse(self) -> Fuse<Self> where Self: Sized {
Fuse{iter: self, done: false} Fuse{iter: self, done: false}
} }
...@@ -555,7 +502,7 @@ fn fuse(self) -> Fuse<Self> { ...@@ -555,7 +502,7 @@ fn fuse(self) -> Fuse<Self> {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn inspect<F>(self, f: F) -> Inspect<Self, F> where fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnMut(&Self::Item), Self: Sized, F: FnMut(&Self::Item),
{ {
Inspect{iter: self, f: f} Inspect{iter: self, f: f}
} }
...@@ -575,7 +522,7 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F> where ...@@ -575,7 +522,7 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F> where
/// assert!(it.next() == Some(5)); /// assert!(it.next() == Some(5));
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn by_ref(&mut self) -> &mut Self { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Loops through the entire iterator, collecting all of the elements into /// Loops through the entire iterator, collecting all of the elements into
/// a container implementing `FromIterator`. /// a container implementing `FromIterator`.
...@@ -590,7 +537,7 @@ fn by_ref(&mut self) -> &mut Self { self } ...@@ -590,7 +537,7 @@ fn by_ref(&mut self) -> &mut Self { self }
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn collect<B: FromIterator<Self::Item>>(self) -> B { fn collect<B: FromIterator<Self::Item>>(self) -> B where Self: Sized {
FromIterator::from_iter(self) FromIterator::from_iter(self)
} }
...@@ -609,6 +556,7 @@ fn collect<B: FromIterator<Self::Item>>(self) -> B { ...@@ -609,6 +556,7 @@ fn collect<B: FromIterator<Self::Item>>(self) -> B {
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "recently added as part of collections reform")] reason = "recently added as part of collections reform")]
fn partition<B, F>(self, mut f: F) -> (B, B) where fn partition<B, F>(self, mut f: F) -> (B, B) where
Self: Sized,
B: Default + Extend<Self::Item>, B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool F: FnMut(&Self::Item) -> bool
{ {
...@@ -638,7 +586,7 @@ fn partition<B, F>(self, mut f: F) -> (B, B) where ...@@ -638,7 +586,7 @@ fn partition<B, F>(self, mut f: F) -> (B, B) where
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn fold<B, F>(self, init: B, mut f: F) -> B where fn fold<B, F>(self, init: B, mut f: F) -> B where
F: FnMut(B, Self::Item) -> B, Self: Sized, F: FnMut(B, Self::Item) -> B,
{ {
let mut accum = init; let mut accum = init;
for x in self { for x in self {
...@@ -658,7 +606,9 @@ fn fold<B, F>(self, init: B, mut f: F) -> B where ...@@ -658,7 +606,9 @@ fn fold<B, F>(self, init: B, mut f: F) -> B where
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn all<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { fn all<F>(&mut self, mut f: F) -> bool where
Self: Sized, F: FnMut(Self::Item) -> bool
{
for x in self.by_ref() { if !f(x) { return false; } } for x in self.by_ref() { if !f(x) { return false; } }
true true
} }
...@@ -679,7 +629,10 @@ fn all<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { ...@@ -679,7 +629,10 @@ fn all<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { fn any<F>(&mut self, mut f: F) -> bool where
Self: Sized,
F: FnMut(Self::Item) -> bool
{
for x in self.by_ref() { if f(x) { return true; } } for x in self.by_ref() { if f(x) { return true; } }
false false
} }
...@@ -699,6 +652,7 @@ fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { ...@@ -699,6 +652,7 @@ fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
Self: Sized,
P: FnMut(&Self::Item) -> bool, P: FnMut(&Self::Item) -> bool,
{ {
for x in self.by_ref() { for x in self.by_ref() {
...@@ -722,6 +676,7 @@ fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where ...@@ -722,6 +676,7 @@ fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn position<P>(&mut self, mut predicate: P) -> Option<usize> where fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
Self: Sized,
P: FnMut(Self::Item) -> bool, P: FnMut(Self::Item) -> bool,
{ {
let mut i = 0; let mut i = 0;
...@@ -752,7 +707,7 @@ fn position<P>(&mut self, mut predicate: P) -> Option<usize> where ...@@ -752,7 +707,7 @@ fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where
P: FnMut(Self::Item) -> bool, P: FnMut(Self::Item) -> bool,
Self: ExactSizeIterator + DoubleEndedIterator Self: Sized + ExactSizeIterator + DoubleEndedIterator
{ {
let mut i = self.len(); let mut i = self.len();
...@@ -775,7 +730,7 @@ fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where ...@@ -775,7 +730,7 @@ fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn max(self) -> Option<Self::Item> where Self::Item: Ord fn max(self) -> Option<Self::Item> where Self: Sized, Self::Item: Ord
{ {
self.fold(None, |max, x| { self.fold(None, |max, x| {
match max { match max {
...@@ -795,7 +750,7 @@ fn max(self) -> Option<Self::Item> where Self::Item: Ord ...@@ -795,7 +750,7 @@ fn max(self) -> Option<Self::Item> where Self::Item: Ord
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn min(self) -> Option<Self::Item> where Self::Item: Ord fn min(self) -> Option<Self::Item> where Self: Sized, Self::Item: Ord
{ {
self.fold(None, |min, x| { self.fold(None, |min, x| {
match min { match min {
...@@ -837,7 +792,7 @@ fn min(self) -> Option<Self::Item> where Self::Item: Ord ...@@ -837,7 +792,7 @@ fn min(self) -> Option<Self::Item> where Self::Item: Ord
/// assert!(a.iter().min_max() == MinMax(&1, &1)); /// assert!(a.iter().min_max() == MinMax(&1, &1));
/// ``` /// ```
#[unstable(feature = "core", reason = "return type may change")] #[unstable(feature = "core", reason = "return type may change")]
fn min_max(mut self) -> MinMaxResult<Self::Item> where Self::Item: Ord fn min_max(mut self) -> MinMaxResult<Self::Item> where Self: Sized, Self::Item: Ord
{ {
let (mut min, mut max) = match self.next() { let (mut min, mut max) = match self.next() {
None => return NoElements, None => return NoElements,
...@@ -897,6 +852,7 @@ fn min_max(mut self) -> MinMaxResult<Self::Item> where Self::Item: Ord ...@@ -897,6 +852,7 @@ fn min_max(mut self) -> MinMaxResult<Self::Item> where Self::Item: Ord
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "may want to produce an Ordering directly; see #15311")] reason = "may want to produce an Ordering directly; see #15311")]
fn max_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where fn max_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
Self: Sized,
F: FnMut(&Self::Item) -> B, F: FnMut(&Self::Item) -> B,
{ {
self.fold(None, |max: Option<(Self::Item, B)>, x| { self.fold(None, |max: Option<(Self::Item, B)>, x| {
...@@ -928,6 +884,7 @@ fn max_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where ...@@ -928,6 +884,7 @@ fn max_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "may want to produce an Ordering directly; see #15311")] reason = "may want to produce an Ordering directly; see #15311")]
fn min_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where fn min_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
Self: Sized,
F: FnMut(&Self::Item) -> B, F: FnMut(&Self::Item) -> B,
{ {
self.fold(None, |min: Option<(Self::Item, B)>, x| { self.fold(None, |min: Option<(Self::Item, B)>, x| {
...@@ -957,7 +914,7 @@ fn min_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where ...@@ -957,7 +914,7 @@ fn min_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
/// `std::usize::MAX` elements of the original iterator. /// `std::usize::MAX` elements of the original iterator.
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn rev(self) -> Rev<Self> { fn rev(self) -> Rev<Self> where Self: Sized {
Rev{iter: self} Rev{iter: self}
} }
...@@ -979,7 +936,7 @@ fn rev(self) -> Rev<Self> { ...@@ -979,7 +936,7 @@ fn rev(self) -> Rev<Self> {
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
FromA: Default + Extend<A>, FromA: Default + Extend<A>,
FromB: Default + Extend<B>, FromB: Default + Extend<B>,
Self: Iterator<Item=(A, B)>, Self: Sized + Iterator<Item=(A, B)>,
{ {
struct SizeHint<A>(usize, Option<usize>, marker::PhantomData<A>); struct SizeHint<A>(usize, Option<usize>, marker::PhantomData<A>);
impl<A> Iterator for SizeHint<A> { impl<A> Iterator for SizeHint<A> {
...@@ -1010,7 +967,7 @@ fn size_hint(&self) -> (usize, Option<usize>) { ...@@ -1010,7 +967,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
/// converting an Iterator<&T> to an Iterator<T>. /// converting an Iterator<&T> to an Iterator<T>.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn cloned<'a, T: 'a>(self) -> Cloned<Self> fn cloned<'a, T: 'a>(self) -> Cloned<Self>
where Self: Iterator<Item=&'a T>, T: Clone where Self: Sized + Iterator<Item=&'a T>, T: Clone
{ {
Cloned { it: self } Cloned { it: self }
} }
...@@ -1028,7 +985,7 @@ fn cloned<'a, T: 'a>(self) -> Cloned<Self> ...@@ -1028,7 +985,7 @@ fn cloned<'a, T: 'a>(self) -> Cloned<Self>
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
fn cycle(self) -> Cycle<Self> where Self: Clone { fn cycle(self) -> Cycle<Self> where Self: Sized + Clone {
Cycle{orig: self.clone(), iter: self} Cycle{orig: self.clone(), iter: self}
} }
...@@ -1036,7 +993,7 @@ fn cycle(self) -> Cycle<Self> where Self: Clone { ...@@ -1036,7 +993,7 @@ fn cycle(self) -> Cycle<Self> where Self: Clone {
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "uncertain about placement or widespread use")] reason = "uncertain about placement or widespread use")]
fn reverse_in_place<'a, T: 'a>(&mut self) where fn reverse_in_place<'a, T: 'a>(&mut self) where
Self: Iterator<Item=&'a mut T> + DoubleEndedIterator Self: Sized + Iterator<Item=&'a mut T> + DoubleEndedIterator
{ {
loop { loop {
match (self.next(), self.next_back()) { match (self.next(), self.next_back()) {
...@@ -1048,7 +1005,55 @@ fn reverse_in_place<'a, T: 'a>(&mut self) where ...@@ -1048,7 +1005,55 @@ fn reverse_in_place<'a, T: 'a>(&mut self) where
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<I> IteratorExt for I where I: Iterator {} impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I {
type Item = I::Item;
fn next(&mut self) -> Option<I::Item> { (**self).next() }
fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() }
}
/// Conversion from an `Iterator`
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
built from an iterator over elements of type `{A}`"]
pub trait FromIterator<A> {
/// Build a container with elements from something iterable.
#[stable(feature = "rust1", since = "1.0.0")]
fn from_iter<T: IntoIterator<Item=A>>(iterator: T) -> Self;
}
/// Conversion into an `Iterator`
#[stable(feature = "rust1", since = "1.0.0")]
pub trait IntoIterator {
/// The type of the elements being iterated
#[stable(feature = "rust1", since = "1.0.0")]
type Item;
/// A container for iterating over elements of type Item
#[stable(feature = "rust1", since = "1.0.0")]
type IntoIter: Iterator<Item=Self::Item>;
/// Consumes `Self` and returns an iterator over it
#[stable(feature = "rust1", since = "1.0.0")]
fn into_iter(self) -> Self::IntoIter;
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<I: Iterator> IntoIterator for I {
type Item = I::Item;
type IntoIter = I;
fn into_iter(self) -> I {
self
}
}
/// A type growable from an `Iterator` implementation
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Extend<A> {
/// Extend a container with the elements yielded by an arbitrary iterator
#[stable(feature = "rust1", since = "1.0.0")]
fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T);
}
/// A range iterator able to yield elements from both ends /// A range iterator able to yield elements from both ends
/// ///
...@@ -1256,7 +1261,7 @@ fn product(self) -> $A { ...@@ -1256,7 +1261,7 @@ fn product(self) -> $A {
impl_multiplicative! { f32, 1.0 } impl_multiplicative! { f32, 1.0 }
impl_multiplicative! { f64, 1.0 } impl_multiplicative! { f64, 1.0 }
/// `MinMaxResult` is an enum returned by `min_max`. See `IteratorOrdExt::min_max` for more detail. /// `MinMaxResult` is an enum returned by `min_max`. See `Iterator::min_max` for more detail.
#[derive(Clone, PartialEq, Debug)] #[derive(Clone, PartialEq, Debug)]
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "unclear whether such a fine-grained result is widely useful")] reason = "unclear whether such a fine-grained result is widely useful")]
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
use error::Error; use error::Error;
use fmt; use fmt;
use intrinsics; use intrinsics;
use iter::IteratorExt; use iter::Iterator;
use marker::Copy; use marker::Copy;
use mem::size_of; use mem::size_of;
use ops::{Add, Sub, Mul, Div, Rem, Neg}; use ops::{Add, Sub, Mul, Div, Rem, Neg};
......
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
use cmp::{Eq, Ord}; use cmp::{Eq, Ord};
use default::Default; use default::Default;
use iter::ExactSizeIterator; use iter::ExactSizeIterator;
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, IntoIterator}; use iter::{Iterator, DoubleEndedIterator, FromIterator, IntoIterator};
use mem; use mem;
use ops::FnOnce; use ops::FnOnce;
use result::Result::{Ok, Err}; use result::Result::{Ok, Err};
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
pub use clone::Clone; pub use clone::Clone;
pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
pub use convert::{AsRef, AsMut, Into, From}; pub use convert::{AsRef, AsMut, Into, From};
pub use iter::{Extend, IteratorExt}; pub use iter::Extend;
pub use iter::{Iterator, DoubleEndedIterator}; pub use iter::{Iterator, DoubleEndedIterator};
pub use iter::{ExactSizeIterator}; pub use iter::{ExactSizeIterator};
pub use option::Option::{self, Some, None}; pub use option::Option::{self, Some, None};
......
...@@ -243,8 +243,7 @@ ...@@ -243,8 +243,7 @@
use clone::Clone; use clone::Clone;
use fmt; use fmt;
use iter::{Iterator, IteratorExt, DoubleEndedIterator, use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSizeIterator, IntoIterator};
FromIterator, ExactSizeIterator, IntoIterator};
use ops::{FnMut, FnOnce}; use ops::{FnMut, FnOnce};
use option::Option::{self, None, Some}; use option::Option::{self, None, Some};
#[allow(deprecated)] #[allow(deprecated)]
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
use error::Error; use error::Error;
use fmt; use fmt;
use iter::ExactSizeIterator; use iter::ExactSizeIterator;
use iter::{Map, Iterator, IteratorExt, DoubleEndedIterator}; use iter::{Map, Iterator, DoubleEndedIterator};
use marker::Sized; use marker::Sized;
use mem; use mem;
#[allow(deprecated)] #[allow(deprecated)]
...@@ -1237,7 +1237,7 @@ pub struct CharRange { ...@@ -1237,7 +1237,7 @@ pub struct CharRange {
mod traits { mod traits {
use cmp::{Ordering, Ord, PartialEq, PartialOrd, Eq}; use cmp::{Ordering, Ord, PartialEq, PartialOrd, Eq};
use cmp::Ordering::{Less, Equal, Greater}; use cmp::Ordering::{Less, Equal, Greater};
use iter::IteratorExt; use iter::Iterator;
use option::Option; use option::Option;
use option::Option::Some; use option::Option::Some;
use ops; use ops;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
use default::Default; use default::Default;
use fmt::{self, Debug}; use fmt::{self, Debug};
use hash::{Hash, SipHasher}; use hash::{Hash, SipHasher};
use iter::{self, Iterator, ExactSizeIterator, IntoIterator, IteratorExt, FromIterator, Extend, Map}; use iter::{self, Iterator, ExactSizeIterator, IntoIterator, FromIterator, Extend, Map};
use marker::Sized; use marker::Sized;
use mem::{self, replace}; use mem::{self, replace};
use ops::{Deref, FnMut, FnOnce, Index}; use ops::{Deref, FnMut, FnOnce, Index};
......
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
use fmt::Debug; use fmt::Debug;
use fmt; use fmt;
use hash::Hash; use hash::Hash;
use iter::{ use iter::{Iterator, IntoIterator, ExactSizeIterator, FromIterator, Map, Chain, Extend};
Iterator, IntoIterator, ExactSizeIterator, IteratorExt, FromIterator, Map, Chain, Extend,
};
use ops::{BitOr, BitAnd, BitXor, Sub}; use ops::{BitOr, BitAnd, BitXor, Sub};
use option::Option::{Some, None, self}; use option::Option::{Some, None, self};
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
use clone::Clone; use clone::Clone;
use cmp; use cmp;
use hash::{Hash, Hasher}; use hash::{Hash, Hasher};
use iter::{Iterator, IteratorExt, ExactSizeIterator, count}; use iter::{Iterator, ExactSizeIterator, count};
use marker::{Copy, Send, Sync, Sized, self}; use marker::{Copy, Send, Sync, Sized, self};
use mem::{min_align_of, size_of}; use mem::{min_align_of, size_of};
use mem; use mem;
......
...@@ -261,7 +261,7 @@ fn dlsym(handle: *mut libc::c_void, ...@@ -261,7 +261,7 @@ fn dlsym(handle: *mut libc::c_void,
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
mod dl { mod dl {
use ffi::OsStr; use ffi::OsStr;
use iter::IteratorExt; use iter::Iterator;
use libc; use libc;
use libc::consts::os::extra::ERROR_CALL_NOT_IMPLEMENTED; use libc::consts::os::extra::ERROR_CALL_NOT_IMPLEMENTED;
use ops::FnOnce; use ops::FnOnce;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
use error::{Error, FromError}; use error::{Error, FromError};
use fmt; use fmt;
use io; use io;
use iter::IteratorExt; use iter::Iterator;
use libc; use libc;
use mem; use mem;
#[allow(deprecated)] #[allow(deprecated)]
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use unicode::str as core_str; use unicode::str as core_str;
use error as std_error; use error as std_error;
use fmt; use fmt;
use iter::{self, Iterator, IteratorExt, Extend}; use iter::{self, Iterator, Extend};
use marker::Sized; use marker::Sized;
use ops::{Drop, FnOnce}; use ops::{Drop, FnOnce};
use option::Option::{self, Some, None}; use option::Option::{self, Some, None};
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
use cmp; use cmp;
use fmt; use fmt;
use old_io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult}; use old_io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult};
use iter::{IteratorExt, ExactSizeIterator, repeat}; use iter::{Iterator, ExactSizeIterator, repeat};
use ops::Drop; use ops::Drop;
use option::Option; use option::Option;
use option::Option::{Some, None}; use option::Option::{Some, None};
......
...@@ -400,7 +400,7 @@ mod test { ...@@ -400,7 +400,7 @@ mod test {
extern crate test as test_crate; extern crate test as test_crate;
use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek, Buffer}; use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek, Buffer};
use prelude::v1::{Ok, Err, Vec, AsSlice}; use prelude::v1::{Ok, Err, Vec, AsSlice};
use prelude::v1::IteratorExt; use prelude::v1::Iterator;
use old_io; use old_io;
use iter::repeat; use iter::repeat;
use self::test_crate::Bencher; use self::test_crate::Bencher;
......
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
use error::Error; use error::Error;
use fmt; use fmt;
use isize; use isize;
use iter::{Iterator, IteratorExt}; use iter::Iterator;
use marker::{PhantomFn, Sized}; use marker::{PhantomFn, Sized};
use mem::transmute; use mem::transmute;
use ops::FnOnce; use ops::FnOnce;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
pub use self::Flag::*; pub use self::Flag::*;
pub use self::Protocol::*; pub use self::Protocol::*;
use iter::IteratorExt; use iter::Iterator;
use old_io::IoResult; use old_io::IoResult;
use old_io::net::ip::{SocketAddr, IpAddr}; use old_io::net::ip::{SocketAddr, IpAddr};
use option::Option; use option::Option;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
use fmt; use fmt;
use old_io::{self, IoResult, IoError}; use old_io::{self, IoResult, IoError};
use old_io::net; use old_io::net;
use iter::{Iterator, IteratorExt}; use iter::Iterator;
use ops::{FnOnce, FnMut}; use ops::{FnOnce, FnMut};
use option::Option; use option::Option;
use option::Option::{None, Some}; use option::Option::{None, Some};
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#![allow(deprecated)] // rand #![allow(deprecated)] // rand
use env; use env;
use iter::IteratorExt; use iter::Iterator;
use old_io::{fs, IoError, IoErrorKind, IoResult}; use old_io::{fs, IoError, IoErrorKind, IoResult};
use old_io; use old_io;
use ops::Drop; use ops::Drop;
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
use ffi::CString; use ffi::CString;
use clone::Clone; use clone::Clone;
use fmt; use fmt;
use iter::IteratorExt; use iter::Iterator;
use option::Option; use option::Option;
use option::Option::{None, Some}; use option::Option::{None, Some};
use str; use str;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use hash; use hash;
use old_io::Writer; use old_io::Writer;
use iter::{AdditiveIterator, Extend}; use iter::{AdditiveIterator, Extend};
use iter::{Iterator, IteratorExt, Map}; use iter::{Iterator, Map};
use marker::Sized; use marker::Sized;
use option::Option::{self, Some, None}; use option::Option::{self, Some, None};
use result::Result::{self, Ok, Err}; use result::Result::{self, Ok, Err};
...@@ -444,13 +444,13 @@ mod tests { ...@@ -444,13 +444,13 @@ mod tests {
use super::*; use super::*;
use clone::Clone; use clone::Clone;
use iter::IteratorExt;
use option::Option::{self, Some, None}; use option::Option::{self, Some, None};
use old_path::GenericPath; use old_path::GenericPath;
use slice::AsSlice; use slice::AsSlice;
use str::{self, Str}; use str::{self, Str};
use string::ToString; use string::ToString;
use vec::Vec; use vec::Vec;
use iter::Iterator;
macro_rules! t { macro_rules! t {
(s: $path:expr, $exp:expr) => ( (s: $path:expr, $exp:expr) => (
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
use hash; use hash;
use old_io::Writer; use old_io::Writer;
use iter::{AdditiveIterator, Extend}; use iter::{AdditiveIterator, Extend};
use iter::{Iterator, IteratorExt, Map, repeat}; use iter::{Iterator, Map, repeat};
use mem; use mem;
use option::Option::{self, Some, None}; use option::Option::{self, Some, None};
use result::Result::{self, Ok, Err}; use result::Result::{self, Ok, Err};
...@@ -1126,7 +1126,7 @@ mod tests { ...@@ -1126,7 +1126,7 @@ mod tests {
use super::*; use super::*;
use clone::Clone; use clone::Clone;
use iter::IteratorExt; use iter::Iterator;
use option::Option::{self, Some, None}; use option::Option::{self, Some, None};
use old_path::GenericPath; use old_path::GenericPath;
use slice::AsSlice; use slice::AsSlice;
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
use error::{FromError, Error}; use error::{FromError, Error};
use ffi::{OsString, OsStr}; use ffi::{OsString, OsStr};
use fmt; use fmt;
use iter::{Iterator, IteratorExt}; use iter::Iterator;
use libc::{c_void, c_int, c_char}; use libc::{c_void, c_int, c_char};
use libc; use libc;
use marker::{Copy, Send}; use marker::{Copy, Send};
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use iter::ExactSizeIterator; #[doc(no_inline)] pub use iter::ExactSizeIterator;
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend}; #[doc(no_inline)] pub use iter::{Iterator, Extend};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)] pub use option::Option::{self, Some, None}; #[doc(no_inline)] pub use option::Option::{self, Some, None};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
......
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
use cell::RefCell; use cell::RefCell;
use clone::Clone; use clone::Clone;
use old_io::IoResult; use old_io::IoResult;
use iter::{Iterator, IteratorExt}; use iter::Iterator;
use mem; use mem;
use rc::Rc; use rc::Rc;
use result::Result::{Ok, Err}; use result::Result::{Ok, Err};
......
...@@ -127,7 +127,7 @@ pub fn spawn(cfg: &Command, ...@@ -127,7 +127,7 @@ pub fn spawn(cfg: &Command,
use env::split_paths; use env::split_paths;
use mem; use mem;
use iter::IteratorExt; use iter::Iterator;
// To have the spawning semantics of unix/windows stay the same, we need to // To have the spawning semantics of unix/windows stay the same, we need to
// read the *child's* PATH if one is provided. See #15149 for more details. // read the *child's* PATH if one is provided. See #15149 for more details.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册