File tree Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ impl<'a> AstValidator<'a> {
331
331
let max_num_args: usize = u16:: MAX . into ( ) ;
332
332
if fn_decl. inputs . len ( ) > max_num_args {
333
333
let Param { span, .. } = fn_decl. inputs [ 0 ] ;
334
- self . session . emit_err ( FnParamTooMany { span, max_num_args } ) ;
334
+ self . session . emit_fatal ( FnParamTooMany { span, max_num_args } ) ;
335
335
}
336
336
}
337
337
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ pub struct ForbiddenNonLifetimeParam {
106
106
}
107
107
108
108
#[ derive( SessionDiagnostic ) ]
109
- #[ error ( ast_passes:: fn_param_too_many) ]
109
+ #[ fatal ( ast_passes:: fn_param_too_many) ]
110
110
pub struct FnParamTooMany {
111
111
#[ primary_span]
112
112
pub span : Span ,
Original file line number Diff line number Diff line change @@ -360,6 +360,17 @@ impl ParseSess {
360
360
self . create_warning ( warning) . emit ( )
361
361
}
362
362
363
+ pub fn create_fatal < ' a > (
364
+ & ' a self ,
365
+ fatal : impl SessionDiagnostic < ' a , !> ,
366
+ ) -> DiagnosticBuilder < ' a , !> {
367
+ fatal. into_diagnostic ( self )
368
+ }
369
+
370
+ pub fn emit_fatal < ' a > ( & ' a self , fatal : impl SessionDiagnostic < ' a , !> ) -> ! {
371
+ self . create_fatal ( fatal) . emit ( )
372
+ }
373
+
363
374
#[ rustc_lint_diagnostics]
364
375
pub fn struct_err (
365
376
& self ,
@@ -373,6 +384,11 @@ impl ParseSess {
373
384
self . span_diagnostic . struct_warn ( msg)
374
385
}
375
386
387
+ #[ rustc_lint_diagnostics]
388
+ pub fn struct_fatal ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , !> {
389
+ self . span_diagnostic . struct_fatal ( msg)
390
+ }
391
+
376
392
#[ rustc_lint_diagnostics]
377
393
pub fn struct_diagnostic < G : EmissionGuarantee > (
378
394
& self ,
Original file line number Diff line number Diff line change @@ -482,6 +482,15 @@ impl Session {
482
482
pub fn emit_warning < ' a > ( & ' a self , warning : impl SessionDiagnostic < ' a , ( ) > ) {
483
483
self . parse_sess . emit_warning ( warning)
484
484
}
485
+ pub fn create_fatal < ' a > (
486
+ & ' a self ,
487
+ fatal : impl SessionDiagnostic < ' a , !> ,
488
+ ) -> DiagnosticBuilder < ' a , !> {
489
+ self . parse_sess . create_fatal ( fatal)
490
+ }
491
+ pub fn emit_fatal < ' a > ( & ' a self , fatal : impl SessionDiagnostic < ' a , !> ) {
492
+ self . parse_sess . emit_fatal ( fatal)
493
+ }
485
494
#[ inline]
486
495
pub fn err_count ( & self ) -> usize {
487
496
self . diagnostic ( ) . err_count ( )
You can’t perform that action at this time.
0 commit comments