Compile moving out of enums (#2329)
This commit is contained in:
parent
e5fb58e6c0
commit
37962288ec
1 changed files with 9 additions and 6 deletions
|
@ -794,20 +794,23 @@ fn make_pattern_bindings(bcx: block, phi_bindings: phi_bindings_list)
|
||||||
bcx.fcx.lllocals.insert(binding.pat_id,
|
bcx.fcx.lllocals.insert(binding.pat_id,
|
||||||
local_imm(phi_val));
|
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
|
// by value: make a new temporary and copy the value out
|
||||||
let lltype = type_of::type_of(bcx.fcx.ccx, binding.ty);
|
let lltype = type_of::type_of(bcx.fcx.ccx, binding.ty);
|
||||||
let allocation = alloca(bcx, lltype);
|
let allocation = alloca(bcx, lltype);
|
||||||
let ty = binding.ty;
|
let ty = binding.ty;
|
||||||
bcx = copy_val(bcx, INIT, allocation,
|
bcx = if binding.mode == ast::bind_by_value {
|
||||||
load_if_immediate(bcx, phi_val, ty), ty);
|
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,
|
bcx.fcx.lllocals.insert(binding.pat_id,
|
||||||
local_mem(allocation));
|
local_mem(allocation));
|
||||||
add_clean(bcx, allocation, ty);
|
add_clean(bcx, allocation, ty);
|
||||||
}
|
}
|
||||||
ast::bind_by_move => {
|
|
||||||
fail ~"unimplemented -- bblum";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue