You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn trans_send(&@block_ctxt cx, &@ast::expr lhs, &@ast::expr rhs,
ast::node_id id) -> result {
auto bcx = cx;
auto chn = trans_expr(bcx, lhs);
bcx = chn.bcx;
auto data = trans_lval(bcx, rhs);
bcx = data.res.bcx;
auto chan_ty = node_id_type(cx.fcx.lcx.ccx, id);
auto unit_ty;
alt (ty::struct(cx.fcx.lcx.ccx.tcx, chan_ty)) {
case (ty::ty_chan(?t)) { unit_ty = t; }
case (_) { bcx.fcx.lcx.ccx.sess.bug("non-chan type in trans_send"); }
}
auto target = bcx.build.Call(bcx.fcx.lcx.ccx.upcalls.chan_target_task,
~[bcx.fcx.lltaskptr, llchanval]);
auto data_tmp = deep_copy(bcx, data.res.val, unit_ty, target);
bcx = data_tmp.bcx;
auto llchanval = bcx.build.PointerCast(chn.val, T_opaque_chan_ptr());
auto lldataptr = bcx.build.PointerCast(data_tmp.val, T_ptr(T_i8()));
bcx.build.Call(bcx.fcx.lcx.ccx.upcalls.send,
~[bcx.fcx.lltaskptr, llchanval, lldataptr]);
ret rslt(bcx, chn.val);
}
Sorry it's so long, it wasn't obvious how to reduce it. This is code copied out of trans_comm.rs, but with some as-yet uncommitted changes. It's causing an LLVM assert because I'm passing llchanval to Build in the auto target = ... line. I'm using llchanval before it's even declared, let along initialized.
The text was updated successfully, but these errors were encountered:
Partially. There's the design question of whether it's legal to refer to a variable before it's declared. In this example, however, llchanval was definitely not initialized when I first tried to read from it, which seems like it's a typestate error.
Sorry it's so long, it wasn't obvious how to reduce it. This is code copied out of trans_comm.rs, but with some as-yet uncommitted changes. It's causing an LLVM assert because I'm passing llchanval to Build in the
auto target = ...
line. I'm using llchanval before it's even declared, let along initialized.The text was updated successfully, but these errors were encountered: