aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle/trans.rs
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-03-02 16:13:33 -0800
committerPatrick Walton <[email protected]>2011-03-02 16:15:20 -0800
commitc19e4e1c2987383ef686ca831f8115a1179ecb40 (patch)
tree43ca1da490cfc9ec874129a5decef70a05ab3fd6 /src/comp/middle/trans.rs
parentComment-out some logging chatter in extfmt. (diff)
downloadrust-c19e4e1c2987383ef686ca831f8115a1179ecb40.tar.xz
rust-c19e4e1c2987383ef686ca831f8115a1179ecb40.zip
rustc: Don't have type_of_arg() rely on the particular lie told by type_of()
Diffstat (limited to 'src/comp/middle/trans.rs')
-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 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