diff options
| author | Björn Steinbrink <bsteinbr@gmail.com> | 2015-11-04 17:39:25 +0100 |
|---|---|---|
| committer | Björn Steinbrink <bsteinbr@gmail.com> | 2015-11-04 19:30:04 +0100 |
| commit | 5a35f498f38698ccf541968da8262f4686efe898 (patch) | |
| tree | 4f257e83350bff909e94bf9ff823d23e10281368 /src | |
| parent | fe3a609b0b3e51423165320b356440047fe10a59 (diff) | |
[MIR-trans] Fix handling of non-alloca temps in trans_operand_into()
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_trans/trans/mir/operand.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/librustc_trans/trans/mir/operand.rs b/src/librustc_trans/trans/mir/operand.rs index a0308032ac0..fb529d8975e 100644 --- a/src/librustc_trans/trans/mir/operand.rs +++ b/src/librustc_trans/trans/mir/operand.rs @@ -92,19 +92,10 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { bcx.val_to_string(lldest), operand); - match *operand { - mir::Operand::Consume(ref lvalue) => { - let tr_lvalue = self.trans_lvalue(bcx, lvalue); - let lvalue_ty = tr_lvalue.ty.to_ty(bcx.tcx()); - debug!("trans_operand_into: tr_lvalue={} @ {:?}", - bcx.val_to_string(tr_lvalue.llval), - lvalue_ty); - base::memcpy_ty(bcx, lldest, tr_lvalue.llval, lvalue_ty); - } - - mir::Operand::Constant(..) => { - unimplemented!() - } - } + let o = self.trans_operand(bcx, operand); + match datum::appropriate_rvalue_mode(bcx.ccx(), o.ty) { + datum::ByValue => base::store_ty(bcx, o.llval, lldest, o.ty), + datum::ByRef => base::memcpy_ty(bcx, lldest, o.llval, o.ty), + }; } } |
