diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index d08342d8687..9c28da10e40 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -731,8 +731,8 @@ fn encode_info_for_method(ecx: &EncodeContext, } let mut combined_ty_params = opt_vec::Empty; - for owner_generics.ty_params.each |x| { combined_ty_params.push(copy *x) } - for method_generics.ty_params.each |x| { combined_ty_params.push(copy *x) } + for owner_generics.ty_params.iter().advance |x| { combined_ty_params.push(copy *x) } + for method_generics.ty_params.iter().advance |x| { combined_ty_params.push(copy *x) } let len = combined_ty_params.len(); encode_type_param_bounds(ebml_w, ecx, &combined_ty_params); diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index a8b837d869d..3a54c224b52 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -3834,8 +3834,8 @@ impl Resolver { pub fn resolve_type_parameters(@mut self, type_parameters: &OptVec, visitor: ResolveVisitor) { - for type_parameters.each |type_parameter| { - for type_parameter.bounds.each |bound| { + for type_parameters.iter().advance |type_parameter| { + for type_parameter.bounds.iter().advance |bound| { self.resolve_type_parameter_bound(bound, visitor); } } @@ -4181,13 +4181,13 @@ impl Resolver { } } - for bounds.each |bound| { + for bounds.iter().advance |bound| { self.resolve_type_parameter_bound(bound, visitor); } } ty_closure(c) => { - for c.bounds.each |bound| { + for c.bounds.iter().advance |bound| { self.resolve_type_parameter_bound(bound, visitor); } visit_ty(ty, ((), visitor)); diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 3b651451db8..5e6574850f1 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -752,7 +752,7 @@ fn conv_builtin_bounds(tcx: ty::ctxt, //! legal. let mut builtin_bounds = ty::EmptyBuiltinBounds(); - for ast_bounds.each |ast_bound| { + for ast_bounds.iter().advance |ast_bound| { match *ast_bound { ast::TraitTyParamBound(b) => { match lookup_def_tcx(tcx, b.path.span, b.ref_id) { diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 3554376902c..7812a0ed0eb 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -775,7 +775,7 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, span: span, generics: &ast::Generics, thing: &'static str) { - for generics.ty_params.each |ty_param| { + for generics.ty_params.iter().advance |ty_param| { if ty_param.bounds.len() > 0 { ccx.tcx.sess.span_err( span, @@ -1172,7 +1172,7 @@ pub fn ty_generics(ccx: &CrateCtxt, builtin_bounds: ty::EmptyBuiltinBounds(), trait_bounds: ~[] }; - for ast_bounds.each |ast_bound| { + for ast_bounds.iter().advance |ast_bound| { match *ast_bound { TraitTyParamBound(b) => { let ty = ty::mk_param(ccx.tcx, param_ty.idx, param_ty.def_id); diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index 16b490cd478..dc9fc264f85 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -57,7 +57,7 @@ impl RegionParamNames { } fn has_ident(&self, ident: ast::ident) -> bool { - for self.each |region_param_name| { + for self.iter().advance |region_param_name| { if *region_param_name == ident { return true; } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 227d700452b..a233c330b64 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -394,10 +394,10 @@ impl id_range { pub fn id_visitor(vfn: @fn(node_id, T)) -> visit::vt { let visit_generics: @fn(&Generics, T) = |generics, t| { - for generics.ty_params.each |p| { + for generics.ty_params.iter().advance |p| { vfn(p.id, copy t); } - for generics.lifetimes.each |p| { + for generics.lifetimes.iter().advance |p| { vfn(p.id, copy t); } }; diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 981b28afd02..83e446fa4c6 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -324,11 +324,11 @@ impl<'self> TraitDef<'self> { let mut trait_generics = self.generics.to_generics(cx, span, type_ident, generics); // Copy the lifetimes - for generics.lifetimes.each |l| { + for generics.lifetimes.iter().advance |l| { trait_generics.lifetimes.push(copy *l) }; // Create the type parameters. - for generics.ty_params.each |ty_param| { + for generics.ty_params.iter().advance |ty_param| { // I don't think this can be moved out of the loop, since // a TyParamBound requires an ast id let mut bounds = opt_vec::from( diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 55ac9c5ec1c..da5455d4332 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -374,7 +374,7 @@ impl gen_init for protocol { fn buffer_ty_path(&self, cx: @ExtCtxt) -> @ast::Ty { let mut params: OptVec = opt_vec::Empty; for (copy self.states).iter().advance |s| { - for s.generics.ty_params.each |tp| { + for s.generics.ty_params.iter().advance |tp| { match params.iter().find_(|tpp| tp.ident == tpp.ident) { None => params.push(*tp), _ => () @@ -392,7 +392,7 @@ impl gen_init for protocol { let ext_cx = cx; let mut params: OptVec = opt_vec::Empty; let fields = do (copy self.states).iter().transform |s| { - for s.generics.ty_params.each |tp| { + for s.generics.ty_params.iter().advance |tp| { match params.iter().find_(|tpp| tp.ident == tpp.ident) { None => params.push(*tp), _ => () diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 8917b481dc7..22b1d040d42 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -38,13 +38,6 @@ pub fn from(t: ~[T]) -> OptVec { } impl OptVec { - fn each(&self, blk: &fn(v: &T) -> bool) -> bool { - match *self { - Empty => true, - Vec(ref v) => v.iter().advance(blk) - } - } - fn push(&mut self, t: T) { match *self { Vec(ref mut v) => { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 1a3155337a5..d7b5e57a57f 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1743,7 +1743,7 @@ pub fn print_bounds(s: @ps, bounds: @OptVec) { if !bounds.is_empty() { word(s.s, ":"); let mut first = true; - for bounds.each |bound| { + for bounds.iter().advance |bound| { nbsp(s); if first { first = false; diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index d7914832835..5e409be3e6c 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -334,7 +334,7 @@ pub fn visit_foreign_item(ni: @foreign_item, (e, v): (E, vt)) { pub fn visit_ty_param_bounds(bounds: &OptVec, (e, v): (E, vt)) { - for bounds.each |bound| { + for bounds.iter().advance |bound| { match *bound { TraitTyParamBound(ty) => visit_trait_ref(ty, (copy e, v)), RegionTyParamBound => {} @@ -343,7 +343,7 @@ pub fn visit_ty_param_bounds(bounds: &OptVec, } pub fn visit_generics(generics: &Generics, (e, v): (E, vt)) { - for generics.ty_params.each |tp| { + for generics.ty_params.iter().advance |tp| { visit_ty_param_bounds(tp.bounds, (copy e, v)); } }