From c19e4e1c2987383ef686ca831f8115a1179ecb40 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 2 Mar 2011 16:13:33 -0800 Subject: rustc: Don't have type_of_arg() rely on the particular lie told by type_of() --- src/comp/middle/trans.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 2594590a..45f59841 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 -- cgit v1.2.3