Skip to content

Commit 8c0d350

Browse files
committed
Elide passed-typarams when tydescs are captured. Un-XFAIL generic-obj.rs.
1 parent 467a628 commit 8c0d350

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ TEST_XFAILS_RUSTC := $(filter-out \
455455
generic-fn.rs \
456456
generic-fn-infer.rs \
457457
generic-drop-glue.rs \
458+
generic-obj.rs \
458459
generic-tup.rs \
459460
generic-type.rs \
460461
hello.rs \

src/comp/middle/trans.rs

+16-12
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,15 @@ fn type_of_fn_full(@crate_ctxt cx,
399399
}
400400
}
401401

402-
// Args >3: ty params ...
403-
auto ty_param_count =
404-
ty.count_ty_params(plain_ty(ty.ty_fn(inputs, output)));
405-
auto i = 0u;
406-
while (i < ty_param_count) {
407-
atys += T_ptr(T_tydesc());
408-
i += 1u;
402+
// Args >3: ty params, if not acquired via capture...
403+
if (obj_self == none[TypeRef]) {
404+
auto ty_param_count =
405+
ty.count_ty_params(plain_ty(ty.ty_fn(inputs, output)));
406+
auto i = 0u;
407+
while (i < ty_param_count) {
408+
atys += T_ptr(T_tydesc());
409+
i += 1u;
410+
}
409411
}
410412

411413
// ... then explicit args.
@@ -3387,11 +3389,13 @@ fn create_llargs_for_fn_args(&@fn_ctxt cx,
33873389

33883390
auto arg_n = 3u;
33893391

3390-
for (ast.ty_param tp in ty_params) {
3391-
auto llarg = llvm.LLVMGetParam(cx.llfn, arg_n);
3392-
check (llarg as int != 0);
3393-
cx.lltydescs.insert(tp.id, llarg);
3394-
arg_n += 1u;
3392+
if (ty_self == none[TypeRef]) {
3393+
for (ast.ty_param tp in ty_params) {
3394+
auto llarg = llvm.LLVMGetParam(cx.llfn, arg_n);
3395+
check (llarg as int != 0);
3396+
cx.lltydescs.insert(tp.id, llarg);
3397+
arg_n += 1u;
3398+
}
33953399
}
33963400

33973401

0 commit comments

Comments
 (0)