rust/tests/run-pass/catch.rs

9 lines
218 B
Rust

//ignore-msvc: Stdout not implemented on Windows
use std::panic::{catch_unwind, AssertUnwindSafe};
fn main() {
let mut i = 3;
let _val = catch_unwind(AssertUnwindSafe(|| {i -= 2;} ));
println!("{}", i);
}