diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-10-07 14:46:23 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-10-07 14:46:23 +0200 |
| commit | c7eee8fb059fc9639f2a4e5ef749dc3701bf3377 (patch) | |
| tree | 5af1231b765cf7eaab741a64ee4b1e371505bf9f /src/comp | |
| parent | 31586339b14e8c4167c3bf80d375881f3ff2fb19 (diff) | |
| download | rust-c7eee8fb059fc9639f2a4e5ef749dc3701bf3377.tar.gz rust-c7eee8fb059fc9639f2a4e5ef749dc3701bf3377.zip | |
Stop registering cleanups for types that don't need them
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/trans_common.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index 32dbb5334d7..0a882c0d94b 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -264,11 +264,13 @@ tag cleanup { } fn add_clean(cx: @block_ctxt, val: ValueRef, ty: ty::t) { + if !ty::type_needs_drop(bcx_tcx(cx), ty) { ret; } let scope_cx = find_scope_cx(cx); scope_cx.cleanups += [clean(bind drop_ty(_, val, ty))]; scope_cx.lpad_dirty = true; } fn add_clean_temp(cx: @block_ctxt, val: ValueRef, ty: ty::t) { + if !ty::type_needs_drop(bcx_tcx(cx), ty) { ret; } fn spill_and_drop(cx: @block_ctxt, val: ValueRef, ty: ty::t) -> @block_ctxt { let bcx = cx; @@ -283,6 +285,7 @@ fn add_clean_temp(cx: @block_ctxt, val: ValueRef, ty: ty::t) { scope_cx.lpad_dirty = true; } fn add_clean_temp_mem(cx: @block_ctxt, val: ValueRef, ty: ty::t) { + if !ty::type_needs_drop(bcx_tcx(cx), ty) { ret; } let scope_cx = find_scope_cx(cx); scope_cx.cleanups += [clean_temp(val, bind drop_ty(_, val, ty))]; scope_cx.lpad_dirty = true; |
