about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-02-09 09:54:58 -0800
committerGraydon Hoare <graydon@mozilla.com>2011-02-09 09:54:58 -0800
commit8c0d35066bcc0ab0eb35818f4de63bccee097e5c (patch)
tree1d4e8731b6851136a777936e3b1e79a5b306b308
parent467a628ffaf41844a90e6664c2ecd481eef1dc85 (diff)
downloadrust-8c0d35066bcc0ab0eb35818f4de63bccee097e5c.tar.gz
rust-8c0d35066bcc0ab0eb35818f4de63bccee097e5c.zip
Elide passed-typarams when tydescs are captured. Un-XFAIL generic-obj.rs.
-rw-r--r--src/Makefile1
-rw-r--r--src/comp/middle/trans.rs28
2 files changed, 17 insertions, 12 deletions
diff --git a/src/Makefile b/src/Makefile
index 221ec9ffcca..bd7b616fe16 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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 \
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 4401f8852c7..2a9c32da5e4 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -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.
@@ -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;
+        }
     }