Skip to content

Commit

Permalink
Elide passed-typarams when tydescs are captured. Un-XFAIL generic-obj…
Browse files Browse the repository at this point in the history
….rs.
  • Loading branch information
graydon committed Feb 9, 2011
1 parent 467a628 commit 8c0d350
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ TEST_XFAILS_RUSTC := $(filter-out \
generic-fn.rs \
generic-fn-infer.rs \
generic-drop-glue.rs \
generic-obj.rs \
generic-tup.rs \
generic-type.rs \
hello.rs \
Expand Down
28 changes: 16 additions & 12 deletions src/comp/middle/trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,15 @@ fn type_of_fn_full(@crate_ctxt cx,
}
}

// Args >3: ty params ...
auto ty_param_count =
ty.count_ty_params(plain_ty(ty.ty_fn(inputs, output)));
auto i = 0u;
while (i < ty_param_count) {
atys += T_ptr(T_tydesc());
i += 1u;
// Args >3: ty params, if not acquired via capture...
if (obj_self == none[TypeRef]) {
auto ty_param_count =
ty.count_ty_params(plain_ty(ty.ty_fn(inputs, output)));
auto i = 0u;
while (i < ty_param_count) {
atys += T_ptr(T_tydesc());
i += 1u;
}
}

// ... then explicit args.
Expand Down Expand Up @@ -3387,11 +3389,13 @@ fn create_llargs_for_fn_args(&@fn_ctxt cx,

auto arg_n = 3u;

for (ast.ty_param tp in ty_params) {
auto llarg = llvm.LLVMGetParam(cx.llfn, arg_n);
check (llarg as int != 0);
cx.lltydescs.insert(tp.id, llarg);
arg_n += 1u;
if (ty_self == none[TypeRef]) {
for (ast.ty_param tp in ty_params) {
auto llarg = llvm.LLVMGetParam(cx.llfn, arg_n);
check (llarg as int != 0);
cx.lltydescs.insert(tp.id, llarg);
arg_n += 1u;
}
}


Expand Down

0 comments on commit 8c0d350

Please sign in to comment.