about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-09-07 09:17:27 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-09-07 09:32:56 -0700
commitcd3cc6d17b68ef18199a54372963b00ba8a0a84f (patch)
treefe2dabb0a96c05bb3dcf6e59484ef3f3a5ed279c /src
parentcb5362334134f1d0d8b2c5557c49ee6534526474 (diff)
downloadrust-cd3cc6d17b68ef18199a54372963b00ba8a0a84f.tar.gz
rust-cd3cc6d17b68ef18199a54372963b00ba8a0a84f.zip
Ensure that scratch datum's are zeroed out in the alloca phase.
This should address the valgrind failure that @elliotslaughter
was seeing, though I am not sure why the bots / test continued
to pass, since this is precisely the condition this test was looking
for!
Diffstat (limited to 'src')
-rw-r--r--src/rustc/middle/trans/datum.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rustc/middle/trans/datum.rs b/src/rustc/middle/trans/datum.rs
index d6338eb8565..539439ecc81 100644
--- a/src/rustc/middle/trans/datum.rs
+++ b/src/rustc/middle/trans/datum.rs
@@ -177,8 +177,8 @@ fn scratch_datum(bcx: block, ty: ty::t, zero: bool) -> Datum {
      * returns a by-ref Datum pointing to it.  You must arrange
      * any cleanups etc yourself! */
 
-    let scratch = alloc_ty(bcx, ty);
-    if zero { zero_mem(bcx, scratch, ty); }
+    let llty = type_of::type_of(bcx.ccx(), ty);
+    let scratch = alloca_maybe_zeroed(bcx, llty, zero);
     Datum { val: scratch, ty: ty, mode: ByRef, source: FromRvalue }
 }