Skip to content

Commit e244f10

Browse files
committed
libsyntax: Get rid of uses of move and don't parse it.
1 parent 99b3c07 commit e244f10

File tree

14 files changed

+123
-130
lines changed

14 files changed

+123
-130
lines changed

src/libsyntax/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub fn sort_meta_items(+items: ~[@ast::meta_item]) -> ~[@ast::meta_item] {
270270
// This is sort of stupid here, converting to a vec of mutables and back
271271
let mut v: ~[@ast::meta_item] = items;
272272
std::sort::quick_sort(v, lteq);
273-
move v
273+
v
274274
}
275275
276276
pub fn remove_meta_items_by_name(items: ~[@ast::meta_item], name: ~str) ->

src/libsyntax/codemap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ pub impl<D: Decoder> span: Decodable<D> {
152152
}
153153

154154
pub pure fn spanned<T>(+lo: BytePos, +hi: BytePos, +t: T) -> spanned<T> {
155-
respan(mk_sp(lo, hi), move t)
155+
respan(mk_sp(lo, hi), t)
156156
}
157157

158158
pub pure fn respan<T>(sp: span, +t: T) -> spanned<T> {
159159
spanned {node: t, span: sp}
160160
}
161161

162162
pub pure fn dummy_spanned<T>(+t: T) -> spanned<T> {
163-
respan(dummy_sp(), move t)
163+
respan(dummy_sp(), t)
164164
}
165165

166166
/* assuming that we're not in macro expansion */

src/libsyntax/ext/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ pub fn mk_ctxt(parse_sess: parse::parse_sess,
281281
mod_path: ~[],
282282
trace_mac: false
283283
};
284-
move ((move imp) as @ext_ctxt)
284+
((imp) as @ext_ctxt)
285285
}
286286

287287
pub fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {

src/libsyntax/ext/build.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn mk_raw_path_(sp: span,
7373
global: false,
7474
idents: idents,
7575
rp: None,
76-
types: move types }
76+
types: types }
7777
}
7878
pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path {
7979
@ast::path { span: sp,
@@ -156,7 +156,7 @@ pub fn mk_field(sp: span, f: &{ident: ast::ident, ex: @ast::expr})
156156
}
157157
pub fn mk_fields(sp: span, fields: ~[{ident: ast::ident, ex: @ast::expr}])
158158
-> ~[ast::field] {
159-
move fields.map(|f| mk_field(sp, f))
159+
fields.map(|f| mk_field(sp, f))
160160
}
161161
pub fn mk_rec_e(cx: ext_ctxt,
162162
sp: span,
@@ -288,41 +288,41 @@ pub fn mk_pat_ident_with_binding_mode(cx: ext_ctxt,
288288
bm: ast::binding_mode) -> @ast::pat {
289289
let path = mk_raw_path(span, ~[ ident ]);
290290
let pat = ast::pat_ident(bm, path, None);
291-
mk_pat(cx, span, move pat)
291+
mk_pat(cx, span, pat)
292292
}
293293
pub fn mk_pat_enum(cx: ext_ctxt,
294294
span: span,
295295
path: @ast::path,
296296
+subpats: ~[@ast::pat])
297297
-> @ast::pat {
298-
let pat = ast::pat_enum(path, Some(move subpats));
299-
mk_pat(cx, span, move pat)
298+
let pat = ast::pat_enum(path, Some(subpats));
299+
mk_pat(cx, span, pat)
300300
}
301301
pub fn mk_pat_struct(cx: ext_ctxt,
302302
span: span,
303303
path: @ast::path,
304304
+field_pats: ~[ast::field_pat])
305305
-> @ast::pat {
306-
let pat = ast::pat_struct(path, move field_pats, false);
307-
mk_pat(cx, span, move pat)
306+
let pat = ast::pat_struct(path, field_pats, false);
307+
mk_pat(cx, span, pat)
308308
}
309309
pub fn mk_bool(cx: ext_ctxt, span: span, value: bool) -> @ast::expr {
310310
let lit_expr = ast::expr_lit(@codemap::spanned {
311311
node: ast::lit_bool(value),
312312
span: span });
313-
build::mk_expr(cx, span, move lit_expr)
313+
build::mk_expr(cx, span, lit_expr)
314314
}
315315
pub fn mk_stmt(cx: ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt {
316316
let stmt_ = ast::stmt_semi(expr, cx.next_id());
317-
@codemap::spanned { node: move stmt_, span: span }
317+
@codemap::spanned { node: stmt_, span: span }
318318
}
319319
pub fn mk_ty_path(cx: ext_ctxt,
320320
span: span,
321321
idents: ~[ ast::ident ])
322322
-> @ast::Ty {
323323
let ty = build::mk_raw_path(span, idents);
324324
let ty = ast::ty_path(ty, cx.next_id());
325-
let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span };
325+
let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span };
326326
ty
327327
}
328328
pub fn mk_ty_path_global(cx: ext_ctxt,
@@ -331,7 +331,7 @@ pub fn mk_ty_path_global(cx: ext_ctxt,
331331
-> @ast::Ty {
332332
let ty = build::mk_raw_path_global(span, idents);
333333
let ty = ast::ty_path(ty, cx.next_id());
334-
let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span };
334+
let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span };
335335
ty
336336
}
337337
pub fn mk_simple_ty_path(cx: ext_ctxt,

src/libsyntax/ext/deriving.rs

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,27 @@ fn expand_deriving(cx: ext_ctxt,
9595
span,
9696
struct_def,
9797
item.ident,
98-
move ty_params));
98+
ty_params));
9999
}
100100
item_enum(ref enum_definition, copy ty_params) => {
101101
result.push(expand_deriving_enum_def(cx,
102102
span,
103103
enum_definition,
104104
item.ident,
105-
move ty_params));
105+
ty_params));
106106
}
107107
_ => ()
108108
}
109109
}
110-
dvec::unwrap(move result)
110+
dvec::unwrap(result)
111111
}
112112

