Skip to content

Commit 02a141a

Browse files
committed
mir: Don't memset allocas of types that do not require drop.
1 parent 460e664 commit 02a141a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustc_trans/trans/mir/lvalue.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ impl<'tcx> LvalueRef<'tcx> {
5151
{
5252
assert!(!ty.has_erasable_regions());
5353
let lltemp = bcx.with_block(|bcx| base::alloc_ty(bcx, ty, name));
54-
drop::drop_fill(bcx, lltemp, ty);
54+
if bcx.fcx().type_needs_drop(ty) {
55+
drop::drop_fill(bcx, lltemp, ty);
56+
}
5557
LvalueRef::new_sized(lltemp, LvalueTy::from_ty(ty))
5658
}
5759
}

0 commit comments

Comments
 (0)