about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-09-12 11:15:39 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-09-12 11:33:40 -0700
commit86e02554fd3e3795626cba4d50de6243c19ff972 (patch)
tree8cd8d23cc1afc252365392014e44c08554a08cc6 /src
parent320331fe35f4020b388b2ccc5128d7261473ea08 (diff)
downloadrust-86e02554fd3e3795626cba4d50de6243c19ff972.tar.gz
rust-86e02554fd3e3795626cba4d50de6243c19ff972.zip
Make moves in arguments explicit in libsyntax and rustc
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/ext/auto_serialize.rs41
-rw-r--r--src/rustc/back/link.rs2
-rw-r--r--src/rustc/driver/rustc.rs2
-rw-r--r--src/rustc/middle/trans/base.rs2
-rw-r--r--src/rustc/middle/trans/common.rs2
-rw-r--r--src/rustc/middle/trans/debuginfo.rs2
-rw-r--r--src/rustc/middle/ty.rs2
7 files changed, 27 insertions, 26 deletions
diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs
index 52357ca4752..cc72ddfc7ab 100644
--- a/src/libsyntax/ext/auto_serialize.rs
+++ b/src/libsyntax/ext/auto_serialize.rs
@@ -365,19 +365,19 @@ fn ser_variant(cx: ext_ctxt,
         let arg_blk =
             cx.blk(
                 span,
-                ser_ty(cx, tps, tys[i], cx.clone(s), v));
+                ser_ty(cx, tps, tys[i], cx.clone(s), move v));
         cx.stmt(argfn(cx.clone(s), i, arg_blk))
     };
 
     let body_blk = cx.blk(span, stmts);
-    let body = cx.blk(span, ~[cx.stmt(bodyfn(s, body_blk))]);
+    let body = cx.blk(span, ~[cx.stmt(bodyfn(move s, body_blk))]);
 
     {pats: ~[pat], guard: None, body: body}
 }
 
 fn ser_lambda(cx: ext_ctxt, tps: ser_tps_map, ty: @ast::ty,
               -s: @ast::expr, -v: @ast::expr) -> @ast::expr {
-    cx.lambda(cx.blk(ty.span, ser_ty(cx, tps, ty, s, v)))
+    cx.lambda(cx.blk(ty.span, ser_ty(cx, tps, ty, move s, move v)))
 }
 
 fn is_vec_or_str(ty: @ast::ty) -> bool {
@@ -415,7 +415,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
 
       // For unique evecs/estrs, just pass through to underlying vec or str
       ast::ty_uniq(mt) if is_vec_or_str(mt.ty) => {
-        ser_ty(cx, tps, mt.ty, s, v)
+        ser_ty(cx, tps, mt.ty, move s, move v)
       }
 
       ast::ty_uniq(mt) => {
@@ -439,7 +439,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
             let f = cx.lit_str(fld.span, cx.parse_sess().interner.get(
                 fld.node.ident));
             let i = cx.lit_uint(fld.span, fidx);
-            let l = ser_lambda(cx, tps, fld.node.mt.ty, cx.clone(s), vf);
+            let l = ser_lambda(cx, tps, fld.node.mt.ty, cx.clone(s), move vf);
             #ast[stmt]{$(s).emit_rec_field($(f), $(i), $(l));}
         };
         let fld_lambda = cx.lambda(cx.blk(ty.span, fld_stmts));
@@ -463,7 +463,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
         let arms = ~[
             ser_variant(
 
-                cx, tps, tys, ty.span, s,
+                cx, tps, tys, ty.span, move s,
 
                 // Generate pattern (v1, v2, v3)
                 |pats| ast::pat_tup(pats),
@@ -482,20 +482,19 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
                     #ast{ $(s).emit_tup_elt($(idx), $(body)) }
                 })
         ];
