diff --git a/src/rt/rust_type.h b/src/rt/rust_type.h index 2850273c251..8a105c1db0f 100644 --- a/src/rt/rust_type.h +++ b/src/rt/rust_type.h @@ -42,29 +42,24 @@ static inline void *box_body(rust_opaque_box *box) { return (void*)(box + 1); } +// N.B. If you want to add a field to tydesc, please use one of the +// unused fields! struct type_desc { - // First part of type_desc is known to compiler. - // first_param = &descs[1] if dynamic, null if static. const type_desc **first_param; size_t size; size_t align; glue_fn *take_glue; glue_fn *drop_glue; glue_fn *free_glue; - void *UNUSED; - glue_fn *sever_glue; // For GC. - glue_fn *mark_glue; // For GC. - uintptr_t unused2; - void *UNUSED_2; + glue_fn *visit_glue; + uintptr_t UNUSED_1; + uintptr_t UNUSED_2; + uintptr_t UNUSED_3; + uintptr_t UNUSED_4; const uint8_t *shape; const rust_shape_tables *shape_tables; - uintptr_t n_params; - uintptr_t n_obj_params; - - // Residual fields past here are known only to runtime. - UT_hash_handle hh; - size_t n_descs; - const type_desc *descs[]; + uintptr_t UNUSED_5; + uintptr_t UNUSED_6; }; extern "C" type_desc *rust_clone_type_desc(type_desc*); diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 2a8e2720893..a6806d97559 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -630,14 +630,14 @@ fn emit_tydescs(ccx: @crate_ctxt) { drop_glue, // drop_glue free_glue, // free_glue visit_glue, // visit_glue - C_null(glue_fn_ty), // sever_glue - C_null(glue_fn_ty), // mark_glue - C_null(glue_fn_ty), // unused - C_null(T_ptr(T_i8())), // cmp_glue + C_int(ccx, 0), // ununsed + C_int(ccx, 0), // ununsed + C_int(ccx, 0), // ununsed + C_int(ccx, 0), // ununsed C_shape(ccx, shape), // shape shape_tables, // shape_tables - C_int(ccx, 0), // n_params - C_int(ccx, 0)]); // n_obj_params + C_int(ccx, 0), // ununsed + C_int(ccx, 0)]); // unused let gvar = ti.tydesc; llvm::LLVMSetInitializer(gvar, tydesc); diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index af34cf0eef3..9dc8fdd4557 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -621,7 +621,7 @@ fn T_tydesc(targ_cfg: @session::config) -> TypeRef { let elems = [tydescpp, int_type, int_type, glue_fn_ty, glue_fn_ty, glue_fn_ty, glue_fn_ty, - glue_fn_ty, glue_fn_ty, glue_fn_ty, T_ptr(T_i8()), + int_type, int_type, int_type, int_type, T_ptr(T_i8()), T_ptr(T_i8()), int_type, int_type]; set_struct_body(tydesc, elems); ret tydesc;