2024-02-16 20:02:50 +00:00
|
|
|
//@ run-fail
|
2023-09-11 00:59:31 -04:00
|
|
|
//@ regex-error-pattern: thread 'main' \(\d+\) panicked
|
|
|
|
|
//@ error-pattern: foobar
|
2025-01-23 16:36:54 +08:00
|
|
|
//@ needs-subprocess
|
2015-12-17 23:51:55 -08:00
|
|
|
|
|
|
|
|
use std::panic;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2016-05-24 14:24:44 -07:00
|
|
|
panic::set_hook(Box::new(|i| {
|
2017-09-25 00:14:56 -04:00
|
|
|
eprint!("greetings from the panic handler");
|
2016-05-24 14:24:44 -07:00
|
|
|
}));
|
|
|
|
|
panic::take_hook();
|
2015-12-17 23:51:55 -08:00
|
|
|
panic!("foobar");
|
|
|
|
|
}
|