113113
fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item {
114114
@ast::item {
115115
ident: clownshoes_extensions,
116116
attrs: ~[],
117117
id: cx.next_id(),
118-
node: move item,
118+
node: item,
119119
vis: public,
120120
span: span,
121121
}
@@ -161,7 +161,7 @@ fn create_eq_method(cx: ext_ctxt,
161161
};
162162

163163
// Create the function declaration.
164-
let fn_decl = build::mk_fn_decl(~[ move arg ], output_type);
164+
let fn_decl = build::mk_fn_decl(~[ arg ], output_type);
165165

166166
// Create the body block.
167167
let body_block = build::mk_simple_block(cx, span, body);
@@ -174,8 +174,8 @@ fn create_eq_method(cx: ext_ctxt,
174174
tps: ~[],
175175
self_ty: self_ty,
176176
purity: pure_fn,
177-
decl: move fn_decl,
178-
body: move body_block,
177+
decl: fn_decl,
178+
body: body_block,
179179
id: cx.next_id(),
180180
span: span,
181181
self_id: cx.next_id(),
@@ -194,14 +194,14 @@ fn create_self_type_with_params(cx: ext_ctxt,
194194
let self_ty_param = build::mk_simple_ty_path(cx,
195195
span,
196196
ty_param.ident);
197-
self_ty_params.push(move self_ty_param);
197+
self_ty_params.push(self_ty_param);
198198
}
199-
let self_ty_params = dvec::unwrap(move self_ty_params);
199+
let self_ty_params = dvec::unwrap(self_ty_params);
200200

201201
// Create the type of `self`.
202202
let self_type = build::mk_raw_path_(span,
203203
~[ type_ident ],
204-
move self_ty_params);
204+
self_ty_params);
205205
let self_type = ty_path(self_type, cx.next_id());
206206
@ast::Ty { id: cx.next_id(), node: self_type, span: span }
207207
}
@@ -221,9 +221,9 @@ fn create_derived_impl(cx: ext_ctxt,
221221
trait_path.map(|x| *x));
222222
let bounds = @~[ TraitTyParamBound(bound) ];
223223
let impl_ty_param = build::mk_ty_param(cx, ty_param.ident, bounds);
224-
impl_ty_params.push(move impl_ty_param);
224+
impl_ty_params.push(impl_ty_param);
225225
}
226-
let impl_ty_params = dvec::unwrap(move impl_ty_params);
226+
let impl_ty_params = dvec::unwrap(impl_ty_params);
227227

