From 02a141a5506ae499367c67e147688d049dd96efb Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Thu, 10 Mar 2016 21:47:25 +0200 Subject: [PATCH] mir: Don't memset allocas of types that do not require drop. --- src/librustc_trans/trans/mir/lvalue.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc_trans/trans/mir/lvalue.rs b/src/librustc_trans/trans/mir/lvalue.rs index a8c67549380..ffc3b120674 100644 --- a/src/librustc_trans/trans/mir/lvalue.rs +++ b/src/librustc_trans/trans/mir/lvalue.rs @@ -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)) } }