rust/src/test/ui/panics/panic-set-unset-handler.rs

13 lines
239 B
Rust
Raw Normal View History

2020-04-16 06:50:32 +00:00
// run-fail
// error-pattern:thread 'main' panicked at 'foobar'
2015-12-18 07:51:55 +00:00
use std::panic;
fn main() {
panic::set_hook(Box::new(|i| {
eprint!("greetings from the panic handler");
}));
panic::take_hook();
2015-12-18 07:51:55 +00:00
panic!("foobar");
}