diff options
| author | Luqman Aden <laden@mozilla.com> | 2013-02-15 01:15:53 -0800 |
|---|---|---|
| committer | Luqman Aden <laden@mozilla.com> | 2013-02-15 02:49:55 -0800 |
| commit | e244f103c9622ef0d13b138ec6f8425840201def (patch) | |
| tree | 90dfaa8da5f602e30f05597a12be1d6f81e6f512 /src/libsyntax/ext | |
| parent | 99b3c07b4e788d7120c2754f69613f760a6efd0a (diff) | |
| download | rust-e244f103c9622ef0d13b138ec6f8425840201def.tar.gz rust-e244f103c9622ef0d13b138ec6f8425840201def.zip | |
libsyntax: Get rid of uses of `move` and don't parse it.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving.rs | 82 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/liveness.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 32 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 28 |
7 files changed, 85 insertions, 85 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 951e350f8b2..33eaaaae35b 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -281,7 +281,7 @@ pub fn mk_ctxt(parse_sess: parse::parse_sess, mod_path: ~[], trace_mac: false }; - move ((move imp) as @ext_ctxt) + ((imp) as @ext_ctxt) } pub fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str { diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index a050b2316e8..963ea5bfe33 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -73,7 +73,7 @@ pub fn mk_raw_path_(sp: span, global: false, idents: idents, rp: None, - types: move types } + types: types } } pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path { @ast::path { span: sp, @@ -156,7 +156,7 @@ pub fn mk_field(sp: span, f: &{ident: ast::ident, ex: @ast::expr}) } pub fn mk_fields(sp: span, fields: ~[{ident: ast::ident, ex: @ast::expr}]) -> ~[ast::field] { - move fields.map(|f| mk_field(sp, f)) + fields.map(|f| mk_field(sp, f)) } pub fn mk_rec_e(cx: ext_ctxt, sp: span, @@ -288,33 +288,33 @@ pub fn mk_pat_ident_with_binding_mode(cx: ext_ctxt, bm: ast::binding_mode) -> @ast::pat { let path = mk_raw_path(span, ~[ ident ]); let pat = ast::pat_ident(bm, path, None); - mk_pat(cx, span, move pat) + mk_pat(cx, span, pat) } pub fn mk_pat_enum(cx: ext_ctxt, span: span, path: @ast::path, +subpats: ~[@ast::pat]) -> @ast::pat { - let pat = ast::pat_enum(path, Some(move subpats)); - mk_pat(cx, span, move pat) + let pat = ast::pat_enum(path, Some(subpats)); + mk_pat(cx, span, pat) } pub fn mk_pat_struct(cx: ext_ctxt, span: span, path: @ast::path, +field_pats: ~[ast::field_pat]) -> @ast::pat { - let pat = ast::pat_struct(path, move field_pats, false); - mk_pat(cx, span, move pat) + let pat = ast::pat_struct(path, field_pats, false); + mk_pat(cx, span, pat) } pub fn mk_bool(cx: ext_ctxt, span: span, value: bool) -> @ast::expr { let lit_expr = ast::expr_lit(@codemap::spanned { node: ast::lit_bool(value), span: span }); - build::mk_expr(cx, span, move lit_expr) + build::mk_expr(cx, span, lit_expr) } pub fn mk_stmt(cx: ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt { let stmt_ = ast::stmt_semi(expr, cx.next_id()); - @codemap::spanned { node: move stmt_, span: span } + @codemap::spanned { node: stmt_, span: span } } pub fn mk_ty_path(cx: ext_ctxt, span: span, @@ -322,7 +322,7 @@ pub fn mk_ty_path(cx: ext_ctxt, -> @ast::Ty { let ty = build::mk_raw_path(span, idents); let ty = ast::ty_path(ty, cx.next_id()); - let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span }; + let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span }; ty } pub fn mk_ty_path_global(cx: ext_ctxt, @@ -331,7 +331,7 @@ pub fn mk_ty_path_global(cx: ext_ctxt, -> @ast::Ty { let ty = build::mk_raw_path_global(span, idents); let ty = ast::ty_path(ty, cx.next_id()); - let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span }; + let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span }; ty } pub fn mk_simple_ty_path(cx: ext_ctxt, diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index 8e87357f8b5..1aa1d8ca9a0 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -95,19 +95,19 @@ fn expand_deriving(cx: ext_ctxt, span, struct_def, item.ident, - move ty_params)); + ty_params)); } item_enum(ref enum_definition, copy ty_params) => { result.push(expand_deriving_enum_def(cx, span, enum_definition, item.ident, - move ty_params)); + ty_params)); } _ => () } } - dvec::unwrap(move result) + dvec::unwrap(result) } fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item { @@ -115,7 +115,7 @@ fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item { ident: clownshoes_extensions, attrs: ~[], id: cx.next_id(), - node: move item, + node: item, vis: public, span: span, } @@ -161,7 +161,7 @@ fn create_eq_method(cx: ext_ctxt, }; // Create the function declaration. - let fn_decl = build::mk_fn_decl(~[ move arg ], output_type); + let fn_decl = build::mk_fn_decl(~[ arg ], output_type); // Create the body block. let body_block = build::mk_simple_block(cx, span, body); @@ -174,8 +174,8 @@ fn create_eq_method(cx: ext_ctxt, tps: ~[], self_ty: self_ty, purity: pure_fn, - decl: move fn_decl, - body: move body_block, + decl: fn_decl, + body: body_block, id: cx.next_id(), span: span, self_id: cx.next_id(), @@ -194,14 +194,14 @@ fn create_self_type_with_params(cx: ext_ctxt, let self_ty_param = build::mk_simple_ty_path(cx, span, ty_param.ident); - self_ty_params.push(move self_ty_param); + self_ty_params.push(self_ty_param); } - let self_ty_params = dvec::unwrap(move self_ty_params); + let self_ty_params = dvec::unwrap(self_ty_params); // Create the type of `self`. let self_type = build::mk_raw_path_(span, ~[ type_ident ], - move self_ty_params); + self_ty_params); let self_type = ty_path(self_type, cx.next_id()); @ast::Ty { id: cx.next_id(), node: self_type, span: span } } @@ -221,9 +221,9 @@ fn create_derived_impl(cx: ext_ctxt, trait_path.map(|x| *x)); let bounds = @~[ TraitTyParamBound(bound) ]; let impl_ty_param = build::mk_ty_param(cx, ty_param.ident, bounds); - impl_ty_params.push(move impl_ty_param); + impl_ty_params.push(impl_ty_param); } - let impl_ty_params = dvec::unwrap(move impl_ty_params); + let impl_ty_params = dvec::unwrap(impl_ty_params); // Create the reference to the trait. let trait_path = ast::path { @@ -233,12 +233,12 @@ fn create_derived_impl(cx: ext_ctxt, rp: None, types: ~[] }; - let trait_path = @move trait_path; + let trait_path = @trait_path; let trait_ref = ast::trait_ref { path: trait_path, ref_id: cx.next_id() }; - let trait_ref = @move trait_ref; + let trait_ref = @trait_ref; // Create the type of `self`. let self_type = create_self_type_with_params(cx, @@ -247,11 +247,11 @@ fn create_derived_impl(cx: ext_ctxt, ty_params); // Create the impl item. - let impl_item = item_impl(move impl_ty_params, + let impl_item = item_impl(impl_ty_params, Some(trait_ref), self_type, methods.map(|x| *x)); - return create_impl_item(cx, span, move impl_item); + return create_impl_item(cx, span, impl_item); } fn create_derived_eq_impl(cx: ext_ctxt, @@ -310,11 +310,11 @@ fn create_iter_bytes_method(cx: ext_ctxt, let output_type = @ast::Ty { id: cx.next_id(), node: ty_nil, span: span }; // Create the function declaration. - let inputs = ~[ move lsb0_arg, move f_arg ]; - let fn_decl = build::mk_fn_decl(move inputs, output_type); + let inputs = ~[ lsb0_arg, f_arg ]; + let fn_decl = build::mk_fn_decl(inputs, output_type); // Create the body block. - let body_block = build::mk_block_(cx, span, move statements); + let body_block = build::mk_block_(cx, span, statements); // Create the method. let self_ty = spanned { node: sty_region(m_imm), span: span }; @@ -325,8 +325,8 @@ fn create_iter_bytes_method(cx: ext_ctxt, tps: ~[], self_ty: self_ty, purity: pure_fn, - decl: move fn_decl, - body: move body_block, + decl: fn_decl, + body: body_block, id: cx.next_id(), span: span, self_id: cx.next_id(), @@ -348,10 +348,10 @@ fn create_subpatterns(cx: ext_ctxt, // Create the subpattern. let subpath = build::mk_raw_path(span, ~[ ident ]); let subpat = pat_ident(bind_by_ref(m_imm), subpath, None); - let subpat = build::mk_pat(cx, span, move subpat); + let subpat = build::mk_pat(cx, span, subpat); subpats.push(subpat); } - return dvec::unwrap(move subpats); + return dvec::unwrap(subpats); } fn create_enum_variant_pattern(cx: ext_ctxt, @@ -373,7 +373,7 @@ fn create_enum_variant_pattern(cx: ext_ctxt, prefix, variant_args.len()); - return build::mk_pat_enum(cx, span, matching_path, move subpats); + return build::mk_pat_enum(cx, span, matching_path, subpats); } struct_variant_kind(struct_def) => { let matching_path = build::mk_raw_path(span, ~[ variant_ident ]); @@ -508,7 +508,7 @@ fn expand_deriving_eq_struct_def(cx: ext_ctxt, return create_derived_eq_impl(cx, span, type_ident, - move ty_params, + ty_params, eq_method, ne_method); } @@ -541,7 +541,7 @@ fn expand_deriving_eq_enum_def(cx: ext_ctxt, return create_derived_eq_impl(cx, span, type_ident, - move ty_params, + ty_params, eq_method, ne_method); } @@ -561,7 +561,7 @@ fn expand_deriving_iter_bytes_struct_def(cx: ext_ctxt, return create_derived_iter_bytes_impl(cx, span, type_ident, - move ty_params, + ty_params, method); } @@ -580,7 +580,7 @@ fn expand_deriving_iter_bytes_enum_def(cx: ext_ctxt, return create_derived_iter_bytes_impl(cx, span, type_ident, - move ty_params, + ty_params, method); } @@ -671,8 +671,8 @@ fn expand_deriving_iter_bytes_struct_method(cx: ext_ctxt, } // Create the method itself. - let statements = dvec::unwrap(move statements); - return create_iter_bytes_method(cx, span, move statements); + let statements = dvec::unwrap(statements); + return create_iter_bytes_method(cx, span, statements); } fn expand_deriving_eq_enum_method(cx: ext_ctxt, @@ -738,9 +738,9 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt, let matching_arm = ast::arm { pats: ~[ matching_pat ], guard: None, - body: move matching_body_block + body: matching_body_block }; - other_arms.push(move matching_arm); + other_arms.push(matching_arm); // Maybe generate a non-matching case. If there is only one // variant then there will always be a match. @@ -777,11 +777,11 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt, // Create the self pattern body. let other_expr = build::mk_path(cx, span, ~[ other_ident ]); let other_expr = build::mk_unary(cx, span, deref, other_expr); - let other_arms = dvec::unwrap(move other_arms); - let other_match_expr = expr_match(other_expr, move other_arms); + let other_arms = dvec::unwrap(other_arms); + let other_match_expr = expr_match(other_expr, other_arms); let other_match_expr = build::mk_expr(cx, span, - move other_match_expr); + other_match_expr); let other_match_body_block = build::mk_simple_block(cx, span, other_match_expr); @@ -792,15 +792,15 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt, guard: None, body: other_match_body_block, }; - self_arms.push(move self_arm); + self_arms.push(self_arm); } // Create the method body. let self_expr = build::mk_path(cx, span, ~[ self_ident ]); let self_expr = build::mk_unary(cx, span, deref, self_expr); - let self_arms = dvec::unwrap(move self_arms); - let self_match_expr = expr_match(self_expr, move self_arms); - let self_match_expr = build::mk_expr(cx, span, move self_match_expr); + let self_arms = dvec::unwrap(self_arms); + let self_match_expr = expr_match(self_expr, self_arms); + let self_match_expr = build::mk_expr(cx, span, self_match_expr); // Create the method. return create_eq_method(cx, @@ -848,8 +848,8 @@ fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt, } // Create the pattern body. - let stmts = dvec::unwrap(move stmts); - let match_body_block = build::mk_block_(cx, span, move stmts); + let stmts = dvec::unwrap(stmts); + let match_body_block = build::mk_block_(cx, span, stmts); // Create the arm. ast::arm { diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index b0a8f49c7a2..c690c89c025 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -53,7 +53,7 @@ pub fn analyze(proto: protocol, _cx: ext_ctxt) { for state.reachable |s| { bv.set(s.id, true); } - move bv + bv }; let mut i = 0; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index da0ac4e08ab..0f596e66158 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -73,10 +73,10 @@ pub impl message: gen_send { if this.proto.is_bounded() { let (sp, rp) = match (this.dir, next.dir) { - (send, send) => (~"move c", ~"move s"), + (send, send) => (~"c", ~"s"), (send, recv) => (~"s", ~"c"), (recv, send) => (~"s", ~"c"), - (recv, recv) => (~"move c", ~"move s") + (recv, recv) => (~"c", ~"s") }; body += ~"let b = pipe.reuse_buffer();\n"; @@ -89,10 +89,10 @@ pub impl message: gen_send { } else { let pat = match (this.dir, next.dir) { - (send, send) => "(move c, move s)", + (send, send) => "(c, s)", (send, recv) => "(s, c)", (recv, send) => "(s, c)", - (recv, recv) => "(move c, move s)" + (recv, recv) => "(c, s)" }; body += fmt!("let %s = ::pipes::entangle();\n", pat); @@ -100,17 +100,17 @@ pub impl message: gen_send { body += fmt!("let message = %s(%s);\n", self.name(), str::connect(vec::append_one( - arg_names.map(|x| ~"move " + cx.str_of(*x)), - ~"move s"), ~", ")); + arg_names.map(|x| cx.str_of(*x)), + ~"s"), ~", ")); if !try { - body += fmt!("::pipes::send(move pipe, move message);\n"); + body += fmt!("::pipes::send(pipe, message);\n"); // return the new channel - body += ~"move c }"; + body += ~"c }"; } else { - body += fmt!("if ::pipes::send(move pipe, move message) {\n \ - ::pipes::rt::make_some(move c) \ + body += fmt!("if ::pipes::send(pipe, message) {\n \ + ::pipes::rt::make_some(c) \ } else { ::pipes::rt::make_none() } }"); } @@ -153,7 +153,7 @@ pub impl message: gen_send { ~"" } else { - ~"(" + str::connect(arg_names.map(|x| ~"move " + *x), + ~"(" + str::connect(arg_names.map(|x| *x), ~", ") + ~")" }; @@ -164,10 +164,10 @@ pub impl message: gen_send { message_args); if !try { - body += fmt!("::pipes::send(move pipe, move message);\n"); + body += fmt!("::pipes::send(pipe, message);\n"); body += ~" }"; } else { - body += fmt!("if ::pipes::send(move pipe, move message) \ + body += fmt!("if ::pipes::send(pipe, message) \ { \ ::pipes::rt::make_some(()) \ } else { \ @@ -319,7 +319,7 @@ pub impl protocol: gen_init { recv => { quote_expr!({ let (s, c) = ::pipes::entangle(); - (move c, move s) + (c, s) }) } } @@ -331,7 +331,7 @@ pub impl protocol: gen_init { recv => { quote_expr!({ let (s, c) = $body; - (move c, move s) + (c, s) }) } } @@ -375,7 +375,7 @@ pub impl protocol: gen_init { quote_expr!({ let buffer = $buffer; - do ::pipes::entangle_buffer(move buffer) |buffer, data| { + do ::pipes::entangle_buffer(buffer) |buffer, data| { $entangle_body } }) diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 6a1d9357694..1d6534aef34 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -207,7 +207,7 @@ pub impl protocol { span: self.span, dir: dir, ty_params: ty_params, - messages: move messages, + messages: messages, proto: self }); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 9e89e703c09..df10f15c709 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -279,7 +279,7 @@ pub fn parse(sess: parse_sess, } new_pos.idx += 1; - cur_eis.push(move new_pos); + cur_eis.push(new_pos); } // can we go around again? @@ -288,19 +288,19 @@ pub fn parse(sess: parse_sess, match copy ei.sep { Some(ref t) if idx == len => { // we need a separator if tok == (*t) { //pass the separator - let ei_t = move ei; + let ei_t = ei; ei_t.idx += 1; - next_eis.push(move ei_t); + next_eis.push(ei_t); } } _ => { // we don't need a separator - let ei_t = move ei; + let ei_t = ei; ei_t.idx = 0; - cur_eis.push(move ei_t); + cur_eis.push(ei_t); } } } else { - eof_eis.push(move ei); + eof_eis.push(ei); } } else { match copy ei.elts[idx].node { @@ -315,26 +315,26 @@ pub fn parse(sess: parse_sess, new_ei.matches[idx].push(@matched_seq(~[], sp)); } - cur_eis.push(move new_ei); + cur_eis.push(new_ei); } let matches = vec::map(ei.matches, // fresh, same size: |_m| DVec::<@named_match>()); - let ei_t = move ei; + let ei_t = ei; cur_eis.push(~{ elts: (*matchers), sep: (*sep), mut idx: 0u, - mut up: matcher_pos_up(Some(move ei_t)), - matches: move matches, + mut up: matcher_pos_up(Some(ei_t)), + matches: matches, match_lo: match_idx_lo, match_hi: match_idx_hi, sp_lo: sp.lo }); } - match_nonterminal(_,_,_) => { bb_eis.push(move ei) } + match_nonterminal(_,_,_) => { bb_eis.push(ei) } match_tok(ref t) => { - let ei_t = move ei; + let ei_t = ei; if (*t) == tok { ei_t.idx += 1; - next_eis.push(move ei_t); + next_eis.push(ei_t); } } } @@ -388,7 +388,7 @@ pub fn parse(sess: parse_sess, } _ => fail!() } - cur_eis.push(move ei); + cur_eis.push(ei); for rust_parser.tokens_consumed.times() || { rdr.next_token(); |
