mir: Don't memset allocas of types that do not require drop.

This commit is contained in:
Eduard Burtescu 2016-03-10 21:47:25 +02:00
parent 460e66457a
commit 02a141a550

View File

@ -51,7 +51,9 @@ impl<'tcx> LvalueRef<'tcx> {
{
assert!(!ty.has_erasable_regions());
let lltemp = bcx.with_block(|bcx| base::alloc_ty(bcx, ty, name));
drop::drop_fill(bcx, lltemp, ty);
if bcx.fcx().type_needs_drop(ty) {
drop::drop_fill(bcx, lltemp, ty);
}
LvalueRef::new_sized(lltemp, LvalueTy::from_ty(ty))
}
}