1
1
use rustc_errors:: {
2
2
codes:: * , AddToDiag , Diag , DiagArgFromDisplay , EmissionGuarantee , SubdiagMessageOp ,
3
3
} ;
4
- use rustc_macros:: { Diagnostic , Subdiagnostic } ;
4
+ use rustc_macros:: { AddToDiag , IntoDiag } ;
5
5
use rustc_span:: { symbol:: Ident , Span , Symbol } ;
6
6
7
- #[ derive( Diagnostic ) ]
7
+ #[ derive( IntoDiag ) ]
8
8
#[ diag( ast_lowering_generic_type_with_parentheses, code = E0214 ) ]
9
9
pub struct GenericTypeWithParentheses {
10
10
#[ primary_span]
@@ -14,7 +14,7 @@ pub struct GenericTypeWithParentheses {
14
14
pub sub : Option < UseAngleBrackets > ,
15
15
}
16
16
17
- #[ derive( Subdiagnostic ) ]
17
+ #[ derive( AddToDiag ) ]
18
18
#[ multipart_suggestion( ast_lowering_use_angle_brackets, applicability = "maybe-incorrect" ) ]
19
19
pub struct UseAngleBrackets {
20
20
#[ suggestion_part( code = "<" ) ]
@@ -23,7 +23,7 @@ pub struct UseAngleBrackets {
23
23
pub close_param : Span ,
24
24
}
25
25
26
- #[ derive( Diagnostic ) ]
26
+ #[ derive( IntoDiag ) ]
27
27
#[ diag( ast_lowering_invalid_abi, code = E0703 ) ]
28
28
#[ note]
29
29
pub struct InvalidAbi {
@@ -51,7 +51,7 @@ impl AddToDiag for InvalidAbiReason {
51
51
}
52
52
}
53
53
54
- #[ derive( Subdiagnostic ) ]
54
+ #[ derive( AddToDiag ) ]
55
55
#[ suggestion(
56
56
ast_lowering_invalid_abi_suggestion,
57
57
code = "{suggestion}" ,
@@ -63,7 +63,7 @@ pub struct InvalidAbiSuggestion {
63
63
pub suggestion : String ,
64
64
}
65
65
66
- #[ derive( Diagnostic ) ]
66
+ #[ derive( IntoDiag ) ]
67
67
#[ diag( ast_lowering_assoc_ty_parentheses) ]
68
68
pub struct AssocTyParentheses {
69
69
#[ primary_span]
@@ -72,7 +72,7 @@ pub struct AssocTyParentheses {
72
72
pub sub : AssocTyParenthesesSub ,
73
73
}
74
74
75
- #[ derive( Subdiagnostic ) ]
75
+ #[ derive( AddToDiag ) ]
76
76
pub enum AssocTyParenthesesSub {
77
77
#[ multipart_suggestion( ast_lowering_remove_parentheses) ]
78
78
Empty {
@@ -88,7 +88,7 @@ pub enum AssocTyParenthesesSub {
88
88
} ,
89
89
}
90
90
91
- #[ derive( Diagnostic ) ]
91
+ #[ derive( IntoDiag ) ]
92
92
#[ diag( ast_lowering_misplaced_impl_trait, code = E0562 ) ]
93
93
#[ note]
94
94
pub struct MisplacedImplTrait < ' a > {
@@ -97,7 +97,7 @@ pub struct MisplacedImplTrait<'a> {
97
97
pub position : DiagArgFromDisplay < ' a > ,
98
98
}
99
99
100
- #[ derive( Diagnostic ) ]
100
+ #[ derive( IntoDiag ) ]
101
101
#[ diag( ast_lowering_assoc_ty_binding_in_dyn) ]
102
102
pub struct MisplacedAssocTyBinding {
103
103
#[ primary_span]
@@ -106,23 +106,23 @@ pub struct MisplacedAssocTyBinding {
106
106
pub suggestion : Option < Span > ,
107
107
}
108
108
109
- #[ derive( Diagnostic ) ]
109
+ #[ derive( IntoDiag ) ]
110
110
#[ diag( ast_lowering_underscore_expr_lhs_assign) ]
111
111
pub struct UnderscoreExprLhsAssign {
112
112
#[ primary_span]
113
113
#[ label]
114
114
pub span : Span ,
115
115
}
116
116
117
- #[ derive( Diagnostic ) ]
117
+ #[ derive( IntoDiag ) ]
118
118
#[ diag( ast_lowering_base_expression_double_dot, code = E0797 ) ]
119
119
pub struct BaseExpressionDoubleDot {
120
120
#[ primary_span]
121
121
#[ suggestion( code = "/* expr */" , applicability = "has-placeholders" , style = "verbose" ) ]
122
122
pub span : Span ,
123
123
}
124
124
125
- #[ derive( Diagnostic ) ]
125
+ #[ derive( IntoDiag ) ]
126
126
#[ diag( ast_lowering_await_only_in_async_fn_and_blocks, code = E0728 ) ]
127
127
pub struct AwaitOnlyInAsyncFnAndBlocks {
128
128
#[ primary_span]
@@ -132,50 +132,50 @@ pub struct AwaitOnlyInAsyncFnAndBlocks {
132
132
pub item_span : Option < Span > ,
133
133
}
134
134
135
- #[ derive( Diagnostic ) ]
135
+ #[ derive( IntoDiag ) ]
136
136
#[ diag( ast_lowering_coroutine_too_many_parameters, code = E0628 ) ]
137
137
pub struct CoroutineTooManyParameters {
138
138
#[ primary_span]
139
139
pub fn_decl_span : Span ,
140
140
}
141
141
142
- #[ derive( Diagnostic ) ]
142
+ #[ derive( IntoDiag ) ]
143
143
#[ diag( ast_lowering_closure_cannot_be_static, code = E0697 ) ]
144
144
pub struct ClosureCannotBeStatic {
145
145
#[ primary_span]
146
146
pub fn_decl_span : Span ,
147
147
}
148
148
149
- #[ derive( Diagnostic ) ]
149
+ #[ derive( IntoDiag ) ]
150
150
#[ diag( ast_lowering_functional_record_update_destructuring_assignment) ]
151
151
pub struct FunctionalRecordUpdateDestructuringAssignment {
152
152
#[ primary_span]
153
153
#[ suggestion( code = "" , applicability = "machine-applicable" ) ]
154
154
pub span : Span ,
155
155
}
156
156
157
- #[ derive( Diagnostic ) ]
157
+ #[ derive( IntoDiag ) ]
158
158
#[ diag( ast_lowering_async_coroutines_not_supported, code = E0727 ) ]
159
159
pub struct AsyncCoroutinesNotSupported {
160
160
#[ primary_span]
161
161
pub span : Span ,
162
162
}
163
163
164
- #[ derive( Diagnostic ) ]
164
+ #[ derive( IntoDiag ) ]
165
165
#[ diag( ast_lowering_inline_asm_unsupported_target, code = E0472 ) ]
166
166
pub struct InlineAsmUnsupportedTarget {
167
167
#[ primary_span]
168
168
pub span : Span ,
169
169
}
170
170
171
- #[ derive( Diagnostic ) ]
171
+ #[ derive( IntoDiag ) ]
172
172
#[ diag( ast_lowering_att_syntax_only_x86) ]
173
173
pub struct AttSyntaxOnlyX86 {
174
174
#[ primary_span]
175
175
pub span : Span ,
176
176
}
177
177
178
- #[ derive( Diagnostic ) ]
178
+ #[ derive( IntoDiag ) ]
179
179
#[ diag( ast_lowering_abi_specified_multiple_times) ]
180
180
pub struct AbiSpecifiedMultipleTimes {
181
181
#[ primary_span]
@@ -187,14 +187,14 @@ pub struct AbiSpecifiedMultipleTimes {
187
187
pub equivalent : Option < ( ) > ,
188
188
}
189
189
190
- #[ derive( Diagnostic ) ]
190
+ #[ derive( IntoDiag ) ]
191
191
#[ diag( ast_lowering_clobber_abi_not_supported) ]
192
192
pub struct ClobberAbiNotSupported {
193
193
#[ primary_span]
194
194
pub abi_span : Span ,
195
195
}
196
196
197
- #[ derive( Diagnostic ) ]
197
+ #[ derive( IntoDiag ) ]
198
198
#[ note]
199
199
#[ diag( ast_lowering_invalid_abi_clobber_abi) ]
200
200
pub struct InvalidAbiClobberAbi {
@@ -203,7 +203,7 @@ pub struct InvalidAbiClobberAbi {
203
203
pub supported_abis : String ,
204
204
}
205
205
206
- #[ derive( Diagnostic ) ]
206
+ #[ derive( IntoDiag ) ]
207
207
#[ diag( ast_lowering_invalid_register) ]
208
208
pub struct InvalidRegister < ' a > {
209
209
#[ primary_span]
@@ -212,7 +212,7 @@ pub struct InvalidRegister<'a> {
212
212
pub error : & ' a str ,
213
213
}
214
214
215
- #[ derive( Diagnostic ) ]
215
+ #[ derive( IntoDiag ) ]
216
216
#[ diag( ast_lowering_invalid_register_class) ]
217
217
pub struct InvalidRegisterClass < ' a > {
218
218
#[ primary_span]
@@ -221,7 +221,7 @@ pub struct InvalidRegisterClass<'a> {
221
221
pub error : & ' a str ,
222
222
}
223
223
224
- #[ derive( Diagnostic ) ]
224
+ #[ derive( IntoDiag ) ]
225
225
#[ diag( ast_lowering_invalid_asm_template_modifier_reg_class) ]
226
226
pub struct InvalidAsmTemplateModifierRegClass {
227
227
#[ primary_span]
@@ -233,15 +233,15 @@ pub struct InvalidAsmTemplateModifierRegClass {
233
233
pub sub : InvalidAsmTemplateModifierRegClassSub ,
234
234
}
235
235
236
- #[ derive( Subdiagnostic ) ]
236
+ #[ derive( AddToDiag ) ]
237
237
pub enum InvalidAsmTemplateModifierRegClassSub {
238
238
#[ note( ast_lowering_support_modifiers) ]
239
239
SupportModifier { class_name : Symbol , modifiers : String } ,
240
240
#[ note( ast_lowering_does_not_support_modifiers) ]
241
241
DoesNotSupportModifier { class_name : Symbol } ,
242
242
}
243
243
244
- #[ derive( Diagnostic ) ]
244
+ #[ derive( IntoDiag ) ]
245
245
#[ diag( ast_lowering_invalid_asm_template_modifier_const) ]
246
246
pub struct InvalidAsmTemplateModifierConst {
247
247
#[ primary_span]
@@ -251,7 +251,7 @@ pub struct InvalidAsmTemplateModifierConst {
251
251
pub op_span : Span ,
252
252
}
253
253
254
- #[ derive( Diagnostic ) ]
254
+ #[ derive( IntoDiag ) ]
255
255
#[ diag( ast_lowering_invalid_asm_template_modifier_sym) ]
256
256
pub struct InvalidAsmTemplateModifierSym {
257
257
#[ primary_span]
@@ -261,15 +261,15 @@ pub struct InvalidAsmTemplateModifierSym {
261
261
pub op_span : Span ,
262
262
}
263
263
264
- #[ derive( Diagnostic ) ]
264
+ #[ derive( IntoDiag ) ]
265
265
#[ diag( ast_lowering_register_class_only_clobber) ]
266
266
pub struct RegisterClassOnlyClobber {
267
267
#[ primary_span]
268
268
pub op_span : Span ,
269
269
pub reg_class_name : Symbol ,
270
270
}
271
271
272
- #[ derive( Diagnostic ) ]
272
+ #[ derive( IntoDiag ) ]
273
273
#[ diag( ast_lowering_register_conflict) ]
274
274
pub struct RegisterConflict < ' a > {
275
275
#[ primary_span]
@@ -283,7 +283,7 @@ pub struct RegisterConflict<'a> {
283
283
pub in_out : Option < Span > ,
284
284
}
285
285
286
- #[ derive( Diagnostic ) ]
286
+ #[ derive( IntoDiag ) ]
287
287
#[ help]
288
288
#[ diag( ast_lowering_sub_tuple_binding) ]
289
289
pub struct SubTupleBinding < ' a > {
@@ -301,7 +301,7 @@ pub struct SubTupleBinding<'a> {
301
301
pub ctx : & ' a str ,
302
302
}
303
303
304
- #[ derive( Diagnostic ) ]
304
+ #[ derive( IntoDiag ) ]
305
305
#[ diag( ast_lowering_extra_double_dot) ]
306
306
pub struct ExtraDoubleDot < ' a > {
307
307
#[ primary_span]
@@ -312,22 +312,22 @@ pub struct ExtraDoubleDot<'a> {
312
312
pub ctx : & ' a str ,
313
313
}
314
314
315
- #[ derive( Diagnostic ) ]
315
+ #[ derive( IntoDiag ) ]
316
316
#[ note]
317
317
#[ diag( ast_lowering_misplaced_double_dot) ]
318
318
pub struct MisplacedDoubleDot {
319
319
#[ primary_span]
320
320
pub span : Span ,
321
321
}
322
322
323
- #[ derive( Diagnostic ) ]
323
+ #[ derive( IntoDiag ) ]
324
324
#[ diag( ast_lowering_misplaced_relax_trait_bound) ]
325
325
pub struct MisplacedRelaxTraitBound {
326
326
#[ primary_span]
327
327
pub span : Span ,
328
328
}
329
329
330
- #[ derive( Diagnostic ) ]
330
+ #[ derive( IntoDiag ) ]
331
331
#[ diag( ast_lowering_match_arm_with_no_body) ]
332
332
pub struct MatchArmWithNoBody {
333
333
#[ primary_span]
@@ -336,7 +336,7 @@ pub struct MatchArmWithNoBody {
336
336
pub suggestion : Span ,
337
337
}
338
338
339
- #[ derive( Diagnostic ) ]
339
+ #[ derive( IntoDiag ) ]
340
340
#[ diag( ast_lowering_never_pattern_with_body) ]
341
341
pub struct NeverPatternWithBody {
342
342
#[ primary_span]
@@ -345,29 +345,29 @@ pub struct NeverPatternWithBody {
345
345
pub span : Span ,
346
346
}
347
347
348
- #[ derive( Diagnostic ) ]
348
+ #[ derive( IntoDiag ) ]
349
349
#[ diag( ast_lowering_never_pattern_with_guard) ]
350
350
pub struct NeverPatternWithGuard {
351
351
#[ primary_span]
352
352
#[ suggestion( code = "" , applicability = "maybe-incorrect" ) ]
353
353
pub span : Span ,
354
354
}
355
355
356
- #[ derive( Diagnostic ) ]
356
+ #[ derive( IntoDiag ) ]
357
357
#[ diag( ast_lowering_arbitrary_expression_in_pattern) ]
358
358
pub struct ArbitraryExpressionInPattern {
359
359
#[ primary_span]
360
360
pub span : Span ,
361
361
}
362
362
363
- #[ derive( Diagnostic ) ]
363
+ #[ derive( IntoDiag ) ]
364
364
#[ diag( ast_lowering_inclusive_range_with_no_end) ]
365
365
pub struct InclusiveRangeWithNoEnd {
366
366
#[ primary_span]
367
367
pub span : Span ,
368
368
}
369
369
370
- #[ derive( Diagnostic ) ]
370
+ #[ derive( IntoDiag ) ]
371
371
pub enum BadReturnTypeNotation {
372
372
#[ diag( ast_lowering_bad_return_type_notation_inputs) ]
373
373
Inputs {
@@ -383,22 +383,22 @@ pub enum BadReturnTypeNotation {
383
383
} ,
384
384
}
385
385
386
- #[ derive( Diagnostic ) ]
386
+ #[ derive( IntoDiag ) ]
387
387
#[ diag( ast_lowering_generic_param_default_in_binder) ]
388
388
pub ( crate ) struct GenericParamDefaultInBinder {
389
389
#[ primary_span]
390
390
pub span : Span ,
391
391
}
392
392
393
- #[ derive( Diagnostic ) ]
393
+ #[ derive( IntoDiag ) ]
394
394
#[ diag( ast_lowering_async_bound_not_on_trait) ]
395
395
pub ( crate ) struct AsyncBoundNotOnTrait {
396
396
#[ primary_span]
397
397
pub span : Span ,
398
398
pub descr : & ' static str ,
399
399
}
400
400
401
- #[ derive( Diagnostic ) ]
401
+ #[ derive( IntoDiag ) ]
402
402
#[ diag( ast_lowering_async_bound_only_for_fn_traits) ]
403
403
pub ( crate ) struct AsyncBoundOnlyForFnTraits {
404
404
#[ primary_span]
0 commit comments