Skip to content

Commit 9a7b784

Browse files
msullivanbrson
authored andcommitted
---
yaml --- r: 3801 b: refs/heads/master c: cd97f4e h: refs/heads/master i: 3799: b13c3ab v: v3
1 parent 55484f7 commit 9a7b784

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
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: 0beb271d8c74618a0b423c80692c0a2bc070b014
2+
refs/heads/master: cd97f4eed04be79ade0e54d867153c554ec54430

trunk/src/comp/middle/trans.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5439,6 +5439,11 @@ fn trans_bind_thunk(&@local_ctxt cx, &span sp, &ty::t incoming_fty,
54395439
auto fcx = new_fn_ctxt(cx, sp, llthunk);
54405440
auto bcx = new_top_block_ctxt(fcx);
54415441
auto lltop = bcx.llbb;
5442+
// Since we might need to construct derived tydescs that depend on
5443+
// our bound tydescs, we need to load tydescs out of the environment
5444+
// before derived tydescs are constructed. To do this, we load them
5445+
// in the copy_args block.
5446+
auto copy_args_bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs);
54425447

54435448
// The 'llenv' that will arrive in the thunk we're creating is an
54445449
// environment that will contain the values of its arguments and a pointer
@@ -5448,7 +5453,8 @@ fn trans_bind_thunk(&@local_ctxt cx, &span sp, &ty::t incoming_fty,
54485453
// 'closure_ty', which was determined by trans_bind.
54495454
auto llclosure_ptr_ty =
54505455
type_of(cx.ccx, sp, ty::mk_imm_box(cx.ccx.tcx, closure_ty));
5451-
auto llclosure = bcx.build.PointerCast(fcx.llenv, llclosure_ptr_ty);
5456+
auto llclosure = copy_args_bcx.build.PointerCast(fcx.llenv,
5457+
llclosure_ptr_ty);
54525458

54535459
// "target", in this context, means the function that's having some of its
54545460
// arguments bound and that will be called inside the thunk we're
@@ -5487,11 +5493,11 @@ fn trans_bind_thunk(&@local_ctxt cx, &span sp, &ty::t incoming_fty,
54875493
let uint i = 0u;
54885494
while (i < ty_param_count) {
54895495
auto lltyparam_ptr =
5490-
GEP_tup_like(bcx, closure_ty, llclosure,
5496+
GEP_tup_like(copy_args_bcx, closure_ty, llclosure,
54915497
~[0, abi::box_rc_field_body,
54925498
abi::closure_elt_ty_params, i as int]);
5493-
bcx = lltyparam_ptr.bcx;
5494-
auto td = bcx.build.Load(lltyparam_ptr.val);
5499+
copy_args_bcx = lltyparam_ptr.bcx;
5500+
auto td = copy_args_bcx.build.Load(lltyparam_ptr.val);
54955501
llargs += ~[td];
54965502
fcx.lltydescs += ~[td];
54975503
i += 1u;

0 commit comments

Comments
 (0)