228228
// Create the reference to the trait.
229229
let trait_path = ast::path {
@@ -233,12 +233,12 @@ fn create_derived_impl(cx: ext_ctxt,
233233
rp: None,
234234
types: ~[]
235235
};
236-
let trait_path = @move trait_path;
236+
let trait_path = @trait_path;
237237
let trait_ref = ast::trait_ref {
238238
path: trait_path,
239239
ref_id: cx.next_id()
240240
};
241-
let trait_ref = @move trait_ref;
241+
let trait_ref = @trait_ref;
242242

243243
// Create the type of `self`.
244244
let self_type = create_self_type_with_params(cx,
@@ -247,11 +247,11 @@ fn create_derived_impl(cx: ext_ctxt,
247247
ty_params);
248248

249249
// Create the impl item.
250-
let impl_item = item_impl(move impl_ty_params,
250+
let impl_item = item_impl(impl_ty_params,
251251
Some(trait_ref),
252252
self_type,
253253
methods.map(|x| *x));
254-
return create_impl_item(cx, span, move impl_item);
254+
return create_impl_item(cx, span, impl_item);
255255
}
256256

257257
fn create_derived_eq_impl(cx: ext_ctxt,
@@ -310,11 +310,11 @@ fn create_iter_bytes_method(cx: ext_ctxt,
310310
let output_type = @ast::Ty { id: cx.next_id(), node: ty_nil, span: span };
311311

312312
// Create the function declaration.
313-
let inputs = ~[ move lsb0_arg, move f_arg ];
314-
let fn_decl = build::mk_fn_decl(move inputs, output_type);
313+
let inputs = ~[ lsb0_arg, f_arg ];
314+
let fn_decl = build::mk_fn_decl(inputs, output_type);
315315

316316
// Create the body block.
317-
let body_block = build::mk_block_(cx, span, move statements);
317+
let body_block = build::mk_block_(cx, span, statements);
318318

319319
// Create the method.
320320
let self_ty = spanned { node: sty_region(m_imm), span: span };
@@ -325,8 +325,8 @@ fn create_iter_bytes_method(cx: ext_ctxt,
325325
tps: ~[],
326326
self_ty: self_ty,
327327
purity: pure_fn,
328-
decl: move fn_decl,
329-
body: move body_block,
328+
decl: fn_decl,
329+
body: body_block,
330330
id: cx.next_id(),
331331
span: span,
332332
self_id: cx.next_id(),
@@ -348,10 +348,10 @@ fn create_subpatterns(cx: ext_ctxt,
348348
// Create the subpattern.
349349
let subpath = build::mk_raw_path(span, ~[ ident ]);
350350
let subpat = pat_ident(bind_by_ref(m_imm), subpath, None);
351-
let subpat = build::mk_pat(cx, span, move subpat);
351+
let subpat = build::mk_pat(cx, span, subpat);
352352
subpats.push(subpat);
353353
}
354-
return dvec::unwrap(move subpats);
354+
return dvec::unwrap(subpats);
355355
}
356356

357357
fn create_enum_variant_pattern(cx: ext_ctxt,
@@ -373,7 +373,7 @@ fn create_enum_variant_pattern(cx: ext_ctxt,
373373
prefix,
374374
variant_args.len());
375375

376-
return build::mk_pat_enum(cx, span, matching_path, move subpats);
376+
return build::mk_pat_enum(cx, span, matching_path, subpats);
377377
}
378378
struct_variant_kind(struct_def) => {
379379
let matching_path = build::mk_raw_path(span, ~[ variant_ident ]);
@@ -508,7 +508,7 @@ fn expand_deriving_eq_struct_def(cx: ext_ctxt,
508508
return create_derived_eq_impl(cx,
509509
span,
510510
type_ident,
511-
move ty_params,
511+
ty_params,
512512
eq_method,
513513
ne_method);
514514
}
@@ -541,7 +541,7 @@ fn expand_deriving_eq_enum_def(cx: ext_ctxt,
541541
return create_derived_eq_impl(cx,
542542
span,
543543
type_ident,
544-
move ty_params,
544+
ty_params,
545545
eq_method,
546546
ne_method);
547547
}
@@ -561,7 +561,7 @@ fn expand_deriving_iter_bytes_struct_def(cx: ext_ctxt,
561561
return create_derived_iter_bytes_impl(cx,
562562
span,
563563
type_ident,
564-
move ty_params,
564+
ty_params,
565565
method);
566566
}
567567

@@ -580,7 +580,7 @@ fn expand_deriving_iter_bytes_enum_def(cx: ext_ctxt,
580580
return create_derived_iter_bytes_impl(cx,
581581
span,
582582
type_ident,
583-
move ty_params,
583+
ty_params,
584584
method);
585585
}
586586

@@ -671,8 +671,8 @@ fn expand_deriving_iter_bytes_struct_method(cx: ext_ctxt,
671671
}
672672

673673
// Create the method itself.
674-
let statements = dvec::unwrap(move statements);
675-
return create_iter_bytes_method(cx, span, move statements);
674+
let statements = dvec::unwrap(statements);
675+
return create_iter_bytes_method(cx, span, statements);
676676
}
677677

678678
fn expand_deriving_eq_enum_method(cx: ext_ctxt,
@@ -738,9 +738,9 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
738738
let matching_arm = ast::arm {
739739
pats: ~[ matching_pat ],
740740
guard: None,
741-
body: move matching_body_block
741+
body: matching_body_block
742742
};
743-
other_arms.push(move matching_arm);
743+
other_arms.push(matching_arm);
744744

745745
// Maybe generate a non-matching case. If there is only one
746746
// variant then there will always be a match.
@@ -777,11 +777,11 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
777777
// Create the self pattern body.
778778
let other_expr = build::mk_path(cx, span, ~[ other_ident ]);
779779
let other_expr = build::mk_unary(cx, span, deref, other_expr);
780-
let other_arms = dvec::unwrap(move other_arms);
781-
let other_match_expr = expr_match(other_expr, move other_arms);
780+
let other_arms = dvec::unwrap(other_arms);
781+
let other_match_expr = expr_match(other_expr, other_arms);
782782
let other_match_expr = build::mk_expr(cx,
783783
span,
784-
move other_match_expr);
784+
other_match_expr);
785785
let other_match_body_block = build::mk_simple_block(cx,
786786
span,
787787
other_match_expr);
@@ -792,15 +792,15 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
792792
guard: None,
793793
body: other_match_body_block,
794794
};
795-
self_arms.push(move self_arm);
795+
self_arms.push(self_arm);
796796
}
797797

798798
// Create the method body.
799799
let self_expr = build::mk_path(cx, span, ~[ self_ident ]);
800800
let self_expr = build::mk_unary(cx, span, deref, self_expr);
801-
let self_arms = dvec::unwrap(move self_arms);
802-
let self_match_expr = expr_match(self_expr, move self_arms);
803-
let self_match_expr = build::mk_expr(cx, span, move self_match_expr);
801+
let self_arms = dvec::unwrap(self_arms);
802+
let self_match_expr = expr_match(self_expr, self_arms);
803+
let self_match_expr = build::mk_expr(cx, span, self_match_expr);
804804

805805
// Create the method.
806806
return create_eq_method(cx,
@@ -848,8 +848,8 @@ fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt,
848848
}
849849

850850
// Create the pattern body.
851-
let stmts = dvec::unwrap(move stmts);
852-
let match_body_block = build::mk_block_(cx, span, move stmts);
851+
let stmts = dvec::unwrap(stmts);
852+
let match_body_block = build::mk_block_(cx, span, stmts);
853853

854854
// Create the arm.
855855
ast::arm {

src/libsyntax/ext/pipes/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn analyze(proto: protocol, _cx: ext_ctxt) {
5353
for state.reachable |s| {
5454
bv.set(s.id, true);
5555
}
56-
move bv
56+
bv
5757
};
5858

5959
let mut i = 0;

0 commit comments

Comments
 (0)