rust/tests/run-pass/catch.rs
2018-12-19 12:16:07 +01:00

8 lines
169 B
Rust

use std::panic::{catch_unwind, AssertUnwindSafe};
fn main() {
let mut i = 3;
let _val = catch_unwind(AssertUnwindSafe(|| {i -= 2;} ));
println!("{}", i);
}