1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 use core::finally::{try_finally, Finally};
14 use std::thread::Thread;
25 assert!(!Thread::panicking());
43 assert!(Thread::panicking());
50 let mut closure = || 10;
51 // FIXME(#16640) `: i32` annotation shouldn't be necessary
52 let i: i32 = closure.finally(|| { });
58 fn do_some_fallible_work() {}
59 fn but_always_run_this_function() { }
60 let mut f = do_some_fallible_work;
61 f.finally(but_always_run_this_function);