From 0beb271d8c74618a0b423c80692c0a2bc070b014 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Fri, 8 Jul 2011 14:10:15 -0500 Subject: [PATCH] Fix bind to work with boxed arguments with type parameters. This still doesn't work with bare fn arguments with type parameters. --- src/comp/middle/trans.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 050cd59e1d4..8814545fcc0 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -5525,8 +5525,12 @@ fn trans_bind_thunk(&@local_ctxt cx, &span sp, &ty::t incoming_fty, bcx = copy_ty(bcx, val, e_ty).bcx; val = bcx.build.Load(val); } - } else if (ty::type_contains_params(cx.ccx.tcx, out_arg.ty)) { - assert (out_arg.mode != ty::mo_val); + } + // If the type is parameterized, then we need to cast the + // type we actually have to the parameterized out type. + if (ty::type_contains_params(cx.ccx.tcx, out_arg.ty)) { + // FIXME: (#642) This works for boxes and alias params + // but does not work for bare functions. val = bcx.build.PointerCast(val, llout_arg_ty); } llargs += ~[val]; -- GitLab