about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorBen Blum <bblum@andrew.cmu.edu>2012-08-22 20:35:05 -0400
committerBen Blum <bblum@andrew.cmu.edu>2012-08-22 20:40:25 -0400
commit37962288ec80cca6ce027650a3700526feb7ca54 (patch)
tree3c5be9a3e0cc7eccdbd4b0c20c115c8e2a230ea0 /src/rustc
parente5fb58e6c09202df314d3ef6ccb797f2cc8401e2 (diff)
Compile moving out of enums (#2329)
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/middle/trans/alt.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs
index 13bbfabd0ca..6e2fd40fecf 100644
--- a/src/rustc/middle/trans/alt.rs
+++ b/src/rustc/middle/trans/alt.rs
@@ -794,20 +794,23 @@ fn make_pattern_bindings(bcx: block, phi_bindings: phi_bindings_list)
                 bcx.fcx.lllocals.insert(binding.pat_id,
                                         local_imm(phi_val));
             }
-            ast::bind_by_value => {
+            ast::bind_by_value | ast::bind_by_move => {
                 // by value: make a new temporary and copy the value out
                 let lltype = type_of::type_of(bcx.fcx.ccx, binding.ty);
                 let allocation = alloca(bcx, lltype);
                 let ty = binding.ty;
-                bcx = copy_val(bcx, INIT, allocation,
-                               load_if_immediate(bcx, phi_val, ty), ty);
+                bcx = if binding.mode == ast::bind_by_value {
+                    copy_val(bcx, INIT, allocation,
+                             load_if_immediate(bcx, phi_val, ty), ty)
+                } else {
+                    error!("moving out");
+                    move_val(bcx, INIT, allocation,
+                             {bcx: bcx, val: phi_val, kind: lv_owned}, ty)
+                };
                 bcx.fcx.lllocals.insert(binding.pat_id,
                                         local_mem(allocation));
                 add_clean(bcx, allocation, ty);
             }
-            ast::bind_by_move => {
-                fail ~"unimplemented -- bblum";
-            }
         }
     }