Skip to content

Commit add4127

Browse files
committed
change function and place in expr.rs
1 parent 1dc4d02 commit add4127

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

src/rustc/middle/trans/datum.rs

-19
Original file line numberDiff line numberDiff line change
@@ -542,25 +542,6 @@ impl Datum {
542542
};
543543
}
544544

545-
fn dropnzero_val(bcx: block) -> block {
546-
if !ty::type_needs_drop(bcx.tcx(), self.ty) {
547-
return bcx;
548-
}
549-
550-
return match self.mode {
551-
ByRef => {
552-
glue::drop_ty(bcx, self.val, self.ty);
553-
zero_mem(bcx, self.val, self.ty);
554-
return bcx;
555-
}
556-
ByValue => {
557-
glue::drop_ty_immediate(bcx, self.val, self.ty);
558-
zero_mem(bcx, self.val, self.ty);
559-
return bcx;
560-
}
561-
};
562-
}
563-
564545
fn box_body(bcx: block) -> Datum {
565546
/*!
566547
*

src/rustc/middle/trans/expr.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ impl Dest : cmp::Eq {
159159
pure fn ne(other: &Dest) -> bool { !self.eq(other) }
160160
}
161161

162+
fn drop_and_cancel_clean(dat: Datum, bcx: block) -> block {
163+
let bcx = dat.drop_val(bcx);
164+
dat.cancel_clean(bcx);
165+
return bcx;
166+
}
167+
162168
fn trans_to_datum(bcx: block, expr: @ast::expr) -> DatumBlock {
163169
debug!("trans_to_datum(expr=%s)", bcx.expr_to_str(expr));
164170

@@ -573,7 +579,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
573579
if bcx.expr_is_lval(a) {
574580
let datum = unpack_datum!(bcx, trans_to_datum(bcx, a));
575581
return match dest {
576-
Ignore => datum.dropnzero_val(bcx),
582+
Ignore => drop_and_cancel_clean(datum, bcx),
577583
SaveIn(addr) => datum.move_to(bcx, INIT, addr)
578584
};
579585
} else {

0 commit comments

Comments
 (0)