mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
Stop registering cleanups for types that don't need them
This commit is contained in:
parent
31586339b1
commit
c7eee8fb05
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user