@@ -673,7 +673,7 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t, bool boxed) -> TypeRef {
673
673
case ( ty. ty_char ) { llty = T_char ( ) ; }
674
674
case ( ty. ty_str ) { llty = T_ptr ( T_str ( ) ) ; }
675
675
case ( ty. ty_tag ( _, _) ) {
676
- if ( boxed ) {
676
+ if ( ty . type_has_dynamic_size ( t ) ) {
677
677
llty = T_opaque_tag ( cx. tn ) ;
678
678
} else {
679
679
auto size = static_size_of_tag ( cx, t) ;
@@ -1128,7 +1128,25 @@ fn static_size_of_tag(@crate_ctxt cx, @ty.t t) -> uint {
1128
1128
auto max_size = 0 u;
1129
1129
auto variants = tag_variants ( cx, tid) ;
1130
1130
for ( variant_info variant in variants) {
1131
- auto tup_ty = ty. plain_tup_ty( variant. args) ;
1131
+
1132
+ let vec[ @ty. t] args = vec ( ) ;
1133
+ for ( @ty. t t in variant. args ) {
1134
+ alt ( t. struct ) {
1135
+ // NB: We're just going for 'size' here, so we can do a little
1136
+ // faking work here and substitute all boxes to boxed ints;
1137
+ // this will break any tag cycles we might otherwise traverse
1138
+ // (which would cause infinite recursion while measuring
1139
+ // size).
1140
+ case ( ty. ty_box ( _) ) {
1141
+ args += vec ( ty. plain_box_ty ( ty. plain_ty ( ty. ty_int ) ,
1142
+ ast. imm ) ) ;
1143
+ }
1144
+ case ( _) {
1145
+ args += vec ( t) ;
1146
+ }
1147
+ }
1148
+ }
1149
+ auto tup_ty = ty. plain_tup_ty ( args) ;
1132
1150
1133
1151
// Perform any type parameter substitutions.
1134
1152
tup_ty = ty. substitute_ty_params ( ty_params, subtys, tup_ty) ;
@@ -4420,9 +4438,6 @@ fn trans_args(@block_ctxt cx,
4420
4438
}
4421
4439
}
4422
4440
4423
- val = bcx. build. PointerCast ( val, lldestty) ;
4424
- } else if ( mode == ast. alias) {
4425
- auto lldestty = arg_tys. ( i) ;
4426
4441
val = bcx. build. PointerCast ( val, lldestty) ;
4427
4442
}
4428
4443
0 commit comments