Skip to content

Commit 5a35f49

Browse files
committed
[MIR-trans] Fix handling of non-alloca temps in trans_operand_into()
1 parent fe3a609 commit 5a35f49

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/librustc_trans/trans/mir/operand.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,10 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
9292
bcx.val_to_string(lldest),
9393
operand);
9494

95-
match *operand {
96-
mir::Operand::Consume(ref lvalue) => {
97-
let tr_lvalue = self.trans_lvalue(bcx, lvalue);
98-
let lvalue_ty = tr_lvalue.ty.to_ty(bcx.tcx());
99-
debug!("trans_operand_into: tr_lvalue={} @ {:?}",
100-
bcx.val_to_string(tr_lvalue.llval),
101-
lvalue_ty);
102-
base::memcpy_ty(bcx, lldest, tr_lvalue.llval, lvalue_ty);
103-
}
104-
105-
mir::Operand::Constant(..) => {
106-
unimplemented!()
107-
}
108-
}
95+
let o = self.trans_operand(bcx, operand);
96+
match datum::appropriate_rvalue_mode(bcx.ccx(), o.ty) {
97+
datum::ByValue => base::store_ty(bcx, o.llval, lldest, o.ty),
98+
datum::ByRef => base::memcpy_ty(bcx, lldest, o.llval, o.ty),
99+
};
109100
}
110101
}

0 commit comments

Comments
 (0)