about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-02-29 11:35:44 -0800
committerNiko Matsakis <niko@alum.mit.edu>2012-02-29 11:54:48 -0800
commited952ecf6870e540f7e5e06842c57c60a57b4ffd (patch)
tree1295074edd9bee8794bc512f57bde41f9691c409
parent7d0958f70ff16ee40649a943306c9b104a5fc829 (diff)
downloadrust-ed952ecf6870e540f7e5e06842c57c60a57b4ffd.tar.gz
rust-ed952ecf6870e540f7e5e06842c57c60a57b4ffd.zip
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)
-rw-r--r--src/comp/middle/trans/impl.rs5
1 files 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]));