From ed952ecf6870e540f7e5e06842c57c60a57b4ffd Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 29 Feb 2012 11:35:44 -0800 Subject: [PATCH] report the type of the method as the fty, not the type of the expression using the type of the expression causes us to lose information about when the method was declaring with a generic signature, which leads to producing incorrect code, particularly in the case of returning unit types (which would then get an undefined output ptr) --- src/comp/middle/trans/impl.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/comp/middle/trans/impl.rs b/src/comp/middle/trans/impl.rs index e3853127405..abaf00ad0f7 100644 --- a/src/comp/middle/trans/impl.rs +++ b/src/comp/middle/trans/impl.rs @@ -121,9 +121,10 @@ fn trans_vtable_callee(bcx: block, env: callee_env, dict: ValueRef, n_method: uint) -> lval_maybe_callee { let bcx = bcx, ccx = bcx.ccx(), tcx = ccx.tcx; let method = ty::iface_methods(tcx, iface_id)[n_method]; + let method_ty = ty::mk_fn(tcx, method.fty); let {ty: fty, llty: llfty} = - wrapper_fn_ty(ccx, val_ty(dict), node_id_type(bcx, callee_id), - method.tps); + wrapper_fn_ty(ccx, val_ty(dict), method_ty, method.tps); + // node_id_type(bcx, callee_id), let vtable = PointerCast(bcx, Load(bcx, GEPi(bcx, dict, [0, 0])), T_ptr(T_array(T_ptr(llfty), n_method + 1u))); let mptr = Load(bcx, GEPi(bcx, vtable, [0, n_method as int]));