提交 21e42ad8 编写于 作者: P Patrick Walton

rustc: For derived tydescs, explicitly store 0 for size and align when the...

rustc: For derived tydescs, explicitly store 0 for size and align when the type in question has a dynamic size
上级 c19e4e1c
......@@ -1201,7 +1201,19 @@ fn make_tydesc(@crate_ctxt cx, @ty.t t, vec[ast.def_id] typaram_defs) {
auto dg = make_drop_glue;
auto drop_glue = make_generic_glue(cx, t, "drop", dg, typaram_defs);
auto llty = type_of(cx, t);
auto llsize;
auto llalign;
if (!ty.type_has_dynamic_size(t)) {
auto llty = type_of(cx, t);
llsize = llsize_of(llty);
llalign = llalign_of(llty);
} else {
// These will be overwritten as the derived tydesc is generated, so
// we create placeholder values.
llsize = C_int(0);
llalign = C_int(0);
}
auto glue_fn_ty = T_ptr(T_glue_fn(cx.tn));
// FIXME: this adjustment has to do with the ridiculous encoding of
......@@ -1218,8 +1230,8 @@ fn off(ValueRef tydescp,
auto gvar = llvm.LLVMAddGlobal(cx.llmod, T_tydesc(cx.tn),
_str.buf(name));
auto tydesc = C_struct(vec(C_null(T_ptr(T_ptr(T_tydesc(cx.tn)))),
llsize_of(llty),
llalign_of(llty),
llsize,
llalign,
off(gvar, take_glue), // take_glue_off
off(gvar, drop_glue), // drop_glue_off
C_null(glue_fn_ty), // free_glue_off
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册