@@ -206,13 +206,9 @@ impl Handler {
206
206
can_emit_warnings : can_emit_warnings
207
207
}
208
208
}
209
- pub fn fatal ( & self , msg : & str ) -> ! {
209
+ pub fn fatal ( & self , msg : & str ) -> FatalError {
210
210
self . emit . borrow_mut ( ) . emit ( None , msg, None , Fatal ) ;
211
-
212
- // Suppress the fatal error message from the panic below as we've
213
- // already terminated in our own "legitimate" fashion.
214
- io:: set_panic ( Box :: new ( io:: sink ( ) ) ) ;
215
- panic ! ( FatalError ) ;
211
+ FatalError
216
212
}
217
213
pub fn err ( & self , msg : & str ) {
218
214
self . emit . borrow_mut ( ) . emit ( None , msg, None , Error ) ;
@@ -230,14 +226,15 @@ impl Handler {
230
226
pub fn abort_if_errors ( & self ) {
231
227
let s;
232
228
match self . err_count . get ( ) {
233
- 0 => return ,
234
- 1 => s = "aborting due to previous error" . to_string ( ) ,
235
- _ => {
236
- s = format ! ( "aborting due to {} previous errors" ,
237
- self . err_count. get( ) ) ;
238
- }
229
+ 0 => return ,
230
+ 1 => s = "aborting due to previous error" . to_string ( ) ,
231
+ _ => {
232
+ s = format ! ( "aborting due to {} previous errors" ,
233
+ self . err_count. get( ) ) ;
234
+ }
239
235
}
240
- self . fatal ( & s[ ..] ) ;
236
+
237
+ panic ! ( self . fatal( & s[ ..] ) ) ;
241
238
}
242
239
pub fn warn ( & self , msg : & str ) {
243
240
self . emit . borrow_mut ( ) . emit ( None , msg, None , Warning ) ;
0 commit comments