auto merge of #7110 : thestinger/rust/iterator, r=brson

This commit is contained in:
bors 2013-06-14 21:37:27 -07:00
commit 1ba6fa4777
121 changed files with 13 additions and 273 deletions

View File

@ -327,7 +327,7 @@ fn main() {
let mut futures = vec::from_fn(1000, |ind| do extra::future::spawn { partial_sum(ind) });
let mut final_res = 0f64;
for futures.each_mut |ft| {
for futures.mut_iter().advance |ft| {
final_res += ft.get();
}
println(fmt!("π^2/6 is not far from : %?", final_res));
@ -351,7 +351,6 @@ a single large vector of floats. Each task needs the full vector to perform its
# use std::vec;
# use std::uint;
# use std::rand;
# use std::iterator::IteratorUtil;
use extra::arc::ARC;
fn pnorm(nums: &~[float], p: uint) -> float {

View File

@ -13,7 +13,6 @@ use core::prelude::*;
use common::config;
use common;
use core::iterator::IteratorUtil;
use core::io;
use core::os;

View File

@ -9,7 +9,6 @@
// except according to those terms.
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::os;
use core::run;

View File

@ -22,7 +22,6 @@ use procsrv;
use util;
use util::logv;
use core::iterator::IteratorUtil;
use core::io;
use core::os;
use core::str;

View File

@ -37,7 +37,7 @@ impl<T> Container for Deque<T> {
impl<T> Mutable for Deque<T> {
/// Clear the deque, removing all values.
fn clear(&mut self) {
for self.elts.each_mut |x| { *x = None }
for self.elts.mut_iter().advance |x| { *x = None }
self.nelts = 0;
self.lo = 0;
self.hi = 0;

View File

@ -20,7 +20,6 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate.
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::managed;
use core::old_iter;
use core::vec;

View File

@ -414,7 +414,6 @@ mod test {
use super::{FileInput, pathify, input_vec, input_vec_state};
use core::iterator::IteratorUtil;
use core::io;
use core::uint;
use core::vec;

View File

@ -83,7 +83,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::cmp::Eq;
use core::result::{Err, Ok};
use core::result;

View File

@ -18,7 +18,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::char;
use core::float;
use core::hashmap::HashMap;

View File

@ -12,7 +12,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
#[deriving(Eq)]
pub enum List<T> {

View File

@ -14,7 +14,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::libc;
use core::comm::{stream, SharedChan};
use core::ptr;

View File

@ -14,7 +14,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::cmp::Eq;
use core::io::{Reader, ReaderUtil};
use core::io;

View File

@ -19,7 +19,6 @@ A BigInt is a combination of BigUint and Sign.
#[allow(missing_doc)];
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
use core::int;
use core::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix, Orderable};

View File

@ -12,7 +12,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::cmp;
use core::from_str::FromStr;
use core::num::{Zero,One,ToStrRadix,FromStrRadix,Round};

View File

@ -10,7 +10,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::cast;
use core::ptr;
use core::sys;

View File

@ -37,7 +37,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::uint;
use core::vec;
use core::str;

View File

@ -14,7 +14,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::char;
use core::cmp;
use core::io::{ReaderUtil};

View File

@ -24,7 +24,7 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::str;
use core::uint;
use core::vec;

View File

@ -12,7 +12,7 @@
use core::prelude::*;
use core::iterator::*;
use core::vec;
use core::f64;
use core::cmp;
use core::num;

View File

@ -14,7 +14,6 @@ use core::prelude::*;
use core::{vec, int, str};
use core::io::Reader;
use core::iterator::IteratorUtil;
use core::hashmap::HashMap;
use super::super::TermInfo;

View File

@ -15,7 +15,6 @@ use core::prelude::*;
use core::{os, str};
use core::os::getenv;
use core::io::{file_reader, Reader};
use core::iterator::IteratorUtil;
use path = core::path::Path;
/// Return path to database entry for `term`

View File

@ -16,7 +16,6 @@ use core::i32;
use core::int;
use core::io;
use core::str;
use core::iterator::IteratorUtil;
static NSEC_PER_SEC: i32 = 1_000_000_000_i32;

View File

@ -14,7 +14,6 @@
use core::prelude::*;
use core::iterator::*;
use core::uint;
use core::util::{swap, replace};
@ -709,7 +708,6 @@ mod test_treemap {
use super::*;
use core::iterator::*;
use core::rand::RngUtil;
use core::rand;
use core::str;
@ -1030,7 +1028,6 @@ mod test_treemap {
#[cfg(test)]
mod test_set {
use core::prelude::*;
use core::iterator::*;
use super::*;

View File

@ -30,7 +30,6 @@ extern mod rusti;
extern mod rustc;
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::io;
use core::os;

View File

@ -22,7 +22,6 @@ use middle::trans::common::CrateContext;
use middle::ty;
use util::ppaux;
use core::iterator::IteratorUtil;
use core::char;
use core::hash::Streaming;
use core::hash;

View File

@ -24,7 +24,6 @@ use middle;
use util::common::time;
use util::ppaux;
use core::iterator::IteratorUtil;
use core::hashmap::HashMap;
use core::int;
use core::io;

View File

@ -17,7 +17,6 @@ use core::prelude::*;
use metadata::cstore;
use metadata::decoder;
use core::iterator::IteratorUtil;
use core::hashmap::HashMap;
use core::vec;
use extra;

View File

@ -22,7 +22,6 @@ use middle::ty;
use middle;
use util::ppaux::ty_to_str;
use core::iterator::IteratorUtil;
use core::hash::HashUtil;
use core::hashmap::HashMap;
use core::int;

View File

@ -25,7 +25,6 @@ use middle::{ty, typeck, moves};
use middle;
use util::ppaux::ty_to_str;
use core::iterator::IteratorUtil;
use core::at_vec;
use core::uint;
use extra::ebml::reader;

View File

@ -18,7 +18,6 @@
// 4. moves do not affect things loaned out in any way
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::hashmap::HashSet;
use core::uint;

View File

@ -17,7 +17,6 @@
// sure that all of these loans are honored.
use core::prelude::*;
use core::iterator::IteratorUtil;
use middle::borrowck::*;
use middle::borrowck::move_data::MoveData;

View File

@ -16,7 +16,6 @@ comments in the section "Moves and initialization" and in `doc.rs`.
*/
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::hashmap::{HashMap, HashSet};
use core::uint;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::iterator::IteratorUtil;
use core::prelude::*;
use driver::session::Session;

View File

@ -19,7 +19,6 @@ use middle::typeck::method_map;
use middle::moves;
use util::ppaux::ty_to_str;
use core::iterator::IteratorUtil;
use core::uint;
use core::vec;
use extra::sort;

View File

@ -18,7 +18,6 @@ use middle;
use syntax::{ast, ast_map, ast_util, visit};
use syntax::ast::*;
use core::iterator::IteratorUtil;
use core::float;
use core::hashmap::{HashMap, HashSet};
use core::vec;

View File

@ -18,7 +18,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::cast;
use core::io;
use core::uint;

View File

@ -17,7 +17,6 @@ use middle::typeck;
use util::ppaux::{Repr, ty_to_str};
use util::ppaux::UserString;
use core::iterator::IteratorUtil;
use core::vec;
use syntax::ast::*;
use syntax::attr::attrs_contains_name;

View File

@ -15,7 +15,6 @@ use middle::ty;
use middle::pat_util;
use util::ppaux::{ty_to_str};
use core::iterator::IteratorUtil;
use core::char;
use core::cmp;
use core::hashmap::HashMap;

View File

@ -110,7 +110,6 @@ use middle::ty;
use middle::typeck;
use middle::moves;
use core::iterator::IteratorUtil;
use core::cast::transmute;
use core::hashmap::HashMap;
use core::io;

View File

@ -47,7 +47,6 @@
*/
use core::prelude::*;
use core::iterator::IteratorUtil;
use middle::ty;
use middle::typeck;

View File

@ -127,7 +127,6 @@ and so on.
*/
use core::prelude::*;
use core::iterator::IteratorUtil;
use middle::pat_util::{pat_bindings};
use middle::freevars;

View File

@ -26,7 +26,6 @@ use middle::ty::{region_variance, rv_covariant, rv_invariant};
use middle::ty::{rv_contravariant, FreeRegion};
use middle::ty;
use core::iterator::IteratorUtil;
use core::hashmap::{HashMap, HashSet};
use syntax::ast_map;
use syntax::codemap::span;

View File

@ -40,7 +40,6 @@ use syntax::visit::{visit_foreign_item, visit_item};
use syntax::visit::{visit_mod, visit_ty, vt};
use syntax::opt_vec::OptVec;
use core::iterator::IteratorUtil;
use core::str;
use core::uint;
use core::vec;

View File

@ -172,7 +172,6 @@ use middle::trans::type_of;
use middle::ty;
use util::common::indenter;
use core::iterator::IteratorUtil;
use core::hashmap::HashMap;
use core::vec;
use syntax::ast;

View File

@ -44,7 +44,6 @@
* taken to it, implementing them for Rust seems difficult.
*/
use core::iterator::IteratorUtil;
use core::container::Map;
use core::libc::c_ulonglong;
use core::option::{Option, Some, None};

View File

@ -64,7 +64,6 @@ use middle::ty;
use util::common::indenter;
use util::ppaux::{Repr, ty_to_str};
use core::iterator::IteratorUtil;
use core::hash;
use core::hashmap::{HashMap, HashSet};
use core::int;

View File

@ -17,7 +17,6 @@ use middle::trans::cabi::{ABIInfo, FnType, LLVMType};
use middle::trans::common::{T_i8, T_i16, T_i32, T_i64};
use middle::trans::common::{T_array, T_ptr, T_void};
use core::iterator::IteratorUtil;
use core::option::{Option, None, Some};
use core::uint;

View File

@ -10,7 +10,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::libc::c_uint;
use core::ptr;
use core::uint;

View File

@ -19,7 +19,6 @@ use lib::llvm::True;
use middle::trans::common::*;
use middle::trans::cabi::*;
use core::iterator::IteratorUtil;
use core::libc::c_uint;
use core::option;
use core::option::Option;

View File

@ -17,7 +17,6 @@
// closure.
use core::prelude::*;
use core::iterator::IteratorUtil;
use back::abi;
use driver::session;

View File

@ -9,7 +9,6 @@
// except according to those terms.
use core::prelude::*;
use core::iterator::IteratorUtil;
use back::abi;
use back::link::{mangle_internal_name_by_path_and_seq};

View File

@ -11,7 +11,6 @@
//! Code that is useful in various trans modules.
use core::prelude::*;
use core::iterator::IteratorUtil;
use back::{abi, upcall};
use driver::session;

View File

@ -152,7 +152,6 @@ use middle::ty;
use util::common::indenter;
use util::ppaux::Repr;
use core::iterator::IteratorUtil;
use core::cast::transmute;
use core::hashmap::HashMap;
use core::vec;

View File

@ -19,7 +19,6 @@ use middle::trans::common::*;
use middle::ty;
use util::ppaux::ty_to_str;
use core::iterator::IteratorUtil;
use core::vec;
use syntax::ast;
use syntax::ast_map::path_name;

View File

@ -32,7 +32,6 @@ use middle::ty::{FnSig};
use middle::typeck;
use util::ppaux::{Repr,ty_to_str};
use core::iterator::IteratorUtil;
use core::vec;
use syntax::ast;
use syntax::ast_map;

View File

@ -16,7 +16,6 @@
// reachable as well.
use core::prelude::*;
use core::iterator::IteratorUtil;
use middle::resolve;
use middle::ty;

View File

@ -33,7 +33,6 @@ use middle::trans::inline;
use middle::ty;
use middle::typeck;
use core::iterator::IteratorUtil;
use core::option::{Some, None};
use core::uint;
use core::vec;

View File

@ -27,7 +27,6 @@ use util::ppaux::{Repr, UserString};
use util::common::{indenter};
use util::enum_set::{EnumSet, CLike};
use core::iterator::IteratorUtil;
use core::cast;
use core::cmp;
use core::hashmap::{HashMap, HashSet};

View File

@ -18,7 +18,6 @@ use middle::typeck::check::{instantiate_path, lookup_def};
use middle::typeck::check::{structure_of, valid_range_bounds};
use middle::typeck::require_same_types;
use core::iterator::IteratorUtil;
use core::hashmap::{HashMap, HashSet};
use syntax::ast;
use syntax::ast_util;

View File

@ -111,7 +111,6 @@ use util::ppaux::{bound_region_to_str};
use util::ppaux;
use core::iterator::IteratorUtil;
use core::cast::transmute;
use core::hashmap::HashMap;
use core::result;

View File

@ -28,7 +28,6 @@ this point a bit better.
*/
use core::prelude::*;
use core::iterator::IteratorUtil;
use middle::freevars::get_freevars;
use middle::ty::{re_scope};

View File

@ -9,7 +9,6 @@
// except according to those terms.
use core::prelude::*;
use core::iterator::IteratorUtil;
use middle::resolve::Impl;
use middle::ty::param_ty;

View File

@ -13,7 +13,6 @@
// substitutions.
use core::prelude::*;
use core::iterator::IteratorUtil;
use middle::pat_util;
use middle::ty;

View File

@ -54,7 +54,6 @@ use syntax::visit::{Visitor, SimpleVisitor};
use syntax::visit::{visit_mod};
use util::ppaux::ty_to_str;
use core::iterator::IteratorUtil;
use core::hashmap::{HashMap, HashSet};
use core::result::Ok;
use core::uint;

View File

@ -31,7 +31,6 @@ are represented as `ty_param()` instances.
*/
use core::prelude::*;
use core::iterator::IteratorUtil;
use metadata::csearch;
use middle::ty::{substs, ty_param_bounds_and_ty};

View File

@ -269,7 +269,6 @@ use util::ppaux::{bound_region_to_str, ty_to_str, trait_ref_to_str};
use core::result;
use core::vec;
use core::iterator::IteratorUtil;
use extra::list::Nil;
use extra::smallintmap::SmallIntMap;
use syntax::ast::{m_imm, m_mutbl};

View File

@ -32,7 +32,6 @@ use syntax::parse::token;
use syntax::print::pprust;
use syntax::{ast, ast_util};
use core::iterator::IteratorUtil;
use core::str;
use core::vec;

View File

@ -24,7 +24,6 @@ use fold::Fold;
use fold;
use pass::Pass;
use core::iterator::IteratorUtil;
use core::str;
use core::util;

View File

@ -14,7 +14,6 @@ use core::prelude::*;
use doc;
use core::iterator::IteratorUtil;
use core::vec;
pub type AstId = int;

View File

@ -10,7 +10,6 @@
use core::prelude::*;
use core::iterator::IteratorUtil;
use astsrv;
use doc;

View File

@ -21,7 +21,6 @@ middle of a line, and each of the following lines is indented.
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::str;
use core::uint;
use pass::Pass;

View File

@ -420,9 +420,6 @@ pub fn run_line(repl: &mut Repl, in: @io::Reader, out: @io::Writer, line: ~str,
use_rl: bool)
-> Option<Repl> {
if line.starts_with(":") {
// FIXME #5898: conflicts with Cell.take(), so can't be at the top level
use std::iterator::IteratorUtil;
// drop the : and the \n (one byte each)
let full = line.slice(1, line.len() - 1);
let split: ~[~str] = full.word_iter().transform(|s| s.to_owned()).collect();

View File

@ -17,7 +17,6 @@ pub use target::{OutputType, Main, Lib, Test, Bench, Target, Build, Install};
use core::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
use core::os::mkdir_recursive;
use core::os;
use core::iterator::IteratorUtil;
/// Returns the value of RUST_PATH, as a list
/// of Paths. In general this should be read from the

View File

@ -29,7 +29,6 @@ extern mod syntax;
use core::prelude::*;
use core::*;
use core::iterator::IteratorUtil;
pub use core::path::Path;
use core::hashmap::HashMap;
use rustc::driver::{driver, session};

View File

@ -15,7 +15,6 @@ extern mod std;
use extra::semver;
use core::prelude::*;
use core::iterator::IteratorUtil;
use core::{char, os, result, run, str};
use package_path::RemotePath;
use extra::tempfile::mkdtemp;

View File

@ -24,8 +24,6 @@ An external iterator object implementing the interface in the `iterator` module
internal iterator by calling the `advance` method. For example:
~~~ {.rust}
use core::iterator::*;
let xs = [0u, 1, 2, 3, 4, 5];
let ys = [30, 40, 50, 60];
let mut it = xs.iter().chain(ys.iter());

View File

@ -45,8 +45,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [0];
/// let b = [1];
/// let mut it = a.iter().chain_(b.iter());
@ -64,8 +62,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [0];
/// let b = [1];
/// let mut it = a.iter().zip(b.iter());
@ -82,8 +78,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2];
/// let mut it = a.iter().transform(|&x| 2 * x);
/// assert_eq!(it.next().get(), 2);
@ -99,8 +93,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2];
/// let mut it = a.iter().filter(|&x| *x > 1);
/// assert_eq!(it.next().get(), &2);
@ -115,8 +107,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2];
/// let mut it = a.iter().filter_map(|&x| if x > 1 {Some(2 * x)} else {None});
/// assert_eq!(it.next().get(), 4);
@ -130,8 +120,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [100, 200];
/// let mut it = a.iter().enumerate();
/// assert_eq!(it.next().get(), (0, &100));
@ -147,8 +135,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 2, 1];
/// let mut it = a.iter().skip_while(|&a| *a < 3);
/// assert_eq!(it.next().get(), &3);
@ -165,8 +151,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 2, 1];
/// let mut it = a.iter().take_while(|&a| *a < 3);
/// assert_eq!(it.next().get(), &1);
@ -181,8 +165,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter().skip(3);
/// assert_eq!(it.next().get(), &4);
@ -198,8 +180,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter().take_(3);
/// assert_eq!(it.next().get(), &1);
@ -217,8 +197,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter().scan(1, |fac, &x| {
/// *fac = *fac * x;
@ -239,6 +217,8 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::Counter;
///
/// for Counter::new(0, 10).advance |i| {
/// io::println(fmt!("%d", i));
/// }
@ -251,8 +231,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let b: ~[int] = a.iter().transform(|&x| x).collect();
/// assert!(a == b);
@ -265,8 +243,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter();
/// assert!(it.nth(2).get() == &3);
@ -280,8 +256,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().last().get() == &5);
/// ~~~
@ -294,8 +268,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().fold(0, |a, &b| a + b) == 15);
/// ~~~
@ -306,8 +278,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter();
/// assert!(it.count() == 5);
@ -320,8 +290,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().all(|&x| *x > 0));
/// assert!(!a.iter().all(|&x| *x > 2));
@ -334,8 +302,6 @@ pub trait IteratorUtil<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter();
/// assert!(it.any_(|&x| *x == 3));
@ -482,8 +448,6 @@ pub trait AdditiveIterator<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter().transform(|&x| x);
/// assert!(it.sum() == 15);
@ -504,7 +468,7 @@ pub trait MultiplicativeIterator<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
/// use std::iterator::Counter;
///
/// fn factorial(n: uint) -> uint {
/// Counter::new(1u, 1).take_while(|&i| i <= n).product()
@ -529,8 +493,6 @@ pub trait OrdIterator<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().max().get() == &5);
/// ~~~
@ -541,8 +503,6 @@ pub trait OrdIterator<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::*;
///
/// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().min().get() == &1);
/// ~~~

View File

@ -33,10 +33,6 @@ pub trait ReverseIter<A>: BaseIter<A> {
fn each_reverse(&self, blk: &fn(&A) -> bool) -> bool;
}
pub trait MutableIter<A>: BaseIter<A> {
fn each_mut(&mut self, blk: &fn(&mut A) -> bool) -> bool;
}
pub trait ExtendedIter<A> {
fn eachi(&self, blk: &fn(uint, v: &A) -> bool) -> bool;
fn all(&self, blk: &fn(&A) -> bool) -> bool;
@ -47,10 +43,6 @@ pub trait ExtendedIter<A> {
fn flat_map_to_vec<B,IB: BaseIter<B>>(&self, op: &fn(&A) -> IB) -> ~[B];
}
pub trait ExtendedMutableIter<A> {
fn eachi_mut(&mut self, blk: &fn(uint, &mut A) -> bool) -> bool;
}
pub trait EqIter<A:Eq> {
fn contains(&self, x: &A) -> bool;
fn count(&self, x: &A) -> uint;
@ -67,13 +59,6 @@ pub trait CopyableOrderedIter<A:Copy + Ord> {
fn max(&self) -> A;
}
pub trait CopyableNonstrictIter<A:Copy> {
// Like "each", but copies out the value. If the receiver is mutated while
// iterating over it, the semantics must not be memory-unsafe but are
// otherwise undefined.
fn each_val(&const self, f: &fn(A) -> bool) -> bool;
}
// A trait for sequences that can be built by imperatively pushing elements
// onto them.
pub trait Buildable<A> {

View File

@ -46,12 +46,10 @@ pub use cmp::{Eq, ApproxEq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Great
pub use char::Char;
pub use container::{Container, Mutable, Map, Set};
pub use hash::Hash;
pub use old_iter::{BaseIter, ReverseIter, MutableIter, ExtendedIter, EqIter};
pub use old_iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
pub use old_iter::{ExtendedMutableIter};
pub use old_iter::{BaseIter, ReverseIter, ExtendedIter, EqIter};
pub use old_iter::{CopyableIter, CopyableOrderedIter};
pub use iter::{Times, FromIter};
// FIXME: #5898 pub use iterator::{Iterator, IteratorUtil};
pub use iterator::Iterator;
pub use iterator::{Iterator, IteratorUtil};
pub use num::{Num, NumCast};
pub use num::{Orderable, Signed, Unsigned, Round};
pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};

View File

@ -2487,29 +2487,6 @@ impl<A> old_iter::BaseIter<A> for @[A] {
fn size_hint(&self) -> Option<uint> { Some(self.len()) }
}
impl<'self,A> old_iter::MutableIter<A> for &'self mut [A] {
#[inline(always)]
fn each_mut<'a>(&'a mut self, blk: &fn(v: &'a mut A) -> bool) -> bool {
self.mut_iter().advance(blk)
}
}
// FIXME(#4148): This should be redundant
impl<A> old_iter::MutableIter<A> for ~[A] {
#[inline(always)]
fn each_mut<'a>(&'a mut self, blk: &fn(v: &'a mut A) -> bool) -> bool {
self.mut_iter().advance(blk)
}
}
// FIXME(#4148): This should be redundant
impl<A> old_iter::MutableIter<A> for @mut [A] {
#[inline(always)]
fn each_mut(&mut self, blk: &fn(v: &mut A) -> bool) -> bool {
self.mut_iter().advance(blk)
}
}
impl<'self,A> old_iter::ExtendedIter<A> for &'self [A] {
pub fn eachi(&self, blk: &fn(uint, v: &A) -> bool) -> bool {
old_iter::eachi(self, blk)
@ -2535,13 +2512,6 @@ impl<'self,A> old_iter::ExtendedIter<A> for &'self [A] {
}
}
impl<'self,A> old_iter::ExtendedMutableIter<A> for &'self mut [A] {
#[inline(always)]
pub fn eachi_mut(&mut self, blk: &fn(uint, v: &mut A) -> bool) -> bool {
self.mut_iter().enumerate().advance(|(i, v)| blk(i, v))
}
}
// FIXME(#4148): This should be redundant
impl<A> old_iter::ExtendedIter<A> for ~[A] {
pub fn eachi(&self, blk: &fn(uint, v: &A) -> bool) -> bool {
@ -2660,41 +2630,6 @@ impl<A:Copy + Ord> old_iter::CopyableOrderedIter<A> for @[A] {
fn max(&self) -> A { old_iter::max(self) }
}
impl<'self,A:Copy> old_iter::CopyableNonstrictIter<A> for &'self [A] {
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
let mut i = 0;
while i < self.len() {
if !f(copy self[i]) { return false; }
i += 1;
}
return true;
}
}
// FIXME(#4148): This should be redundant
impl<A:Copy> old_iter::CopyableNonstrictIter<A> for ~[A] {
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
let mut i = 0;
while i < uniq_len(self) {
if !f(copy self[i]) { return false; }
i += 1;
}
return true;
}
}
// FIXME(#4148): This should be redundant
impl<A:Copy> old_iter::CopyableNonstrictIter<A> for @[A] {
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
let mut i = 0;
while i < self.len() {
if !f(copy self[i]) { return false; }
i += 1;
}
return true;
}
}
impl<A:Clone> Clone for ~[A] {
#[inline]
fn clone(&self) -> ~[A] {
@ -4356,14 +4291,4 @@ mod tests {
}
assert_eq!(v, ~[~[1,2,3],~[1,3,2],~[2,1,3],~[2,3,1],~[3,1,2],~[3,2,1]]);
}
#[test]
fn test_each_val() {
use old_iter::CopyableNonstrictIter;
let mut i = 0;
for [1, 2, 3].each_val |v| {
i += v;
}
assert_eq!(i, 6);
}
}

View File

@ -22,7 +22,6 @@ use print::pprust;
use visit;
use syntax::parse::token::special_idents;
use core::iterator::IteratorUtil;
use core::cmp;
use core::hashmap::HashMap;
use core::vec;

View File

@ -24,7 +24,6 @@ use core::hashmap::HashMap;
use core::int;
use core::option;
use core::to_bytes;
use core::iterator::IteratorUtil;
pub fn path_name_i(idents: &[ident]) -> ~str {
// FIXME: Bad copies (#2543 -- same for everything else that says "bad")
@ -795,7 +794,6 @@ mod test {
use ast::*;
use super::*;
use core::io;
use core::iterator::IteratorUtil;
#[test] fn xorpush_test () {
let mut s = ~[];

View File

@ -19,7 +19,6 @@ use codemap::BytePos;
use diagnostic::span_handler;
use parse::comments::{doc_comment_style, strip_doc_comment_decoration};
use core::iterator::IteratorUtil;
use core::hashmap::HashSet;
use core::vec;
use extra;

View File

@ -9,7 +9,6 @@
// except according to those terms.
use core::prelude::*;
use core::iterator::IteratorUtil;
use codemap::{Pos, span};
use codemap;

View File

@ -10,7 +10,6 @@
/* The compiler code necessary to support the bytes! extension. */
use core::iterator::IteratorUtil;
use ast;
use codemap::span;
use ext::base::*;

View File

@ -174,7 +174,6 @@ use opt_vec;
use core::uint;
use core::vec;
use core::iterator::IteratorUtil;
pub use self::ty::*;
mod ty;

View File

@ -16,7 +16,6 @@ use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use core::iterator::IteratorUtil;
pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
span: span,

View File

@ -19,7 +19,6 @@ library.
*/
use core::prelude::*;
use core::iterator::IteratorUtil;
use ast::{enum_def, ident, item, Generics, meta_item, struct_def};
use ext::base::ExtCtxt;

View File

@ -27,7 +27,6 @@ use parse::token::{ident_to_str, intern};
use visit;
use visit::Visitor;
use core::iterator::IteratorUtil;
use core::vec;
pub fn expand_expr(extsbox: @mut SyntaxEnv,

View File

@ -23,7 +23,6 @@ use ext::quote::rt::*;
use opt_vec;
use opt_vec::OptVec;
use core::iterator::IteratorUtil;
use core::vec;
pub trait gen_send {

View File

@ -22,7 +22,6 @@ use parse::parser::Parser;
use parse::token::{Token, EOF, to_str, nonterminal, get_ident_interner, ident_to_str};
use parse::token;
use core::iterator::IteratorUtil;
use core::hashmap::HashMap;
use core::uint;
use core::vec;

View File

@ -19,7 +19,6 @@ use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident};
use parse::token::{ident_to_str};
use parse::lexer::TokenAndSpan;
use core::iterator::IteratorUtil;
use core::hashmap::HashMap;
use core::option;

View File

@ -20,7 +20,6 @@ use parse::lexer;
use parse::token;
use parse::token::{get_ident_interner};
use core::iterator::IteratorUtil;
use core::io;
use core::str;
use core::uint;

View File

@ -19,7 +19,6 @@ use ext::tt::transcribe::{dup_tt_reader};
use parse::token;
use parse::token::{str_to_ident};
use core::iterator::IteratorUtil;
use core::char;
use core::either;
use core::u64;

View File

@ -92,7 +92,6 @@ use parse::{new_sub_parser_from_file, next_node_id, ParseSess};
use opt_vec;
use opt_vec::OptVec;
use core::iterator::IteratorUtil;
use core::either::Either;
use core::either;
use core::hashmap::HashSet;

View File

@ -33,7 +33,6 @@ use core::char;
use core::io;
use core::u64;
use core::uint;
use core::iterator::IteratorUtil;
// The @ps is stored here to prevent recursive type.
pub enum ann_node<'self> {

View File

@ -9,7 +9,6 @@
// except according to those terms.
use core::prelude::*;
use core::iterator::IteratorUtil;
use abi::AbiSet;
use ast::*;

View File

@ -21,7 +21,6 @@ use extra::arc;
use extra::time;
use extra::deque::Deque;
use extra::par;
use std::iterator::IteratorUtil;
use std::hashmap::HashSet;
use std::int::abs;
use std::io;

View File

@ -109,7 +109,7 @@ fn main() {
thread_ring(0, msg_per_task, num_chan.take(), num_port);
// synchronize
for futures.each_mut |f| {
for futures.mut_iter().advance |f| {
f.get()
}

View File

@ -99,7 +99,7 @@ fn main() {
thread_ring(0, msg_per_task, num_chan.take(), num_port);
// synchronize
for futures.each_mut |f| {
for futures.mut_iter().advance |f| {
let _ = f.get();
}

Some files were not shown because too many files have changed in this diff Show More