@@ -673,7 +673,7 @@ impl DiagCtxt {
673673 let key = ( span. with_parent ( None ) , key) ;
674674
675675 if diag. is_error ( ) {
676- if matches ! ( diag. level, Error { lint : true } ) {
676+ if diag. level == Error && diag . is_lint {
677677 inner. lint_err_count += 1 ;
678678 } else {
679679 inner. err_count += 1 ;
@@ -697,7 +697,7 @@ impl DiagCtxt {
697697 let key = ( span. with_parent ( None ) , key) ;
698698 let diag = inner. stashed_diagnostics . remove ( & key) ?;
699699 if diag. is_error ( ) {
700- if matches ! ( diag. level, Error { lint : true } ) {
700+ if diag. level == Error && diag . is_lint {
701701 inner. lint_err_count -= 1 ;
702702 } else {
703703 inner. err_count -= 1 ;
@@ -812,7 +812,7 @@ impl DiagCtxt {
812812 #[ rustc_lint_diagnostics]
813813 #[ track_caller]
814814 pub fn struct_err ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ > {
815- DiagnosticBuilder :: new ( self , Error { lint : false } , msg)
815+ DiagnosticBuilder :: new ( self , Error , msg)
816816 }
817817
818818 /// Construct a builder at the `Error` level with the `msg` and the `code`.
@@ -1212,7 +1212,7 @@ impl DiagCtxt {
12121212
12131213 #[ track_caller]
12141214 pub fn create_err < ' a > ( & ' a self , err : impl IntoDiagnostic < ' a > ) -> DiagnosticBuilder < ' a > {
1215- err. into_diagnostic ( self , Error { lint : false } )
1215+ err. into_diagnostic ( self , Error )
12161216 }
12171217
12181218 #[ track_caller]
@@ -1367,7 +1367,7 @@ impl DiagCtxtInner {
13671367 for diag in diags {
13681368 // Decrement the count tracking the stash; emitting will increment it.
13691369 if diag. is_error ( ) {
1370- if matches ! ( diag. level, Error { lint : true } ) {
1370+ if diag. level == Error && diag . is_lint {
13711371 self . lint_err_count -= 1 ;
13721372 } else {
13731373 self . err_count -= 1 ;
@@ -1398,7 +1398,7 @@ impl DiagCtxtInner {
13981398 & mut self ,
13991399 diagnostic : & mut Diagnostic ,
14001400 ) -> Option < ErrorGuaranteed > {
1401- if matches ! ( diagnostic. level, Error { .. } | Fatal ) && self . treat_err_as_bug ( ) {
1401+ if matches ! ( diagnostic. level, Error | Fatal ) && self . treat_err_as_bug ( ) {
14021402 diagnostic. level = Bug ;
14031403 }
14041404
@@ -1499,7 +1499,7 @@ impl DiagCtxtInner {
14991499 }
15001500 }
15011501 if diagnostic. is_error ( ) {
1502- if matches ! ( diagnostic. level, Error { lint : true } ) {
1502+ if diagnostic. level == Error && diagnostic . is_lint {
15031503 self . bump_lint_err_count ( ) ;
15041504 } else {
15051505 self . bump_err_count ( ) ;
@@ -1695,11 +1695,7 @@ pub enum Level {
16951695 /// most common case.
16961696 ///
16971697 /// Its `EmissionGuarantee` is `ErrorGuaranteed`.
1698- Error {
1699- /// If this error comes from a lint, don't abort compilation even when abort_if_errors() is
1700- /// called.
1701- lint : bool ,
1702- } ,
1698+ Error ,
17031699
17041700 /// A warning about the code being compiled. Does not prevent compilation from finishing.
17051701 ///
@@ -1758,7 +1754,7 @@ impl Level {
17581754 fn color ( self ) -> ColorSpec {
17591755 let mut spec = ColorSpec :: new ( ) ;
17601756 match self {
1761- Bug | DelayedBug | Fatal | Error { .. } => {
1757+ Bug | DelayedBug | Fatal | Error => {
17621758 spec. set_fg ( Some ( Color :: Red ) ) . set_intense ( true ) ;
17631759 }
17641760 Warning ( _) => {
@@ -1779,7 +1775,7 @@ impl Level {
17791775 pub fn to_str ( self ) -> & ' static str {
17801776 match self {
17811777 Bug | DelayedBug => "error: internal compiler error" ,
1782- Fatal | Error { .. } => "error" ,
1778+ Fatal | Error => "error" ,
17831779 Warning ( _) => "warning" ,
17841780 Note | OnceNote => "note" ,
17851781 Help | OnceHelp => "help" ,
0 commit comments