-        ~[cx.alt_stmt(arms, ty.span, v)]
+        ~[cx.alt_stmt(arms, ty.span, move v)]
       }
 
       ast::ty_path(path, _) => {
-        if vec::len(path.idents) == 1u &&
-            vec::is_empty(path.types) {
+        if path.idents.len() == 1 && path.types.is_empty() {
             let ident = path.idents[0];
 
             match tps.find(ident) {
               Some(f) => f(v),
-              None => ser_path(cx, tps, path, s, v)
+              None => ser_path(cx, tps, path, move s, move v)
             }
         } else {
-            ser_path(cx, tps, path, s, v)
+            ser_path(cx, tps, path, move s, move v)
         }
       }
 
@@ -634,7 +633,7 @@ fn deser_path(cx: ext_ctxt, tps: deser_tps_map, path: @ast::path,
 
 fn deser_lambda(cx: ext_ctxt, tps: deser_tps_map, ty: @ast::ty,
                 -d: @ast::expr) -> @ast::expr {
-    cx.lambda(cx.expr_blk(deser_ty(cx, tps, ty, d)))
+    cx.lambda(cx.expr_blk(deser_ty(cx, tps, ty, move d)))
 }
 
 fn deser_ty(cx: ext_ctxt, tps: deser_tps_map,
@@ -658,7 +657,7 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map,
 
       // For unique evecs/estrs, just pass through to underlying vec or str
       ast::ty_uniq(mt) if is_vec_or_str(mt.ty) => {
-        deser_ty(cx, tps, mt.ty, d)
+        deser_ty(cx, tps, mt.ty, move d)
       }
 
       ast::ty_uniq(mt) => {
@@ -719,10 +718,10 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map,
 
             match tps.find(ident) {
               Some(f) => f(),
-              None => deser_path(cx, tps, path, d)
+              None => deser_path(cx, tps, path, move d)
             }
         } else {
-            deser_path(cx, tps, path, d)
+            deser_path(cx, tps, path, move d)
         }
       }
 
@@ -822,8 +821,9 @@ fn ty_fns(cx: ext_ctxt, name: ast::ident,
 
     let span = ty.span;
     ~[
-        mk_ser_fn(cx, span, name, tps, |a,b,c,d| ser_ty(a, b, ty, c, d)),
-        mk_deser_fn(cx, span, name, tps, |a,b,c| deser_ty(a, b, ty, c))
+        mk_ser_fn(cx, span, name, tps, |a,b,c,d| ser_ty(a, b, ty, move c,
+                                                        move d)),
+        mk_deser_fn(cx, span, name, tps, |a,b,c| deser_ty(a, b, ty, move c))
     ]
 }
 
@@ -881,7 +881,7 @@ fn ser_enum(cx: ext_ctxt, tps: ser_tps_map, e_name: ast::ident,
                 fail ~"struct variants unimplemented for auto serialize"
         }
     };
-    let lam = cx.lambda(cx.blk(e_span, ~[cx.alt_stmt(arms, e_span, v)]));
+    let lam = cx.lambda(cx.blk(e_span, ~[cx.alt_stmt(arms, e_span, move v)]));
     let e_name = cx.lit_str(e_span, @cx.str_of(e_name));
     ~[#ast[stmt]{ $(s).emit_enum($(e_name), $(lam)) }]
 }
@@ -954,8 +954,9 @@ fn enum_fns(cx: ext_ctxt, e_name: ast::ident, e_span: span,
     -> ~[@ast::item] {
     ~[
         mk_ser_fn(cx, e_span, e_name, tps,
-                  |a,b,c,d| ser_enum(a, b, e_name, e_span, variants, c, d)),
+                  |a,b,c,d| ser_enum(a, b, e_name, e_span, variants, move c,
+                                     move d)),
         mk_deser_fn(cx, e_span, e_name, tps,
-                    |a,b,c| deser_enum(a, b, e_name, e_span, variants, c))
+          |a,b,c| deser_enum(a, b, e_name, e_span, variants, move c))
     ]
 }
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs
index 18c63c1934b..1058028f7e9 100644
--- a/src/rustc/back/link.rs
+++ b/src/rustc/back/link.rs
@@ -96,7 +96,7 @@ mod jit {
                 code: ptr,
                 env: ptr::null()
             };
-            let func: fn(~[~str]) = unsafe::transmute(closure);
+            let func: fn(~[~str]) = unsafe::transmute(move closure);
 
             func(~[sess.opts.binary]);
         }
diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs
index 1ccd27c786b..28e94e280bf 100644
--- a/src/rustc/driver/rustc.rs
+++ b/src/rustc/driver/rustc.rs
@@ -228,7 +228,7 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
     let p = comm::Port();
     let ch = comm::Chan(p);
 
-    match do task::try  {
+    match do task::try |move f| {
 
         // The 'diagnostics emitter'. Every error, warning, etc. should
         // go through this function.
diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs
index f993ed6bec7..98b942ace2b 100644
--- a/src/rustc/middle/trans/base.rs
+++ b/src/rustc/middle/trans/base.rs
@@ -1046,7 +1046,7 @@ fn new_block(cx: fn_ctxt, parent: Option<block>, +kind: block_kind,
     let llbb: BasicBlockRef = str::as_c_str(cx.ccx.sess.str_of(s), |buf| {
         llvm::LLVMAppendBasicBlock(cx.llfn, buf)
     });
-    let bcx = mk_block(llbb, parent, kind, is_lpad, opt_node_info, cx);
+    let bcx = mk_block(llbb, parent, move kind, is_lpad, opt_node_info, cx);
     do option::iter(parent) |cx| {
         if cx.unreachable { Unreachable(bcx); }
     };
diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs
index 87e27bcf6d7..03ccea0ad50 100644
--- a/src/rustc/middle/trans/common.rs
+++ b/src/rustc/middle/trans/common.rs
@@ -527,7 +527,7 @@ enum block = @block_;
 fn mk_block(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,
             is_lpad: bool, node_info: Option<node_info>, fcx: fn_ctxt)
     -> block {
-    block(@block_(llbb, parent, kind, is_lpad, node_info, fcx))
+    block(@block_(llbb, parent, move kind, is_lpad, node_info, fcx))
 }
 
 // First two args are retptr, env
diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs
index fe01a202e60..fc0c462e935 100644
--- a/src/rustc/middle/trans/debuginfo.rs
+++ b/src/rustc/middle/trans/debuginfo.rs
@@ -131,7 +131,7 @@ enum debug_metadata {
 
 fn cast_safely<T: Copy, U>(val: T) -> U unsafe {
     let val2 = val;
-    return unsafe::transmute(val2);
+    return unsafe::transmute(move val2);
 }
 
 fn md_from_metadata<T>(val: debug_metadata) -> T unsafe {
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs
index 2edf0178e32..631efe4a766 100644
--- a/src/rustc/middle/ty.rs
+++ b/src/rustc/middle/ty.rs
@@ -383,7 +383,7 @@ type t = *t_opaque;
 pure fn get(t: t) -> t_box unsafe {
     let t2 = unsafe::reinterpret_cast::<t, t_box>(&t);
     let t3 = t2;
-    unsafe::forget(t2);
+    unsafe::forget(move t2);
     t3
 }