1 2 3 4 5 6 7 8
use run_on_drop::on_drop; pub(crate) fn abort_on_panic<T>(f: impl FnOnce() -> T) -> T { let abort = on_drop(|| std::process::abort()); let res = f(); abort.forget(); res }