about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-03-02 16:13:33 -0800
committerPatrick Walton <pcwalton@mimiga.net>2011-03-02 16:15:20 -0800
commitc19e4e1c2987383ef686ca831f8115a1179ecb40 (patch)
tree43ca1da490cfc9ec874129a5decef70a05ab3fd6 /src/comp
parentfc722b17c92a91853f75c31e05b9a50d45fbe5e9 (diff)
downloadrust-c19e4e1c2987383ef686ca831f8115a1179ecb40.tar.gz
rust-c19e4e1c2987383ef686ca831f8115a1179ecb40.zip
rustc: Don't have type_of_arg() rely on the particular lie told by type_of()
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 2594590a4b9..45f59841a96 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -621,11 +621,22 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t) -> TypeRef {
 }
 
 fn type_of_arg(@crate_ctxt cx, &ty.arg arg) -> TypeRef {
-    auto ty = type_of_inner(cx, arg.ty);
+    alt (arg.ty.struct) {
+        case (ty.ty_param(_)) {
+            if (arg.mode == ast.alias) {
+                ret T_typaram_ptr(cx.tn);
+            }
+        }
+        case (_) {
+            // fall through
+        }
+    }
+
+    auto typ = type_of_inner(cx, arg.ty);
     if (arg.mode == ast.alias) {
-        ty = T_ptr(ty);
+        typ = T_ptr(typ);
     }
-    ret ty;
+    ret typ;
 }
 
 // Name sanitation. LLVM will happily accept identifiers with weird names, but