11use rustc_errors:: codes:: * ;
2- use rustc_errors:: { Diag , EmissionGuarantee , Subdiagnostic } ;
2+ use rustc_errors:: { Diag , EmissionGuarantee , Subdiagnostic , inline_fluent } ;
33use rustc_macros:: { Diagnostic , Subdiagnostic } ;
44use rustc_session:: lint:: Level ;
55use rustc_span:: { Span , Symbol } ;
66
7- use crate :: fluent_generated as fluent;
8-
97#[ derive( Diagnostic ) ]
10- #[ diag( lint_overruled_attribute , code = E0453 ) ]
8+ #[ diag( "{$lint_level}({$lint_source}) incompatible with previous forbid" , code = E0453 ) ]
119pub ( crate ) struct OverruledAttribute < ' a > {
1210 #[ primary_span]
1311 pub span : Span ,
14- #[ label]
12+ #[ label( "overruled by previous forbid" ) ]
1513 pub overruled : Span ,
1614 pub lint_level : & ' a str ,
1715 pub lint_source : Symbol ,
@@ -29,24 +27,24 @@ impl Subdiagnostic for OverruledAttributeSub {
2927 fn add_to_diag < G : EmissionGuarantee > ( self , diag : & mut Diag < ' _ , G > ) {
3028 match self {
3129 OverruledAttributeSub :: DefaultSource { id } => {
32- diag. note ( fluent :: lint_default_source ) ;
30+ diag. note ( inline_fluent ! ( "`forbid` lint level is the default for {$id}" ) ) ;
3331 diag. arg ( "id" , id) ;
3432 }
3533 OverruledAttributeSub :: NodeSource { span, reason } => {
36- diag. span_label ( span, fluent :: lint_node_source ) ;
34+ diag. span_label ( span, inline_fluent ! ( "`forbid` level set here" ) ) ;
3735 if let Some ( rationale) = reason {
3836 diag. note ( rationale. to_string ( ) ) ;
3937 }
4038 }
4139 OverruledAttributeSub :: CommandLineSource => {
42- diag. note ( fluent :: lint_command_line_source ) ;
40+ diag. note ( inline_fluent ! ( "`forbid` lint level was set on command line" ) ) ;
4341 }
4442 }
4543 }
4644}
4745
4846#[ derive( Diagnostic ) ]
49- #[ diag( lint_malformed_attribute , code = E0452 ) ]
47+ #[ diag( "malformed lint attribute input" , code = E0452 ) ]
5048pub ( crate ) struct MalformedAttribute {
5149 #[ primary_span]
5250 pub span : Span ,
@@ -56,50 +54,55 @@ pub(crate) struct MalformedAttribute {
5654
5755#[ derive( Subdiagnostic ) ]
5856pub ( crate ) enum MalformedAttributeSub {
59- #[ label( lint_bad_attribute_argument ) ]
57+ #[ label( "bad attribute argument" ) ]
6058 BadAttributeArgument ( #[ primary_span] Span ) ,
61- #[ label( lint_reason_must_be_string_literal ) ]
59+ #[ label( "reason must be a string literal" ) ]
6260 ReasonMustBeStringLiteral ( #[ primary_span] Span ) ,
63- #[ label( lint_reason_must_come_last ) ]
61+ #[ label( "reason in lint attribute must come last" ) ]
6462 ReasonMustComeLast ( #[ primary_span] Span ) ,
6563}
6664
6765#[ derive( Diagnostic ) ]
68- #[ diag( lint_unknown_tool_in_scoped_lint , code = E0710 ) ]
66+ #[ diag( "unknown tool name `{$tool_name}` found in scoped lint: `{$tool_name}::{$lint_name}`" , code = E0710 ) ]
6967pub ( crate ) struct UnknownToolInScopedLint {
7068 #[ primary_span]
7169 pub span : Option < Span > ,
7270 pub tool_name : Symbol ,
7371 pub lint_name : String ,
74- #[ help]
72+ #[ help( "add `#![register_tool({$tool_name})]` to the crate root" ) ]
7573 pub is_nightly_build : bool ,
7674}
7775
7876#[ derive( Diagnostic ) ]
79- #[ diag( lint_builtin_ellipsis_inclusive_range_patterns , code = E0783 ) ]
77+ #[ diag( "`...` range patterns are deprecated" , code = E0783 ) ]
8078pub ( crate ) struct BuiltinEllipsisInclusiveRangePatterns {
8179 #[ primary_span]
8280 pub span : Span ,
83- #[ suggestion( style = "short" , code = "{replace}" , applicability = "machine-applicable" ) ]
81+ #[ suggestion(
82+ "use `..=` for an inclusive range" ,
83+ style = "short" ,
84+ code = "{replace}" ,
85+ applicability = "machine-applicable"
86+ ) ]
8487 pub suggestion : Span ,
8588 pub replace : String ,
8689}
8790
8891#[ derive( Subdiagnostic ) ]
89- #[ note( lint_requested_level ) ]
92+ #[ note( "requested on the command line with `{$level} {$lint_name}`" ) ]
9093pub ( crate ) struct RequestedLevel < ' a > {
9194 pub level : Level ,
9295 pub lint_name : & ' a str ,
9396}
9497
9598#[ derive( Diagnostic ) ]
96- #[ diag( lint_unsupported_group , code = E0602 ) ]
99+ #[ diag( "`{$lint_group}` lint group is not supported with ´--force-warn´" , code = E0602 ) ]
97100pub ( crate ) struct UnsupportedGroup {
98101 pub lint_group : String ,
99102}
100103
101104#[ derive( Diagnostic ) ]
102- #[ diag( lint_check_name_unknown_tool , code = E0602 ) ]
105+ #[ diag( "unknown lint tool: `{$tool_name}`" , code = E0602 ) ]
103106pub ( crate ) struct CheckNameUnknownTool < ' a > {
104107 pub tool_name : Symbol ,
105108 #[ subdiagnostic]
0 commit comments