pub(crate) fn halt_unwinding<F, R>(func: F) -> Result<R>where
    F: FnOnce() -> R,Expand description
Executes f and captures any panic, translating that panic into a
Err result. The assumption is that any panic will be propagated
later with resume_unwinding, and hence f can be treated as
exception safe.