Skip to content

Commit

Permalink
auto merge of #6889 : luqmana/rust/unit-struct-drop, r=catamorphism
Browse files Browse the repository at this point in the history
Fixes #6861
  • Loading branch information
bors committed Jun 1, 2013
2 parents 44af506 + 64759c9 commit c35b7b5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/librustc/middle/trans/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
_ => {
Expand Down

0 comments on commit c35b7b5

Please sign in to comment.