Skip to content

Commit bbab93a

Browse files
committed
Run default panic hook before aborting
The default hook prints the error message, and optionally the backtrace if RUST_BACKTRACE=1 is set, before aborting.
1 parent 2542ae4 commit bbab93a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ pub fn initialize(_argc: *const isize, _argv: *const *const *const u8) -> isize
2828
// impossible to build code using compiler plugins with this flag.
2929
// We will be able to remove this code when
3030
// https://github.com/rust-lang/cargo/issues/5423 is fixed.
31-
::std::panic::set_hook(Box::new(|_| {
31+
let default_hook = ::std::panic::take_hook();
32+
::std::panic::set_hook(Box::new(move |panic_info| {
33+
default_hook(panic_info);
3234
::std::process::abort();
3335
}));
3436
0

0 commit comments

Comments
 (0)