diff options
Diffstat (limited to 'library/proc_macro/src/bridge/client.rs')
| -rw-r--r-- | library/proc_macro/src/bridge/client.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/library/proc_macro/src/bridge/client.rs b/library/proc_macro/src/bridge/client.rs index f3cfc41bac7..faca745e56f 100644 --- a/library/proc_macro/src/bridge/client.rs +++ b/library/proc_macro/src/bridge/client.rs @@ -283,7 +283,11 @@ fn maybe_install_panic_hook(force_show_panics: bool) { HIDE_PANICS_DURING_EXPANSION.call_once(|| { let prev = panic::take_hook(); panic::set_hook(Box::new(move |info| { - if force_show_panics || !is_available() { + // We normally report panics by catching unwinds and passing the payload from the + // unwind back to the compiler, but if the panic doesn't unwind we'll abort before + // the compiler has a chance to print an error. So we special-case PanicInfo where + // can_unwind is false. + if force_show_panics || !is_available() || !info.can_unwind() { prev(info) } })); |
