diff options
| author | Patrick Walton <[email protected]> | 2010-12-17 17:21:56 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-12-17 17:21:56 -0800 |
| commit | c44c7c5ab3fdd4e48fbb8f9a5e80d70a33a98f03 (patch) | |
| tree | e9f3a2fb028520284f8f9c662d461beca181c909 /src/comp | |
| parent | Trans methods more correctly, and store vtbl pointer in pair returned from ob... (diff) | |
| download | rust-c44c7c5ab3fdd4e48fbb8f9a5e80d70a33a98f03.tar.xz rust-c44c7c5ab3fdd4e48fbb8f9a5e80d70a33a98f03.zip | |
rustc: Zero out slots after dropping them
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/trans.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 6a926b9d..2b6ab9b0 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -768,7 +768,7 @@ fn type_of_variant(@crate_ctxt cx, &ast.variant v) -> TypeRef { type val_and_ty_fn = fn(@block_ctxt cx, ValueRef v, @typeck.ty t) -> result; -// Iterates through the elements of a tup, rec or tag. +// Iterates through the elements of a box, tup, rec or tag. fn iter_structural_ty(@block_ctxt cx, ValueRef v, @typeck.ty t, @@ -968,7 +968,13 @@ fn incr_all_refcnts(@block_ctxt cx, fn drop_slot(@block_ctxt cx, ValueRef slot, @typeck.ty t) -> result { - be drop_ty(cx, load_non_structural(cx, slot, t), t); + auto llptr = load_non_structural(cx, slot, t); + auto re = drop_ty(cx, llptr, t); + + auto llty = val_ty(slot); + auto llelemty = lib.llvm.llvm.LLVMGetElementType(llty); + re.bcx.build.Store(C_null(llelemty), slot); + ret re; } fn drop_ty(@block_ctxt cx, |