rust/tests/pass/catch.rs
2022-06-20 15:39:46 -07:00

10 lines
182 B
Rust

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