rust/tests/pass/catch.rs

8 lines
165 B
Rust
Raw Normal View History

2017-05-26 19:27:39 -05:00
use std::panic::{catch_unwind, AssertUnwindSafe};
fn main() {
let mut i = 3;
2022-06-20 17:43:42 -05:00
let _val = catch_unwind(AssertUnwindSafe(|| i -= 2));
println!("{}", i);
2017-05-26 19:27:39 -05:00
}