1 /// Used as a return value to signify a fatal error occurred. (It is also
2 /// used as the argument to panic at the moment, but that will eventually
4 #[derive(Copy, Clone, Debug)]
8 pub struct FatalErrorMarker;
10 // Don't implement Send on FatalError. This makes it impossible to panic!(FatalError).
11 // We don't want to invoke the panic handler and print a backtrace for fatal errors.
12 impl !Send for FatalError {}
15 pub fn raise(self) -> ! {
16 std::panic::resume_unwind(Box::new(FatalErrorMarker))
20 impl std::fmt::Display for FatalError {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 write!(f, "parser fatal error")
26 impl std::error::Error for FatalError {}