@@ -1201,7 +1201,19 @@ fn make_tydesc(@crate_ctxt cx, @ty.t t, vec[ast.def_id] typaram_defs) {
1201
1201
auto dg = make_drop_glue;
1202
1202
auto drop_glue = make_generic_glue( cx, t, "drop" , dg, typaram_defs) ;
1203
1203
1204
- auto llty = type_of( cx, t) ;
1204
+ auto llsize;
1205
+ auto llalign;
1206
+ if ( !ty. type_has_dynamic_size( t) ) {
1207
+ auto llty = type_of( cx, t) ;
1208
+ llsize = llsize_of( llty) ;
1209
+ llalign = llalign_of( llty) ;
1210
+ } else {
1211
+ // These will be overwritten as the derived tydesc is generated, so
1212
+ // we create placeholder values.
1213
+ llsize = C_int ( 0 ) ;
1214
+ llalign = C_int ( 0 ) ;
1215
+ }
1216
+
1205
1217
auto glue_fn_ty = T_ptr ( T_glue_fn ( cx. tn) ) ;
1206
1218
1207
1219
// FIXME: this adjustment has to do with the ridiculous encoding of
@@ -1218,8 +1230,8 @@ fn make_tydesc(@crate_ctxt cx, @ty.t t, vec[ast.def_id] typaram_defs) {
1218
1230
auto gvar = llvm. LLVMAddGlobal ( cx. llmod, T_tydesc ( cx. tn) ,
1219
1231
_str. buf( name) ) ;
1220
1232
auto tydesc = C_struct ( vec( C_null ( T_ptr ( T_ptr ( T_tydesc ( cx. tn) ) ) ) ,
1221
- llsize_of ( llty ) ,
1222
- llalign_of ( llty ) ,
1233
+ llsize ,
1234
+ llalign ,
1223
1235
off( gvar, take_glue) , // take_glue_off
1224
1236
off( gvar, drop_glue) , // drop_glue_off
1225
1237
C_null ( glue_fn_ty) , // free_glue_off
0 commit comments