11use rustc_errors:: { fluent, AddSubdiagnostic , Applicability , Diagnostic , DiagnosticArgFromDisplay } ;
2- use rustc_macros:: { SessionDiagnostic , SessionSubdiagnostic } ;
2+ use rustc_macros:: { DiagnosticHandler , SessionSubdiagnostic } ;
33use rustc_span:: { symbol:: Ident , Span , Symbol } ;
44
5- #[ derive( SessionDiagnostic , Clone , Copy ) ]
5+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
66#[ diag( ast_lowering:: generic_type_with_parentheses, code = "E0214" ) ]
77pub struct GenericTypeWithParentheses {
88 #[ primary_span]
@@ -28,7 +28,7 @@ impl AddSubdiagnostic for UseAngleBrackets {
2828 }
2929}
3030
31- #[ derive( SessionDiagnostic ) ]
31+ #[ derive( DiagnosticHandler ) ]
3232#[ help]
3333#[ diag( ast_lowering:: invalid_abi, code = "E0703" ) ]
3434pub struct InvalidAbi {
@@ -39,7 +39,7 @@ pub struct InvalidAbi {
3939 pub valid_abis : String ,
4040}
4141
42- #[ derive( SessionDiagnostic , Clone , Copy ) ]
42+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
4343#[ diag( ast_lowering:: assoc_ty_parentheses) ]
4444pub struct AssocTyParentheses {
4545 #[ primary_span]
@@ -71,38 +71,38 @@ impl AddSubdiagnostic for AssocTyParenthesesSub {
7171 }
7272}
7373
74- #[ derive( SessionDiagnostic ) ]
74+ #[ derive( DiagnosticHandler ) ]
7575#[ diag( ast_lowering:: misplaced_impl_trait, code = "E0562" ) ]
7676pub struct MisplacedImplTrait < ' a > {
7777 #[ primary_span]
7878 pub span : Span ,
7979 pub position : DiagnosticArgFromDisplay < ' a > ,
8080}
8181
82- #[ derive( SessionDiagnostic , Clone , Copy ) ]
82+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
8383#[ diag( ast_lowering:: rustc_box_attribute_error) ]
8484pub struct RustcBoxAttributeError {
8585 #[ primary_span]
8686 pub span : Span ,
8787}
8888
89- #[ derive( SessionDiagnostic , Clone , Copy ) ]
89+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
9090#[ diag( ast_lowering:: underscore_expr_lhs_assign) ]
9191pub struct UnderscoreExprLhsAssign {
9292 #[ primary_span]
9393 #[ label]
9494 pub span : Span ,
9595}
9696
97- #[ derive( SessionDiagnostic , Clone , Copy ) ]
97+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
9898#[ diag( ast_lowering:: base_expression_double_dot) ]
9999pub struct BaseExpressionDoubleDot {
100100 #[ primary_span]
101101 #[ label]
102102 pub span : Span ,
103103}
104104
105- #[ derive( SessionDiagnostic , Clone , Copy ) ]
105+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
106106#[ diag( ast_lowering:: await_only_in_async_fn_and_blocks, code = "E0728" ) ]
107107pub struct AwaitOnlyInAsyncFnAndBlocks {
108108 #[ primary_span]
@@ -112,58 +112,58 @@ pub struct AwaitOnlyInAsyncFnAndBlocks {
112112 pub item_span : Option < Span > ,
113113}
114114
115- #[ derive( SessionDiagnostic , Clone , Copy ) ]
115+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
116116#[ diag( ast_lowering:: generator_too_many_parameters, code = "E0628" ) ]
117117pub struct GeneratorTooManyParameters {
118118 #[ primary_span]
119119 pub fn_decl_span : Span ,
120120}
121121
122- #[ derive( SessionDiagnostic , Clone , Copy ) ]
122+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
123123#[ diag( ast_lowering:: closure_cannot_be_static, code = "E0697" ) ]
124124pub struct ClosureCannotBeStatic {
125125 #[ primary_span]
126126 pub fn_decl_span : Span ,
127127}
128128
129- #[ derive( SessionDiagnostic , Clone , Copy ) ]
129+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
130130#[ help]
131131#[ diag( ast_lowering:: async_non_move_closure_not_supported, code = "E0708" ) ]
132132pub struct AsyncNonMoveClosureNotSupported {
133133 #[ primary_span]
134134 pub fn_decl_span : Span ,
135135}
136136
137- #[ derive( SessionDiagnostic , Clone , Copy ) ]
137+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
138138#[ diag( ast_lowering:: functional_record_update_destructuring_assignment) ]
139139pub struct FunctionalRecordUpdateDestructuringAssignemnt {
140140 #[ primary_span]
141141 #[ suggestion( code = "" , applicability = "machine-applicable" ) ]
142142 pub span : Span ,
143143}
144144
145- #[ derive( SessionDiagnostic , Clone , Copy ) ]
145+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
146146#[ diag( ast_lowering:: async_generators_not_supported, code = "E0727" ) ]
147147pub struct AsyncGeneratorsNotSupported {
148148 #[ primary_span]
149149 pub span : Span ,
150150}
151151
152- #[ derive( SessionDiagnostic , Clone , Copy ) ]
152+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
153153#[ diag( ast_lowering:: inline_asm_unsupported_target, code = "E0472" ) ]
154154pub struct InlineAsmUnsupportedTarget {
155155 #[ primary_span]
156156 pub span : Span ,
157157}
158158
159- #[ derive( SessionDiagnostic , Clone , Copy ) ]
159+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
160160#[ diag( ast_lowering:: att_syntax_only_x86) ]
161161pub struct AttSyntaxOnlyX86 {
162162 #[ primary_span]
163163 pub span : Span ,
164164}
165165
166- #[ derive( SessionDiagnostic , Clone , Copy ) ]
166+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
167167#[ diag( ast_lowering:: abi_specified_multiple_times) ]
168168pub struct AbiSpecifiedMultipleTimes {
169169 #[ primary_span]
@@ -175,14 +175,14 @@ pub struct AbiSpecifiedMultipleTimes {
175175 pub equivalent : Option < ( ) > ,
176176}
177177
178- #[ derive( SessionDiagnostic , Clone , Copy ) ]
178+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
179179#[ diag( ast_lowering:: clobber_abi_not_supported) ]
180180pub struct ClobberAbiNotSupported {
181181 #[ primary_span]
182182 pub abi_span : Span ,
183183}
184184
185- #[ derive( SessionDiagnostic ) ]
185+ #[ derive( DiagnosticHandler ) ]
186186#[ note]
187187#[ diag( ast_lowering:: invalid_abi_clobber_abi) ]
188188pub struct InvalidAbiClobberAbi {
@@ -191,7 +191,7 @@ pub struct InvalidAbiClobberAbi {
191191 pub supported_abis : String ,
192192}
193193
194- #[ derive( SessionDiagnostic , Clone , Copy ) ]
194+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
195195#[ diag( ast_lowering:: invalid_register) ]
196196pub struct InvalidRegister < ' a > {
197197 #[ primary_span]
@@ -200,7 +200,7 @@ pub struct InvalidRegister<'a> {
200200 pub error : & ' a str ,
201201}
202202
203- #[ derive( SessionDiagnostic , Clone , Copy ) ]
203+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
204204#[ diag( ast_lowering:: invalid_register_class) ]
205205pub struct InvalidRegisterClass < ' a > {
206206 #[ primary_span]
@@ -209,7 +209,7 @@ pub struct InvalidRegisterClass<'a> {
209209 pub error : & ' a str ,
210210}
211211
212- #[ derive( SessionDiagnostic ) ]
212+ #[ derive( DiagnosticHandler ) ]
213213#[ diag( ast_lowering:: invalid_asm_template_modifier_reg_class) ]
214214pub struct InvalidAsmTemplateModifierRegClass {
215215 #[ primary_span]
@@ -229,7 +229,7 @@ pub enum InvalidAsmTemplateModifierRegClassSub {
229229 DoesNotSupportModifier { class_name : Symbol } ,
230230}
231231
232- #[ derive( SessionDiagnostic , Clone , Copy ) ]
232+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
233233#[ diag( ast_lowering:: invalid_asm_template_modifier_const) ]
234234pub struct InvalidAsmTemplateModifierConst {
235235 #[ primary_span]
@@ -239,7 +239,7 @@ pub struct InvalidAsmTemplateModifierConst {
239239 pub op_span : Span ,
240240}
241241
242- #[ derive( SessionDiagnostic , Clone , Copy ) ]
242+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
243243#[ diag( ast_lowering:: invalid_asm_template_modifier_sym) ]
244244pub struct InvalidAsmTemplateModifierSym {
245245 #[ primary_span]
@@ -249,15 +249,15 @@ pub struct InvalidAsmTemplateModifierSym {
249249 pub op_span : Span ,
250250}
251251
252- #[ derive( SessionDiagnostic , Clone , Copy ) ]
252+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
253253#[ diag( ast_lowering:: register_class_only_clobber) ]
254254pub struct RegisterClassOnlyClobber {
255255 #[ primary_span]
256256 pub op_span : Span ,
257257 pub reg_class_name : Symbol ,
258258}
259259
260- #[ derive( SessionDiagnostic , Clone , Copy ) ]
260+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
261261#[ diag( ast_lowering:: register_conflict) ]
262262pub struct RegisterConflict < ' a > {
263263 #[ primary_span]
@@ -271,7 +271,7 @@ pub struct RegisterConflict<'a> {
271271 pub in_out : Option < Span > ,
272272}
273273
274- #[ derive( SessionDiagnostic , Clone , Copy ) ]
274+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
275275#[ help]
276276#[ diag( ast_lowering:: sub_tuple_binding) ]
277277pub struct SubTupleBinding < ' a > {
@@ -288,7 +288,7 @@ pub struct SubTupleBinding<'a> {
288288 pub ctx : & ' a str ,
289289}
290290
291- #[ derive( SessionDiagnostic , Clone , Copy ) ]
291+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
292292#[ diag( ast_lowering:: extra_double_dot) ]
293293pub struct ExtraDoubleDot < ' a > {
294294 #[ primary_span]
@@ -299,36 +299,36 @@ pub struct ExtraDoubleDot<'a> {
299299 pub ctx : & ' a str ,
300300}
301301
302- #[ derive( SessionDiagnostic , Clone , Copy ) ]
302+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
303303#[ note]
304304#[ diag( ast_lowering:: misplaced_double_dot) ]
305305pub struct MisplacedDoubleDot {
306306 #[ primary_span]
307307 pub span : Span ,
308308}
309309
310- #[ derive( SessionDiagnostic , Clone , Copy ) ]
310+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
311311#[ diag( ast_lowering:: misplaced_relax_trait_bound) ]
312312pub struct MisplacedRelaxTraitBound {
313313 #[ primary_span]
314314 pub span : Span ,
315315}
316316
317- #[ derive( SessionDiagnostic , Clone , Copy ) ]
317+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
318318#[ diag( ast_lowering:: not_supported_for_lifetime_binder_async_closure) ]
319319pub struct NotSupportedForLifetimeBinderAsyncClosure {
320320 #[ primary_span]
321321 pub span : Span ,
322322}
323323
324- #[ derive( SessionDiagnostic , Clone , Copy ) ]
324+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
325325#[ diag( ast_lowering:: arbitrary_expression_in_pattern) ]
326326pub struct ArbitraryExpressionInPattern {
327327 #[ primary_span]
328328 pub span : Span ,
329329}
330330
331- #[ derive( SessionDiagnostic , Clone , Copy ) ]
331+ #[ derive( DiagnosticHandler , Clone , Copy ) ]
332332#[ diag( ast_lowering:: inclusive_range_with_no_end) ]
333333pub struct InclusiveRangeWithNoEnd {
334334 #[ primary_span]
0 commit comments