aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-02-08 17:05:53 -0800
committerGraydon Hoare <[email protected]>2011-02-08 17:05:53 -0800
commit2f25d9c983c5730d79cc14278e666b8eb6531b10 (patch)
tree278091bbe46894e5a3862016de6d210d54b4f52c /src/comp
parentOverhaul ABI. All retptrs, all the time. (diff)
downloadrust-2f25d9c983c5730d79cc14278e666b8eb6531b10.tar.xz
rust-2f25d9c983c5730d79cc14278e666b8eb6531b10.zip
Handle subtle view-shift on outptr in generic calls. Can construct generic objs now.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs8
1 files changed, 8 insertions, 0 deletions
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;
}