}
pub trait Cleanup {
+ fn must_unwind(&self) -> bool;
fn clean_on_unwind(&self) -> bool;
fn trans<'a>(&self, bcx: &'a Block<'a>) -> &'a Block<'a>;
}
if !ty::type_needs_drop(self.ccx.tcx(), ty) { return; }
let drop = box DropValue {
is_immediate: false,
- on_unwind: ty::type_needs_unwind_cleanup(self.ccx.tcx(), ty),
+ must_unwind: ty::type_needs_unwind_cleanup(self.ccx.tcx(), ty),
val: val,
ty: ty,
zero: false
if !ty::type_needs_drop(self.ccx.tcx(), ty) { return; }
let drop = box DropValue {
is_immediate: false,
- on_unwind: ty::type_needs_unwind_cleanup(self.ccx.tcx(), ty),
+ must_unwind: ty::type_needs_unwind_cleanup(self.ccx.tcx(), ty),
val: val,
ty: ty,
zero: true
if !ty::type_needs_drop(self.ccx.tcx(), ty) { return; }
let drop = box DropValue {
is_immediate: true,
- on_unwind: ty::type_needs_unwind_cleanup(self.ccx.tcx(), ty),
+ must_unwind: ty::type_needs_unwind_cleanup(self.ccx.tcx(), ty),
val: val,
ty: ty,
zero: false
}
fn needs_invoke(&self) -> bool {
- /*! True if this scope has cleanups for use during unwinding */
+ /*! True if this scope has cleanups that need unwinding */
self.cached_landing_pad.is_some() ||
- self.cleanups.iter().any(|c| c.clean_on_unwind())
+ self.cleanups.iter().any(|c| c.must_unwind())
}
fn block_name(&self, prefix: &str) -> String {
pub struct DropValue {
is_immediate: bool,
- on_unwind: bool,
+ must_unwind: bool,
val: ValueRef,
ty: ty::t,
zero: bool
}
impl Cleanup for DropValue {
+ fn must_unwind(&self) -> bool {
+ self.must_unwind
+ }
+
fn clean_on_unwind(&self) -> bool {
- self.on_unwind
+ self.must_unwind
}
fn trans<'a>(&self, bcx: &'a Block<'a>) -> &'a Block<'a> {
}
impl Cleanup for FreeValue {
+ fn must_unwind(&self) -> bool {
+ true
+ }
+
fn clean_on_unwind(&self) -> bool {
true
}
}
impl Cleanup for LifetimeEnd {
- fn clean_on_unwind(&self) -> bool {
+ fn must_unwind(&self) -> bool {
false
}
+ fn clean_on_unwind(&self) -> bool {
+ true
+ }
+
fn trans<'a>(&self, bcx: &'a Block<'a>) -> &'a Block<'a> {
base::call_lifetime_end(bcx, self.ptr);
bcx