librustc: Have destructor run for unit-like structs.

This commit is contained in:
Luqman Aden 2013-06-01 17:39:39 -04:00
parent 44af5064d0
commit 64759c9f25

View File

@ -727,8 +727,14 @@ fn trans_def_dps_unadjusted(bcx: block, ref_expr: @ast::expr,
}
}
ast::def_struct(*) => {
// Nothing to do here.
// FIXME #6572: May not be true in the case of classes with destructors.
let ty = expr_ty(bcx, ref_expr);
match ty::get(ty).sty {
ty::ty_struct(did, _) if ty::has_dtor(ccx.tcx, did) => {
let repr = adt::represent_type(ccx, ty);
adt::trans_start_init(bcx, repr, lldest, 0);
}
_ => {}
}
return bcx;
}
_ => {