rustc_driver

Function catch_fatal_errors

Source
pub fn catch_fatal_errors<F, R>(f: F) -> Result<R, FatalError>
where F: FnOnce() -> R,
Expand description

Runs a closure and catches unwinds triggered by fatal errors.

The compiler currently unwinds with a special sentinel value to abort compilation on fatal errors. This function catches that sentinel and turns the panic into a Result instead.