From 2f25d9c983c5730d79cc14278e666b8eb6531b10 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 8 Feb 2011 17:05:53 -0800 Subject: Handle subtle view-shift on outptr in generic calls. Can construct generic objs now. --- src/comp/middle/trans.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 9e59cf57..4401f885 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -2710,6 +2710,14 @@ fn trans_args(@block_ctxt cx, } if (ty.type_has_dynamic_size(retty)) { llargs += cx.build.PointerCast(llretslot, T_typaram_ptr()); + } else if (ty.count_ty_params(retty) != 0u) { + // It's possible that the callee has some generic-ness somewhere in + // its return value -- say a method signature within an obj or a fn + // type deep in a structure -- which the caller has a concrete view + // of. If so, cast the caller's view of the restlot to the callee's + // view, for the sake of making a type-compatible call. + llargs += cx.build.PointerCast(llretslot, + T_ptr(type_of(cx.fcx.ccx, retty))); } else { llargs += llretslot; } -- cgit v1.2.3