Skip to content

Commit faaa3d0

Browse files
committed
---
yaml --- r: 5772 b: refs/heads/master c: 99f876e h: refs/heads/master v: v3
1 parent 735964b commit faaa3d0

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 306f7fb25f6c4eec0a0a517edb2b2821468efdf3
2+
refs/heads/master: 99f876e3a8da7423252c6b4bad901c5c6f881f1e

trunk/src/comp/middle/trans.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,13 +2705,14 @@ fn build_environment(bcx: @block_ctxt, lltydescs: [ValueRef],
27052705
// Copy expr values into boxed bindings.
27062706
// Silly check
27072707
check type_is_tup_like(bcx, closure_ty);
2708-
let bindings = GEP_tup_like(bcx, closure_ty, closure,
2709-
[0, abi::closure_elt_bindings]);
2710-
bcx = bindings.bcx;
2708+
let closure_box = box;
2709+
let closure_box_ty = ty::mk_imm_box(bcx_tcx(bcx), closure_ty);
27112710
let i = 0u;
27122711
for bv in bound_values {
2713-
let bound =
2714-
GEP_tup_like_1(bcx, bindings_ty, bindings.val, [0, i as int]);
2712+
let bound = GEP_tup_like_1(bcx, closure_box_ty, closure_box,
2713+
[0, abi::box_rc_field_body,
2714+
abi::closure_elt_bindings,
2715+
i as int]);
27152716
bcx = bound.bcx;
27162717
alt bv {
27172718
env_expr(e) {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
fn wrapper3<T>(i: T, j: int) {
2+
log i;
3+
log j;
4+
// This is a regression test that the spawn3 thunk to wrapper3
5+
// correctly finds the value of j
6+
assert j == 123456789;
7+
}
8+
9+
fn spawn3<T>(i: T, j: int) {
10+
let wrapped = bind wrapper3(i, j);
11+
wrapped();
12+
}
13+
14+
fn main() {
15+
spawn3(127u8, 123456789);
16+
}

0 commit comments

Comments
 (0)