1
Fork 0

Run cleanups during unwinding

Issue #236
This commit is contained in:
Brian Anderson 2011-09-07 15:12:37 -07:00
parent 587b863772
commit 4c9eee8aa4
2 changed files with 22 additions and 0 deletions

View file

@ -3823,6 +3823,18 @@ fn trans_landing_pad(bcx: &@block_ctxt) {
let llretval = llpad;
// The landing pad block is a cleanup
SetCleanup(bcx, llpad);
let bcx = bcx;
let scope_cx = bcx;
while true {
scope_cx = find_scope_cx(scope_cx);
bcx = trans_block_cleanups(bcx, scope_cx);
scope_cx = alt scope_cx.parent {
parent_some(b) { b }
parent_none. { break; }
};
}
// Continue unwinding
Resume(bcx, llretval);
}

View file

@ -0,0 +1,10 @@
// error-pattern:fail
fn failfn() {
fail;
}
fn main() {
@0;
failfn();
}