Skip to content

Commit ed952ec

Browse files
committed
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)
1 parent 7d0958f commit ed952ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/comp/middle/trans/impl.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ fn trans_vtable_callee(bcx: block, env: callee_env, dict: ValueRef,
121121
n_method: uint) -> lval_maybe_callee {
122122
let bcx = bcx, ccx = bcx.ccx(), tcx = ccx.tcx;
123123
let method = ty::iface_methods(tcx, iface_id)[n_method];
124+
let method_ty = ty::mk_fn(tcx, method.fty);
124125
let {ty: fty, llty: llfty} =
125-
wrapper_fn_ty(ccx, val_ty(dict), node_id_type(bcx, callee_id),
126-
method.tps);
126+
wrapper_fn_ty(ccx, val_ty(dict), method_ty, method.tps);
127+
// node_id_type(bcx, callee_id),
127128
let vtable = PointerCast(bcx, Load(bcx, GEPi(bcx, dict, [0, 0])),
128129
T_ptr(T_array(T_ptr(llfty), n_method + 1u)));
129130
let mptr = Load(bcx, GEPi(bcx, vtable, [0, n_method as int]));

0 commit comments

Comments
 (0)