@@ -224,18 +224,19 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
224
224
ret llty;
225
225
}
226
226
227
- fn type_of_tag ( cx : @crate_ctxt , sp : span , did : ast:: def_id , t : ty:: t ) ->
228
- TypeRef {
227
+ fn type_of_tag ( cx : @crate_ctxt , sp : span , did : ast:: def_id , t : ty:: t )
228
+ -> TypeRef {
229
229
let degen = std:: vec:: len ( ty:: tag_variants ( cx. tcx , did) ) == 1 u;
230
- if ty:: type_has_dynamic_size ( cx. tcx , t) {
231
- if degen { ret T_i8 ( ) ; } else { ret T_opaque_tag ( cx. tn ) ; }
232
- } else {
230
+ if check type_has_static_size ( cx, t) {
233
231
let size = static_size_of_tag ( cx, sp, t) ;
234
232
if !degen { ret T_tag ( cx. tn , size) ; }
235
233
// LLVM does not like 0-size arrays, apparently
236
234
if size == 0 u { size = 1 u; }
237
235
ret T_array ( T_i8 ( ) , size) ;
238
236
}
237
+ else {
238
+ if degen { ret T_i8 ( ) ; } else { ret T_opaque_tag ( cx. tn ) ; }
239
+ }
239
240
}
240
241
241
242
fn type_of_ty_param_kinds_and_ty ( lcx : @local_ctxt , sp : span ,
@@ -503,12 +504,8 @@ fn simplify_type(ccx: @crate_ctxt, typ: ty::t) -> ty::t {
503
504
504
505
505
506
// Computes the size of the data part of a non-dynamically-sized tag.
506
- fn static_size_of_tag ( cx : @crate_ctxt , sp : span , t : ty:: t ) -> uint {
507
- if ty:: type_has_dynamic_size ( cx. tcx , t) {
508
- cx. tcx . sess . span_fatal ( sp,
509
- "dynamically sized type passed to \
510
- static_size_of_tag()") ;
511
- }
507
+ fn static_size_of_tag( cx : @crate_ctxt , sp : span , t : ty:: t )
508
+ : type_has_static_size ( cx , t ) -> uint {
512
509
if cx. tag_sizes . contains_key ( t) { ret cx. tag_sizes . get ( t) ; }
513
510
alt ty:: struct ( cx. tcx , t) {
514
511
ty:: ty_tag ( tid, subtys) {
0 commit comments