Skip to content

Commit 15856f1

Browse files
committed
---
yaml --- r: 4189 b: refs/heads/master c: db19231 h: refs/heads/master i: 4187: aa15852 v: v3
1 parent 8add44a commit 15856f1

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
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: e3f96480968a7c91738414158a61e4f44b402797
2+
refs/heads/master: db1923159692818becfc0fe386f19cb0f6151855

trunk/src/comp/middle/trans.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4514,8 +4514,10 @@ fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t,
45144514
let lltargetfn =
45154515
bcx.build.GEP(lltarget.val, ~[C_int(0), C_int(abi::fn_field_code)]);
45164516

4517-
// Cast the outgoing function to the appropriate type (see the comments in
4518-
// trans_bind below for why this is necessary).
4517+
// Cast the outgoing function to the appropriate type.
4518+
// This is necessary because the type of the function that we have
4519+
// in the closure does not know how many type descriptors the function
4520+
// needs to take.
45194521
let lltargetty =
45204522
type_of_fn_from_ty(bcx_ccx(bcx), sp, outgoing_fty, ty_param_count);
45214523
lltargetfn = bcx.build.PointerCast(lltargetfn, T_ptr(T_ptr(lltargetty)));
@@ -4625,21 +4627,12 @@ fn trans_bind_1(cx: &@block_ctxt, f: &@ast::expr, f_res: &lval_result,
46254627
bcx = bindings_tydesc.bcx;
46264628
bcx.build.Store(bindings_tydesc.val, bound_tydesc);
46274629

4628-
// Determine the LLVM type for the outgoing function type. This
4629-
// may be different from the type returned by trans_malloc_boxed()
4630-
// since we have more information than that function does;
4631-
// specifically, we know how many type descriptors the outgoing
4632-
// function has, which type_of() doesn't, as only we know which
4633-
// item the function refers to.
4634-
let llfnty = type_of_fn_from_ty(bcx_ccx(bcx), cx.sp,
4635-
outgoing_fty, ty_param_count);
4636-
let llclosurety = T_ptr(T_fn_pair(*bcx_ccx(bcx), llfnty));
4637-
46384630
// Store thunk-target.
46394631
let bound_target =
46404632
bcx.build.GEP(closure, ~[C_int(0), C_int(abi::closure_elt_target)]);
4641-
let src = bcx.build.Load(f_res.res.val);
4642-
bound_target = bcx.build.PointerCast(bound_target, llclosurety);
4633+
let llclosurety = T_ptr(type_of(bcx_ccx(cx), cx.sp, outgoing_fty));
4634+
let src_loc = bcx.build.PointerCast(f_res.res.val, llclosurety);
4635+
let src = bcx.build.Load(src_loc);
46434636
bcx.build.Store(src, bound_target);
46444637

46454638
// Copy expr values into boxed bindings.

0 commit comments

Comments
 (0)