Skip to content

Commit 9bd2728

Browse files
committed
---
yaml --- r: 1429 b: refs/heads/master c: dcd65fa h: refs/heads/master i: 1427: 9bc254f v: v3
1 parent c58ee1f commit 9bd2728

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5332250d3bddf509994832965f3c5d7b68662ce4
2+
refs/heads/master: dcd65fac199d3caac4b1019304ef5e1b480f31ff

trunk/src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \
416416
test/run-pass/obj-as.rs \
417417
test/run-pass/vec-slice.rs \
418418
test/run-pass/fn-lval.rs \
419+
test/run-pass/generic-fn-box.rs \
419420
test/run-pass/generic-recursive-tag.rs \
420421
test/run-pass/generic-tup.rs \
421422
test/run-pass/iter-ret.rs \

trunk/src/comp/middle/trans.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,12 @@ fn trans_args(@block_ctxt cx,
30913091
}
30923092

30933093
// ... then explicit args.
3094+
3095+
// First we figure out the caller's view of the types of the arguments.
3096+
// This will be needed if this is a generic call, because the callee has
3097+
// to cast her view of the arguments to the caller's view.
3098+
auto arg_tys = type_of_explicit_args(cx.fcx.ccx, args);
3099+
30943100
auto i = 0u;
30953101
for (@ast.expr e in es) {
30963102
auto mode = args.(i).mode;
@@ -3132,9 +3138,9 @@ fn trans_args(@block_ctxt cx,
31323138
bcx = re.bcx;
31333139
}
31343140

3135-
if (ty.type_has_dynamic_size(args.(i).ty)) {
3136-
val = bcx.build.PointerCast(val,
3137-
T_typaram_ptr(cx.fcx.ccx.tn));
3141+
if (ty.count_ty_params(args.(i).ty) > 0u) {
3142+
auto lldestty = arg_tys.(i);
3143+
val = bcx.build.PointerCast(val, lldestty);
31383144
}
31393145

31403146
llargs += val;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
fn f[T](@T x) -> @T {
2+
ret x;
3+
}
4+
5+
fn main() {
6+
auto x = f(@3);
7+
log *x;
8+
}
9+

0 commit comments

Comments
 (0)