about summary refs log tree commit diff
path: root/tests/ui/panics/panic-set-unset-handler.rs
blob: 4f6460200377ee17086a41c32b3f87cada0318e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//@ run-fail
//@ regex-error-pattern: thread 'main' \(\d+\) panicked
//@ error-pattern: foobar
//@ needs-subprocess

use std::panic;

fn main() {
    panic::set_hook(Box::new(|i| {
        eprint!("greetings from the panic handler");
    }));
    panic::take_hook();
    panic!("foobar");
}