Skip to content

Commit 665ba35

Browse files
committed
Clean up tydesc declaration to make it clear what is unused.
1 parent b226206 commit 665ba35

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

src/rt/rust_type.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,24 @@ static inline void *box_body(rust_opaque_box *box) {
4242
return (void*)(box + 1);
4343
}
4444

45+
// N.B. If you want to add a field to tydesc, please use one of the
46+
// unused fields!
4547
struct type_desc {
46-
// First part of type_desc is known to compiler.
47-
// first_param = &descs[1] if dynamic, null if static.
4848
const type_desc **first_param;
4949
size_t size;
5050
size_t align;
5151
glue_fn *take_glue;
5252
glue_fn *drop_glue;
5353
glue_fn *free_glue;
54-
void *UNUSED;
55-
glue_fn *sever_glue; // For GC.
56-
glue_fn *mark_glue; // For GC.
57-
uintptr_t unused2;
58-
void *UNUSED_2;
54+
glue_fn *visit_glue;
55+
uintptr_t UNUSED_1;
56+
uintptr_t UNUSED_2;
57+
uintptr_t UNUSED_3;
58+
uintptr_t UNUSED_4;
5959
const uint8_t *shape;
6060
const rust_shape_tables *shape_tables;
61-
uintptr_t n_params;
62-
uintptr_t n_obj_params;
63-
64-
// Residual fields past here are known only to runtime.
65-
UT_hash_handle hh;
66-
size_t n_descs;
67-
const type_desc *descs[];
61+
uintptr_t UNUSED_5;
62+
uintptr_t UNUSED_6;
6863
};
6964

7065
extern "C" type_desc *rust_clone_type_desc(type_desc*);

src/rustc/middle/trans/base.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,14 +630,14 @@ fn emit_tydescs(ccx: @crate_ctxt) {
630630
drop_glue, // drop_glue
631631
free_glue, // free_glue
632632
visit_glue, // visit_glue
633-
C_null(glue_fn_ty), // sever_glue
634-
C_null(glue_fn_ty), // mark_glue
635-
C_null(glue_fn_ty), // unused
636-
C_null(T_ptr(T_i8())), // cmp_glue
633+
C_int(ccx, 0), // ununsed
634+
C_int(ccx, 0), // ununsed
635+
C_int(ccx, 0), // ununsed
636+
C_int(ccx, 0), // ununsed
637637
C_shape(ccx, shape), // shape
638638
shape_tables, // shape_tables
639-
C_int(ccx, 0), // n_params
640-
C_int(ccx, 0)]); // n_obj_params
639+
C_int(ccx, 0), // ununsed
640+
C_int(ccx, 0)]); // unused
641641

642642
let gvar = ti.tydesc;
643643
llvm::LLVMSetInitializer(gvar, tydesc);

src/rustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ fn T_tydesc(targ_cfg: @session::config) -> TypeRef {
621621
let elems =
622622
[tydescpp, int_type, int_type,
623623
glue_fn_ty, glue_fn_ty, glue_fn_ty, glue_fn_ty,
624-
glue_fn_ty, glue_fn_ty, glue_fn_ty, T_ptr(T_i8()),
624+
int_type, int_type, int_type, int_type,
625625
T_ptr(T_i8()), T_ptr(T_i8()), int_type, int_type];
626626
set_struct_body(tydesc, elems);
627627
ret tydesc;

0 commit comments

Comments
 (0)