diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-09-19 16:55:01 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-09-19 17:03:01 -0700 |
| commit | cfed923600e2f7ad34241501200d595abccdeb54 (patch) | |
| tree | d382eb144026703d9abee0e6a99b87b34e9bd138 /src/libsyntax | |
| parent | 1c39f1968c77a3d42b0fdb30a36cff4d94a17da2 (diff) | |
| download | rust-cfed923600e2f7ad34241501200d595abccdeb54.tar.gz rust-cfed923600e2f7ad34241501200d595abccdeb54.zip | |
demode the each() method on vec and other iterables.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 28 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat_idents.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/fmt.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 60 | ||||
| -rw-r--r-- | src/libsyntax/util/interner.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 50 |
17 files changed, 113 insertions, 95 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 7917ff4d886..d813c7e4b08 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -151,7 +151,7 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, for decl.inputs.each |a| { cx.map.insert(a.id, node_arg(/* FIXME (#2543) */ - copy a, cx.local_id)); + copy *a, cx.local_id)); cx.local_id += 1u; } match fk { @@ -220,14 +220,14 @@ fn map_item(i: @item, cx: ctx, v: vt) { item_impl(_, _, _, ms) => { let impl_did = ast_util::local_def(i.id); for ms.each |m| { - map_method(impl_did, extend(cx, i.ident), m, + map_method(impl_did, extend(cx, i.ident), *m, cx); } } item_enum(enum_definition, _) => { for enum_definition.variants.each |v| { cx.map.insert(v.node.id, node_variant( - /* FIXME (#2543) */ copy v, i, + /* FIXME (#2543) */ copy *v, i, extend(cx, i.ident))); } } @@ -238,7 +238,7 @@ fn map_item(i: @item, cx: ctx, v: vt) { }; for nm.items.each |nitem| { cx.map.insert(nitem.id, - node_foreign_item(nitem, abi, + node_foreign_item(*nitem, abi, /* FIXME (#2543) */ if nm.sort == ast::named { extend(cx, i.ident) @@ -264,9 +264,9 @@ fn map_item(i: @item, cx: ctx, v: vt) { cx.map.insert(p.impl_id, node_item(i, item_path)); } for methods.each |tm| { - let id = ast_util::trait_method_to_ty_method(tm).id; + let id = ast_util::trait_method_to_ty_method(*tm).id; let d_id = ast_util::local_def(i.id); - cx.map.insert(id, node_trait_method(@tm, d_id, item_path)); + cx.map.insert(id, node_trait_method(@*tm, d_id, item_path)); } } _ => () @@ -310,7 +310,7 @@ fn map_view_item(vi: @view_item, cx: ctx, _v: vt) { (id, path_to_ident(pth)) } }; - cx.map.insert(id, node_export(vp, extend(cx, name))); + cx.map.insert(id, node_export(*vp, extend(cx, name))); }, _ => () } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index ef8a4b602d1..41be872f060 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -312,7 +312,7 @@ fn split_trait_methods(trait_methods: ~[trait_method]) -> (~[ty_method], ~[@method]) { let mut reqd = ~[], provd = ~[]; for trait_methods.each |trt_method| { - match trt_method { + match *trt_method { required(tm) => vec::push(reqd, tm), provided(m) => vec::push(provd, m) } @@ -575,15 +575,23 @@ pure fn is_item_impl(item: @ast::item) -> bool { fn walk_pat(pat: @pat, it: fn(@pat)) { it(pat); match pat.node { - pat_ident(_, _, Some(p)) => walk_pat(p, it), - pat_rec(fields, _) | pat_struct(_, fields, _) => - for fields.each |f| { walk_pat(f.pat, it) }, - pat_enum(_, Some(s)) | pat_tup(s) => for s.each |p| { - walk_pat(p, it) - }, - pat_box(s) | pat_uniq(s) | pat_region(s) => walk_pat(s, it), - pat_wild | pat_lit(_) | pat_range(_, _) | pat_ident(_, _, _) - | pat_enum(_, _) => () + pat_ident(_, _, Some(p)) => walk_pat(p, it), + pat_rec(fields, _) | pat_struct(_, fields, _) => { + for fields.each |f| { + walk_pat(f.pat, it) + } + } + pat_enum(_, Some(s)) | pat_tup(s) => { + for s.each |p| { + walk_pat(*p, it) + } + } + pat_box(s) | pat_uniq(s) | pat_region(s) => { + walk_pat(s, it) + } + pat_wild | pat_lit(_) | pat_range(_, _) | pat_ident(_, _, _) | + pat_enum(_, _) => { + } } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 17e34db0426..fdcd1087935 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -91,7 +91,7 @@ fn attr_meta(attr: ast::attribute) -> @ast::meta_item { @attr.node.value } // Get the meta_items from inside a vector of attributes fn attr_metas(attrs: ~[ast::attribute]) -> ~[@ast::meta_item] { let mut mitems = ~[]; - for attrs.each |a| { vec::push(mitems, attr_meta(a)); } + for attrs.each |a| { vec::push(mitems, attr_meta(*a)); } return mitems; } @@ -189,7 +189,7 @@ fn find_meta_items_by_name(metas: ~[@ast::meta_item], name: ~str) -> */ fn contains(haystack: ~[@ast::meta_item], needle: @ast::meta_item) -> bool { for haystack.each |item| { - if eq(item, needle) { return true; } + if eq(*item, needle) { return true; } } return false; } @@ -370,7 +370,7 @@ fn require_unique_names(diagnostic: span_handler, metas: ~[@ast::meta_item]) { let map = map::HashMap(); for metas.each |meta| { - let name = get_meta_item_name(meta); + let name = get_meta_item_name(*meta); // FIXME: How do I silence the warnings? --pcw (#2619) if map.contains_key(name) { diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 2e3c556084f..ab34ed8368c 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -242,7 +242,7 @@ fn get_snippet(cm: codemap::codemap, fidx: uint, lo: uint, hi: uint) -> ~str } fn get_filemap(cm: codemap, filename: ~str) -> filemap { - for cm.files.each |fm| { if fm.name == filename { return fm; } } + for cm.files.each |fm| { if fm.name == filename { return *fm; } } //XXjdm the following triggers a mismatched type bug // (or expected function, found _|_) fail; // ("asking for " + filename + " which we don't know about"); diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 66553162b25..217b8c9cf4b 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -219,8 +219,8 @@ fn highlight_lines(cm: codemap::codemap, sp: span, } // Print the offending lines for display_lines.each |line| { - io::stderr().write_str(fmt!("%s:%u ", fm.name, line + 1u)); - let s = codemap::get_line(fm, line as int) + ~"\n"; + io::stderr().write_str(fmt!("%s:%u ", fm.name, *line + 1u)); + let s = codemap::get_line(fm, *line as int) + ~"\n"; io::stderr().write_str(s); } if elided { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 45e6bf43f4b..94b22d68cea 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -6,7 +6,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, let mut res_str = ~""; for args.each |e| { res_str += *cx.parse_sess().interner.get( - expr_to_ident(cx, e, ~"expected an ident")); + expr_to_ident(cx, *e, ~"expected an ident")); } let res = cx.parse_sess().interner.intern(@res_str); diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 4c5435d1123..3ea0493239f 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -53,7 +53,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, fn make_flags(cx: ext_ctxt, sp: span, flags: ~[Flag]) -> @ast::expr { let mut tmp_expr = make_rt_path_expr(cx, sp, @~"flag_none"); for flags.each |f| { - let fstr = match f { + let fstr = match *f { FlagLeftJustify => ~"flag_left_justify", FlagLeftZeroPad => ~"flag_left_zero_pad", FlagSpaceForSign => ~"flag_space_for_sign", @@ -139,7 +139,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, _ => cx.span_unimpl(sp, unsupported) } for cnv.flags.each |f| { - match f { + match *f { FlagLeftJustify => (), FlagSignAlways => { if !is_signed_type(cnv) { @@ -196,7 +196,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, _ => debug!("param: none") } for c.flags.each |f| { - match f { + match *f { FlagLeftJustify => debug!("flag: left justify"), FlagLeftZeroPad => debug!("flag: left zero pad"), FlagSpaceForSign => debug!("flag: left space pad"), @@ -243,7 +243,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, let mut piece_exprs = ~[]; let nargs = args.len(); for pieces.each |pc| { - match pc { + match *pc { PieceString(s) => { vec::push(piece_exprs, mk_uniq_str(cx, fmt_sp, s)) } diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 600c30f1f8b..e2b08d089a7 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -202,7 +202,7 @@ impl state: to_type_decls { let mut items_msg = ~[]; for self.messages.each |m| { - let message(name, span, tys, this, next) = m; + let message(name, span, tys, this, next) = *m; let tys = match next { Some({state: next, tys: next_tys}) => { @@ -366,7 +366,7 @@ impl protocol: gen_init { for (copy self.states).each |s| { for s.ty_params.each |tp| { match params.find(|tpp| tp.ident == tpp.ident) { - None => vec::push(params, tp), + None => vec::push(params, *tp), _ => () } } @@ -382,7 +382,7 @@ impl protocol: gen_init { let fields = do (copy self.states).map_to_vec |s| { for s.ty_params.each |tp| { match params.find(|tpp| tp.ident == tpp.ident) { - None => vec::push(params, tp), + None => vec::push(params, *tp), _ => () } } diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 373f16daeb0..fec8339cf1a 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -102,7 +102,7 @@ impl state { /// from this state. fn reachable(f: fn(state) -> bool) { for self.messages.each |m| { - match m { + match *m { message(_, _, _, _, Some({state: id, _})) => { let state = self.proto.get_state(id); if !f(state) { break } diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index 8c7ef65d227..c9385b0c35c 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -92,7 +92,7 @@ fn option_flatten_map<T: Copy, U: Copy>(f: fn@(T) -> Option<U>, v: ~[T]) -> Option<~[U]> { let mut res = ~[]; for v.each |elem| { - match f(elem) { + match f(*elem) { None => return None, Some(fv) => vec::push(res, fv) } @@ -156,7 +156,7 @@ fn use_selectors_to_bind(b: binders, e: @expr) -> Option<bindings> { let res = HashMap(); //need to do this first, to check vec lengths. for b.literal_ast_matchers.each |sel| { - match sel(match_expr(e)) { None => return None, _ => () } + match (*sel)(match_expr(e)) { None => return None, _ => () } } let mut never_mind: bool = false; for b.real_binders.each |key, val| { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index c0a8848139f..74c36dcf1b7 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -174,7 +174,7 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match]) match m { {node: match_tok(_), span: _} => (), {node: match_seq(more_ms, _, _, _, _), span: _} => { - for more_ms.each() |next_m| { n_rec(p_s, next_m, res, ret_val) }; + for more_ms.each() |next_m| { n_rec(p_s, *next_m, res, ret_val) }; } {node: match_nonterminal(bind_name, _, idx), span: sp} => { if ret_val.contains_key(bind_name) { @@ -186,7 +186,7 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match]) } } let ret_val = HashMap::<uint,@named_match>(); - for ms.each() |m| { n_rec(p_s, m, res, ret_val) } + for ms.each() |m| { n_rec(p_s, *m, res, ret_val) } return ret_val; } diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index 526b5101d34..c5e64654d7b 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -13,7 +13,7 @@ fn eval_crate_directives(cx: ctx, &view_items: ~[@ast::view_item], &items: ~[@ast::item]) { for cdirs.each |sub_cdir| { - eval_crate_directive(cx, sub_cdir, prefix, view_items, items); + eval_crate_directive(cx, *sub_cdir, prefix, view_items, items); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0902567e864..a1c1208d21c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2244,7 +2244,7 @@ impl parser { IMPORTS_AND_ITEMS_ALLOWED); for items.each |item| { - let decl = @spanned(item.span.lo, item.span.hi, decl_item(item)); + let decl = @spanned(item.span.lo, item.span.hi, decl_item(*item)); push(stmts, @spanned(item.span.lo, item.span.hi, stmt_decl(decl, self.get_id()))); } @@ -2699,7 +2699,7 @@ impl parser { } members(mms) => { for mms.each |mm| { - match mm { + match *mm { @field_member(struct_field) => vec::push(fields, struct_field), @method_member(the_method_member) => @@ -3090,7 +3090,7 @@ impl parser { } members(mms) => { for mms.each |mm| { - match mm { + match *mm { @field_member(struct_field) => vec::push(fields, struct_field), @method_member(the_method_member) => @@ -3163,7 +3163,7 @@ impl parser { seq_sep_trailing_disallowed(token::COMMA), |p| p.parse_ty(false)); for arg_tys.each |ty| { - vec::push(args, {ty: ty, id: self.get_id()}); + vec::push(args, {ty: *ty, id: self.get_id()}); } kind = tuple_variant_kind(args); } else if self.eat(token::EQ) { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 2bd5d155063..570915e657f 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -389,7 +389,7 @@ fn temporary_keyword_table() -> HashMap<~str, ()> { ~"self", ~"static", ]; for keys.each |word| { - words.insert(word, ()); + words.insert(*word, ()); } words } @@ -415,7 +415,7 @@ fn strict_keyword_table() -> HashMap<~str, ()> { ~"while" ]; for keys.each |word| { - words.insert(word, ()); + words.insert(*word, ()); } words } @@ -426,7 +426,7 @@ fn reserved_keyword_table() -> HashMap<~str, ()> { ~"be" ]; for keys.each |word| { - words.insert(word, ()); + words.insert(*word, ()); } words } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index a87e3c4b52b..f41cdae7e03 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -281,7 +281,7 @@ fn commasep<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN)) { let mut first = true; for elts.each |elt| { if first { first = false; } else { word_space(s, ~","); } - op(s, elt); + op(s, *elt); } end(s); } @@ -293,12 +293,12 @@ fn commasep_cmnt<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN), let len = vec::len::<IN>(elts); let mut i = 0u; for elts.each |elt| { - maybe_print_comment(s, get_span(elt).hi); - op(s, elt); + maybe_print_comment(s, get_span(*elt).hi); + op(s, *elt); i += 1u; if i < len { word(s.s, ~","); - maybe_print_trailing_comment(s, get_span(elt), + maybe_print_trailing_comment(s, get_span(*elt), Some(get_span(elts[i]).hi)); space_if_not_bol(s); } @@ -314,18 +314,18 @@ fn commasep_exprs(s: ps, b: breaks, exprs: ~[@ast::expr]) { fn print_mod(s: ps, _mod: ast::_mod, attrs: ~[ast::attribute]) { print_inner_attributes(s, attrs); for _mod.view_items.each |vitem| { - print_view_item(s, vitem); + print_view_item(s, *vitem); } - for _mod.items.each |item| { print_item(s, item); } + for _mod.items.each |item| { print_item(s, *item); } } fn print_foreign_mod(s: ps, nmod: ast::foreign_mod, attrs: ~[ast::attribute]) { print_inner_attributes(s, attrs); for nmod.view_items.each |vitem| { - print_view_item(s, vitem); + print_view_item(s, *vitem); } - for nmod.items.each |item| { print_foreign_item(s, item); } + for nmod.items.each |item| { print_foreign_item(s, *item); } } fn print_region(s: ps, region: @ast::region, sep: ~str) { @@ -525,7 +525,7 @@ fn print_item(s: ps, &&item: @ast::item) { bopen(s); for methods.each |meth| { - print_method(s, meth); + print_method(s, *meth); } bclose(s, item.span); } @@ -540,7 +540,9 @@ fn print_item(s: ps, &&item: @ast::item) { } word(s.s, ~" "); bopen(s); - for methods.each |meth| { print_trait_method(s, meth); } + for methods.each |meth| { + print_trait_method(s, *meth); + } bclose(s, item.span); } ast::item_mac({node: ast::mac_invoc_tt(pth, tts), _}) => { @@ -549,7 +551,9 @@ fn print_item(s: ps, &&item: @ast::item) { print_ident(s, item.ident); cbox(s, indent_unit); popen(s); - for tts.each |tt| { print_tt(s, tt); } + for tts.each |tt| { + print_tt(s, *tt); + } pclose(s); end(s); } @@ -602,7 +606,7 @@ fn print_variants(s: ps, variants: ~[ast::variant], span: ast::span) { maybe_print_comment(s, v.span.lo); print_outer_attributes(s, v.node.attrs); ibox(s, indent_unit); - print_variant(s, v); + print_variant(s, *v); word(s.s, ~","); end(s); maybe_print_trailing_comment(s, v.span, None::<uint>); @@ -661,7 +665,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param], } } for struct_def.methods.each |method| { - print_method(s, method); + print_method(s, *method); } bclose(s, span); } @@ -675,7 +679,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param], /// expression arguments as expressions). It can be done! I think. fn print_tt(s: ps, tt: ast::token_tree) { match tt { - ast::tt_delim(tts) => for tts.each() |tt_elt| { print_tt(s, tt_elt); }, + ast::tt_delim(tts) => for tts.each() |tt_elt| { print_tt(s, *tt_elt); }, ast::tt_tok(_, tk) => { match tk { parse::token::IDENT(*) => { // don't let idents run together @@ -688,7 +692,7 @@ fn print_tt(s: ps, tt: ast::token_tree) { } ast::tt_seq(_, tts, sep, zerok) => { word(s.s, ~"$("); - for tts.each() |tt_elt| { print_tt(s, tt_elt); } + for tts.each() |tt_elt| { print_tt(s, *tt_elt); } word(s.s, ~")"); match sep { Some(tk) => word(s.s, parse::token::to_str(s.intr, tk)), @@ -767,7 +771,7 @@ fn print_outer_attributes(s: ps, attrs: ~[ast::attribute]) { let mut count = 0; for attrs.each |attr| { match attr.node.style { - ast::attr_outer => { print_attribute(s, attr); count += 1; } + ast::attr_outer => { print_attribute(s, *attr); count += 1; } _ => {/* fallthrough */ } } } @@ -779,7 +783,7 @@ fn print_inner_attributes(s: ps, attrs: ~[ast::attribute]) { for attrs.each |attr| { match attr.node.style { ast::attr_inner => { - print_attribute(s, attr); + print_attribute(s, *attr); if !attr.node.is_sugared_doc { word(s.s, ~";"); } @@ -870,9 +874,9 @@ fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type, print_inner_attributes(s, attrs); - for blk.node.view_items.each |vi| { print_view_item(s, vi); } + for blk.node.view_items.each |vi| { print_view_item(s, *vi); } for blk.node.stmts.each |st| { - print_stmt(s, *st); + print_stmt(s, **st); } match blk.node.expr { Some(expr) => { @@ -956,7 +960,7 @@ fn print_mac(s: ps, m: ast::mac) { print_path(s, pth, false); word(s.s, ~"!"); popen(s); - for tts.each() |tt| { print_tt(s, tt); } + for tts.each() |tt| { print_tt(s, *tt); } pclose(s); } ast::mac_ellipsis => word(s.s, ~"..."), @@ -1167,7 +1171,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) { if first { first = false; } else { space(s.s); word_space(s, ~"|"); } - print_pat(s, p); + print_pat(s, *p); } space(s.s); match arm.guard { @@ -1445,7 +1449,7 @@ fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) { let mut first = true; for path.idents.each |id| { if first { first = false; } else { word(s.s, ~"::"); } - print_ident(s, id); + print_ident(s, *id); } if path.rp.is_some() || !path.types.is_empty() { if colons_before_params { word(s.s, ~"::"); } @@ -1599,12 +1603,12 @@ fn print_fn_args(s: ps, decl: ast::fn_decl, box(s, 0u, inconsistent); let mut first = true; for opt_self_ty.each |self_ty| { - first = !print_self_ty(s, self_ty); + first = !print_self_ty(s, *self_ty); } for decl.inputs.each |arg| { if first { first = false; } else { word_space(s, ~","); } - print_arg(s, arg); + print_arg(s, *arg); } for cap_items.each |cap_item| { @@ -1836,11 +1840,11 @@ fn print_ty_fn(s: ps, opt_proto: Option<ast::proto>, purity: ast::purity, box(s, 0u, inconsistent); let mut first = true; for opt_self_ty.each |self_ty| { - first = !print_self_ty(s, self_ty); + first = !print_self_ty(s, *self_ty); } for decl.inputs.each |arg| { if first { first = false; } else { word_space(s, ~","); } - print_arg(s, arg); + print_arg(s, *arg); } end(s); pclose(s); @@ -1988,7 +1992,7 @@ fn print_comment(s: ps, cmnt: comments::cmnt) { for cmnt.lines.each |line| { // Don't print empty lines because they will end up as trailing // whitespace - if str::is_not_empty(line) { word(s.s, line); } + if str::is_not_empty(*line) { word(s.s, *line); } hardbreak(s.s); } } @@ -2000,7 +2004,7 @@ fn print_comment(s: ps, cmnt: comments::cmnt) { } else { ibox(s, 0u); for cmnt.lines.each |line| { - if str::is_not_empty(line) { word(s.s, line); } + if str::is_not_empty(*line) { word(s.s, *line); } hardbreak(s.s); } end(s); diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 1a832bf5af0..15b9e34566f 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -21,7 +21,7 @@ fn mk<T:Eq IterBytes Hash Const Copy>() -> interner<T> { fn mk_prefill<T:Eq IterBytes Hash Const Copy>(init: ~[T]) -> interner<T> { let rv = mk(); - for init.each() |v| { rv.intern(v); } + for init.each() |v| { rv.intern(*v); } return rv; } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 4c48a2bea70..4392ed55219 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -98,7 +98,7 @@ fn visit_crate_directive<E>(cd: @crate_directive, e: E, v: vt<E>) { match cd.node { cdir_src_mod(_, _) => (), cdir_dir_mod(_, cdirs, _) => for cdirs.each |cdir| { - visit_crate_directive(cdir, e, v); + visit_crate_directive(*cdir, e, v); }, cdir_view_item(vi) => v.visit_view_item(vi, e, v), cdir_syntax(_) => () @@ -106,8 +106,8 @@ fn visit_crate_directive<E>(cd: @crate_directive, e: E, v: vt<E>) { } fn visit_mod<E>(m: _mod, _sp: span, _id: node_id, e: E, v: vt<E>) { - for m.view_items.each |vi| { v.visit_view_item(vi, e, v); } - for m.items.each |i| { v.visit_item(i, e, v); } + for m.view_items.each |vi| { v.visit_view_item(*vi, e, v); } + for m.items.each |i| { v.visit_item(*i, e, v); } } fn visit_view_item<E>(_vi: @view_item, _e: E, _v: vt<E>) { } @@ -132,8 +132,8 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) { } item_mod(m) => v.visit_mod(m, i.span, i.id, e, v), item_foreign_mod(nm) => { - for nm.view_items.each |vi| { v.visit_view_item(vi, e, v); } - for nm.items.each |ni| { v.visit_foreign_item(ni, e, v); } + for nm.view_items.each |vi| { v.visit_view_item(*vi, e, v); } + for nm.items.each |ni| { v.visit_foreign_item(*ni, e, v); } } item_ty(t, tps) => { v.visit_ty(t, e, v); @@ -150,7 +150,7 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) { } v.visit_ty(ty, e, v); for methods.each |m| { - visit_method_helper(m, e, v) + visit_method_helper(*m, e, v) } } item_class(struct_def, tps) => { @@ -161,7 +161,7 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) { v.visit_ty_params(tps, e, v); for traits.each |p| { visit_path(p.path, e, v); } for methods.each |m| { - v.visit_trait_method(m, e, v); + v.visit_trait_method(*m, e, v); } } item_mac(m) => visit_mac(m, e, v) @@ -198,7 +198,7 @@ fn visit_ty<E>(t: @ty, e: E, v: vt<E>) { v.visit_ty(f.node.mt.ty, e, v); }, ty_tup(ts) => for ts.each |tt| { - v.visit_ty(tt, e, v); + v.visit_ty(*tt, e, v); }, ty_fn(_, _, bounds, decl) => { for decl.inputs.each |a| { v.visit_ty(a.ty, e, v); } @@ -215,7 +215,7 @@ fn visit_ty<E>(t: @ty, e: E, v: vt<E>) { } fn visit_path<E>(p: @path, e: E, v: vt<E>) { - for p.types.each |tp| { v.visit_ty(tp, e, v); } + for p.types.each |tp| { v.visit_ty(*tp, e, v); } } fn visit_pat<E>(p: @pat, e: E, v: vt<E>) { @@ -223,7 +223,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) { pat_enum(path, children) => { visit_path(path, e, v); do option::iter(children) |children| { - for children.each |child| { v.visit_pat(child, e, v); }} + for children.each |child| { v.visit_pat(*child, e, v); }} } pat_rec(fields, _) => for fields.each |f| { v.visit_pat(f.pat, e, v) @@ -235,7 +235,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) { } } pat_tup(elts) => for elts.each |elt| { - v.visit_pat(elt, e, v) + v.visit_pat(*elt, e, v) }, pat_box(inner) | pat_uniq(inner) | pat_region(inner) => v.visit_pat(inner, e, v), @@ -333,12 +333,14 @@ fn visit_trait_method<E>(m: trait_method, e: E, v: vt<E>) { fn visit_struct_def<E>(sd: @struct_def, nm: ast::ident, tps: ~[ty_param], id: node_id, e: E, v: vt<E>) { for sd.fields.each |f| { - v.visit_struct_field(f, e, v); + v.visit_struct_field(*f, e, v); } for sd.methods.each |m| { - v.visit_struct_method(m, e, v); + v.visit_struct_method(*m, e, v); + } + for sd.traits.each |p| { + visit_path(p.path, e, v); } - for sd.traits.each |p| { visit_path(p.path, e, v); } do option::iter(sd.ctor) |ctor| { visit_class_ctor_helper(ctor, nm, tps, ast_util::local_def(id), e, v); }; @@ -356,8 +358,12 @@ fn visit_struct_method<E>(m: @method, e: E, v: vt<E>) { } fn visit_block<E>(b: ast::blk, e: E, v: vt<E>) { - for b.node.view_items.each |vi| { v.visit_view_item(vi, e, v); } - for b.node.stmts.each |s| { v.visit_stmt(s, e, v); } + for b.node.view_items.each |vi| { + v.visit_view_item(*vi, e, v); + } + for b.node.stmts.each |s| { + v.visit_stmt(*s, e, v); + } visit_expr_opt(b.node.expr, e, v); } @@ -372,7 +378,7 @@ fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) { fn visit_decl<E>(d: @decl, e: E, v: vt<E>) { match d.node { decl_local(locs) => for locs.each |loc| { - v.visit_local(loc, e, v) + v.visit_local(*loc, e, v) }, decl_item(it) => v.visit_item(it, e, v) } @@ -383,7 +389,7 @@ fn visit_expr_opt<E>(eo: Option<@expr>, e: E, v: vt<E>) { } fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) { - for exprs.each |ex| { v.visit_expr(ex, e, v); } + for exprs.each |ex| { v.visit_expr(*ex, e, v); } } fn visit_mac<E>(m: mac, e: E, v: vt<E>) { @@ -414,7 +420,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) { for flds.each |f| { v.visit_expr(f.node.expr, e, v); } visit_expr_opt(base, e, v); } - expr_tup(elts) => for elts.each |el| { v.visit_expr(el, e, v); }, + expr_tup(elts) => for elts.each |el| { v.visit_expr(*el, e, v); }, expr_call(callee, args, _) => { visit_exprs(args, e, v); v.visit_expr(callee, e, v); @@ -436,7 +442,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) { expr_loop(b, _) => v.visit_block(b, e, v), expr_match(x, arms) => { v.visit_expr(x, e, v); - for arms.each |a| { v.visit_arm(a, e, v); } + for arms.each |a| { v.visit_arm(*a, e, v); } } expr_fn(proto, decl, body, cap_clause) => { v.visit_fn(fk_anon(proto, cap_clause), decl, body, @@ -458,7 +464,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) { } expr_field(x, _, tys) => { v.visit_expr(x, e, v); - for tys.each |tp| { v.visit_ty(tp, e, v); } + for tys.each |tp| { v.visit_ty(*tp, e, v); } } expr_index(a, b) => { v.visit_expr(a, e, v); v.visit_expr(b, e, v); } expr_path(p) => visit_path(p, e, v), @@ -476,7 +482,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) { } fn visit_arm<E>(a: arm, e: E, v: vt<E>) { - for a.pats.each |p| { v.visit_pat(p, e, v); } + for a.pats.each |p| { v.visit_pat(*p, e, v); } visit_expr_opt(a.guard, e, v); v.visit_block(a.body, e, v); } |
