* dropnzero_val fn added
* zero-mem for not needed drop situation placed in Ignore
This commit is contained in:
parent
a3b83c6224
commit
bf792b922c
@ -542,6 +542,25 @@ impl Datum {
|
||||
};
|
||||
}
|
||||
|
||||
fn dropnzero_val(bcx: block) -> block {
|
||||
if !ty::type_needs_drop(bcx.tcx(), self.ty) {
|
||||
return bcx;
|
||||
}
|
||||
|
||||
return match self.mode {
|
||||
ByRef => {
|
||||
glue::drop_ty(bcx, self.val, self.ty);
|
||||
zero_mem(bcx, self.val, self.ty);
|
||||
return bcx;
|
||||
}
|
||||
ByValue => {
|
||||
glue::drop_ty_immediate(bcx, self.val, self.ty);
|
||||
zero_mem(bcx, self.val, self.ty);
|
||||
return bcx;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn box_body(bcx: block) -> Datum {
|
||||
/*!
|
||||
*
|
||||
|
@ -573,7 +573,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
|
||||
if bcx.expr_is_lval(a) {
|
||||
let datum = unpack_datum!(bcx, trans_to_datum(bcx, a));
|
||||
return match dest {
|
||||
Ignore => datum.drop_val(bcx),
|
||||
Ignore => datum.dropnzero_val(bcx),
|
||||
SaveIn(addr) => datum.move_to(bcx, INIT, addr)
|
||||
};
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user