Skip to content

Commit c19e4e1

Browse files
committed
rustc: Don't have type_of_arg() rely on the particular lie told by type_of()
1 parent fc722b1 commit c19e4e1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/comp/middle/trans.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,11 +621,22 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t) -> TypeRef {
621621
}
622622

623623
fn type_of_arg(@crate_ctxt cx, &ty.arg arg) -> TypeRef {
624-
auto ty = type_of_inner(cx, arg.ty);
624+
alt (arg.ty.struct) {
625+
case (ty.ty_param(_)) {
626+
if (arg.mode == ast.alias) {
627+
ret T_typaram_ptr(cx.tn);
628+
}
629+
}
630+
case (_) {
631+
// fall through
632+
}
633+
}
634+
635+
auto typ = type_of_inner(cx, arg.ty);
625636
if (arg.mode == ast.alias) {
626-
ty = T_ptr(ty);
637+
typ = T_ptr(typ);
627638
}
628-
ret ty;
639+
ret typ;
629640
}
630641

631642
// Name sanitation. LLVM will happily accept identifiers with weird names, but

0 commit comments

Comments
 (0)