Skip to content

Commit 0beb271

Browse files
msullivanbrson
authored andcommitted
Fix bind to work with boxed arguments with type parameters.
This still doesn't work with bare fn arguments with type parameters.
1 parent 15a670a commit 0beb271

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/comp/middle/trans.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5525,8 +5525,12 @@ fn trans_bind_thunk(&@local_ctxt cx, &span sp, &ty::t incoming_fty,
55255525
bcx = copy_ty(bcx, val, e_ty).bcx;
55265526
val = bcx.build.Load(val);
55275527
}
5528-
} else if (ty::type_contains_params(cx.ccx.tcx, out_arg.ty)) {
5529-
assert (out_arg.mode != ty::mo_val);
5528+
}
5529+
// If the type is parameterized, then we need to cast the
5530+
// type we actually have to the parameterized out type.
5531+
if (ty::type_contains_params(cx.ccx.tcx, out_arg.ty)) {
5532+
// FIXME: (#642) This works for boxes and alias params
5533+
// but does not work for bare functions.
55305534
val = bcx.build.PointerCast(val, llout_arg_ty);
55315535
}
55325536
llargs += ~[val];

0 commit comments

Comments
 (0)