// Copy expr values into boxed bindings.
// Silly check
check type_is_tup_like(bcx, closure_ty);
- let bindings = GEP_tup_like(bcx, closure_ty, closure,
- [0, abi::closure_elt_bindings]);
- bcx = bindings.bcx;
+ let closure_box = box;
+ let closure_box_ty = ty::mk_imm_box(bcx_tcx(bcx), closure_ty);
let i = 0u;
for bv in bound_values {
- let bound =
- GEP_tup_like_1(bcx, bindings_ty, bindings.val, [0, i as int]);
+ let bound = GEP_tup_like_1(bcx, closure_box_ty, closure_box,
+ [0, abi::box_rc_field_body,
+ abi::closure_elt_bindings,
+ i as int]);
bcx = bound.bcx;
alt bv {
env_expr(e) {
--- /dev/null
+fn wrapper3<T>(i: T, j: int) {
+ log i;
+ log j;
+ // This is a regression test that the spawn3 thunk to wrapper3
+ // correctly finds the value of j
+ assert j == 123456789;
+}
+
+fn spawn3<T>(i: T, j: int) {
+ let wrapped = bind wrapper3(i, j);
+ wrapped();
+}
+
+fn main() {
+ spawn3(127u8, 123456789);
+}
\ No newline at end of file