Motivation
It is often desirable to do some action on program failure, e.g. to show a nice GUI dialog box. This can be done through unwinding, but that requires compiling with unwinding support, which is a performance cost when one has 1 logical task per process.
For example, rustc does not really need landing pads (and would prefer to compile itself with -Z no-landing-pads
at least for stage1), but also wants to display a styled error message when compilation is aborted, e.g. because of an trait evaluation overflow.
Insufficiently-detailed proposal
Add a struct PanicInfo
and an
fn set_panic_handler<F: Fn(PanicInfo)+Send>(f: F)
. Add some methods for PanicInfo
to get the panic information.