This repository was archived by the owner on May 28, 2025. It is now read-only.
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> {
331331 let max_num_args: usize = u16:: MAX . into ( ) ;
332332 if fn_decl. inputs . len ( ) > max_num_args {
333333 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 } ) ;
335335 }
336336 }
337337
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ pub struct ForbiddenNonLifetimeParam {
106106}
107107
108108#[ derive( SessionDiagnostic ) ]
109- #[ error ( ast_passes:: fn_param_too_many) ]
109+ #[ fatal ( ast_passes:: fn_param_too_many) ]
110110pub struct FnParamTooMany {
111111 #[ primary_span]
112112 pub span : Span ,
Original file line number Diff line number Diff line change @@ -360,6 +360,17 @@ impl ParseSess {
360360 self . create_warning ( warning) . emit ( )
361361 }
362362
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+
363374 #[ rustc_lint_diagnostics]
364375 pub fn struct_err (
365376 & self ,
@@ -373,6 +384,11 @@ impl ParseSess {
373384 self . span_diagnostic . struct_warn ( msg)
374385 }
375386
387+ #[ rustc_lint_diagnostics]
388+ pub fn struct_fatal ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , !> {
389+ self . span_diagnostic . struct_fatal ( msg)
390+ }
391+
376392 #[ rustc_lint_diagnostics]
377393 pub fn struct_diagnostic < G : EmissionGuarantee > (
378394 & self ,
Original file line number Diff line number Diff line change @@ -482,6 +482,15 @@ impl Session {
482482 pub fn emit_warning < ' a > ( & ' a self , warning : impl SessionDiagnostic < ' a , ( ) > ) {
483483 self . parse_sess . emit_warning ( warning)
484484 }
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+ }
485494 #[ inline]
486495 pub fn err_count ( & self ) -> usize {
487496 self . diagnostic ( ) . err_count ( )
You can’t perform that action at this time.
0 commit comments