Skip to content

Commit c35b7b5

Browse files
committed
auto merge of #6889 : luqmana/rust/unit-struct-drop, r=catamorphism
Fixes #6861
2 parents 44af506 + 64759c9 commit c35b7b5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/librustc/middle/trans/expr.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,14 @@ fn trans_def_dps_unadjusted(bcx: block, ref_expr: @ast::expr,
727727
}
728728
}
729729
ast::def_struct(*) => {
730-
// Nothing to do here.
731-
// FIXME #6572: May not be true in the case of classes with destructors.
730+
let ty = expr_ty(bcx, ref_expr);
731+
match ty::get(ty).sty {
732+
ty::ty_struct(did, _) if ty::has_dtor(ccx.tcx, did) => {
733+
let repr = adt::represent_type(ccx, ty);
734+
adt::trans_start_init(bcx, repr, lldest, 0);
735+
}
736+
_ => {}
737+
}
732738
return bcx;
733739
}
734740
_ => {

0 commit comments

Comments
 (0)