Skip to content

Commit 2f25d9c

Browse files
committed
Handle subtle view-shift on outptr in generic calls. Can construct generic objs now.
1 parent 74f71d3 commit 2f25d9c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/comp/middle/trans.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,6 +2710,14 @@ fn trans_args(@block_ctxt cx,
27102710
}
27112711
if (ty.type_has_dynamic_size(retty)) {
27122712
llargs += cx.build.PointerCast(llretslot, T_typaram_ptr());
2713+
} else if (ty.count_ty_params(retty) != 0u) {
2714+
// It's possible that the callee has some generic-ness somewhere in
2715+
// its return value -- say a method signature within an obj or a fn
2716+
// type deep in a structure -- which the caller has a concrete view
2717+
// of. If so, cast the caller's view of the restlot to the callee's
2718+
// view, for the sake of making a type-compatible call.
2719+
llargs += cx.build.PointerCast(llretslot,
2720+
T_ptr(type_of(cx.fcx.ccx, retty)));
27132721
} else {
27142722
llargs += llretslot;
27152723
}

0 commit comments

Comments
 (0)