Skip to content

Commit 39c01c9

Browse files
brsongraydon
authored andcommitted
Fix trans_recv
1 parent b2ee569 commit 39c01c9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/comp/middle/trans.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4807,16 +4807,23 @@ fn trans_recv(@block_ctxt cx, @ast.expr lhs, @ast.expr rhs,
48074807
ast.ann ann) -> result {
48084808

48094809
auto bcx = cx;
4810-
auto data = trans_expr(bcx, lhs);
4811-
bcx = data.bcx;
4810+
auto data = trans_lval(bcx, lhs);
4811+
check (data.is_mem);
4812+
bcx = data.res.bcx;
48124813
auto prt = trans_expr(bcx, rhs);
48134814
bcx = prt.bcx;
4814-
auto data_val = vp2i(bcx, data.val);
4815+
4816+
auto unit_ty = node_ann_type(cx.fcx.ccx, ann);
4817+
auto llunit_ty = type_of(bcx.fcx.ccx, unit_ty);
4818+
auto data_alloca = bcx.build.Alloca(llunit_ty);
4819+
4820+
auto data_val = vp2i(bcx, data_alloca);
48154821
auto prt_val = vp2i(bcx, prt.val);
48164822
auto sub = trans_upcall(bcx, "upcall_recv", vec(data_val, prt_val));
48174823
bcx = sub.bcx;
48184824

4819-
ret res(bcx, data_val);
4825+
auto data_load = bcx.build.Load(data_alloca);
4826+
ret copy_ty(bcx, DROP_EXISTING, data.res.val, data_load, unit_ty);
48204827
}
48214828

48224829
fn init_local(@block_ctxt cx, @ast.local local) -> result {

0 commit comments

Comments
 (0)