Skip to content

Commit e67d6f2

Browse files
committed
Rename diagnostic derive things.
First, make the derive label match the trait being derived: - derive(Diagnostic) -> derive(IntoDiag) - derive(Subdiagnostic) -> derive(AddToDiag) - derive(LintDiagnostic) -> derive(DecorateLint) Then rename various other things: - session_diagnostic_derive -> into_diag_derive - session_subdiagnostic_derive -> add_to_diag_derive - lint_diagnostic_derive -> decorate_lint_derive - DiagnosticDerive -> IntoDiagDerive - LintDiagnosticDerive -> DecorateLintDerive - SubdiagnosticDeriveBuilder -> AddToDiagDerive (note: dropped the `Builder` suffix)
1 parent 8ca1308 commit e67d6f2

File tree

58 files changed

+2016
-2022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2016
-2022
lines changed

compiler/rustc_ast_lowering/src/errors.rs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use rustc_errors::{
22
codes::*, AddToDiag, Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagMessageOp,
33
};
4-
use rustc_macros::{Diagnostic, Subdiagnostic};
4+
use rustc_macros::{AddToDiag, IntoDiag};
55
use rustc_span::{symbol::Ident, Span, Symbol};
66

7-
#[derive(Diagnostic)]
7+
#[derive(IntoDiag)]
88
#[diag(ast_lowering_generic_type_with_parentheses, code = E0214)]
99
pub struct GenericTypeWithParentheses {
1010
#[primary_span]
@@ -14,7 +14,7 @@ pub struct GenericTypeWithParentheses {
1414
pub sub: Option<UseAngleBrackets>,
1515
}
1616

17-
#[derive(Subdiagnostic)]
17+
#[derive(AddToDiag)]
1818
#[multipart_suggestion(ast_lowering_use_angle_brackets, applicability = "maybe-incorrect")]
1919
pub struct UseAngleBrackets {
2020
#[suggestion_part(code = "<")]
@@ -23,7 +23,7 @@ pub struct UseAngleBrackets {
2323
pub close_param: Span,
2424
}
2525

26-
#[derive(Diagnostic)]
26+
#[derive(IntoDiag)]
2727
#[diag(ast_lowering_invalid_abi, code = E0703)]
2828
#[note]
2929
pub struct InvalidAbi {
@@ -51,7 +51,7 @@ impl AddToDiag for InvalidAbiReason {
5151
}
5252
}
5353

54-
#[derive(Subdiagnostic)]
54+
#[derive(AddToDiag)]
5555
#[suggestion(
5656
ast_lowering_invalid_abi_suggestion,
5757
code = "{suggestion}",
@@ -63,7 +63,7 @@ pub struct InvalidAbiSuggestion {
6363
pub suggestion: String,
6464
}
6565

66-
#[derive(Diagnostic)]
66+
#[derive(IntoDiag)]
6767
#[diag(ast_lowering_assoc_ty_parentheses)]
6868
pub struct AssocTyParentheses {
6969
#[primary_span]
@@ -72,7 +72,7 @@ pub struct AssocTyParentheses {
7272
pub sub: AssocTyParenthesesSub,
7373
}
7474

75-
#[derive(Subdiagnostic)]
75+
#[derive(AddToDiag)]
7676
pub enum AssocTyParenthesesSub {
7777
#[multipart_suggestion(ast_lowering_remove_parentheses)]
7878
Empty {
@@ -88,7 +88,7 @@ pub enum AssocTyParenthesesSub {
8888
},
8989
}
9090

91-
#[derive(Diagnostic)]
91+
#[derive(IntoDiag)]
9292
#[diag(ast_lowering_misplaced_impl_trait, code = E0562)]
9393
#[note]
9494
pub struct MisplacedImplTrait<'a> {
@@ -97,7 +97,7 @@ pub struct MisplacedImplTrait<'a> {
9797
pub position: DiagArgFromDisplay<'a>,
9898
}
9999

100-
#[derive(Diagnostic)]
100+
#[derive(IntoDiag)]
101101
#[diag(ast_lowering_assoc_ty_binding_in_dyn)]
102102
pub struct MisplacedAssocTyBinding {
103103
#[primary_span]
@@ -106,23 +106,23 @@ pub struct MisplacedAssocTyBinding {
106106
pub suggestion: Option<Span>,
107107
}
108108

109-
#[derive(Diagnostic)]
109+
#[derive(IntoDiag)]
110110
#[diag(ast_lowering_underscore_expr_lhs_assign)]
111111
pub struct UnderscoreExprLhsAssign {
112112
#[primary_span]
113113
#[label]
114114
pub span: Span,
115115
}
116116

117-
#[derive(Diagnostic)]
117+
#[derive(IntoDiag)]
118118
#[diag(ast_lowering_base_expression_double_dot, code = E0797)]
119119
pub struct BaseExpressionDoubleDot {
120120
#[primary_span]
121121
#[suggestion(code = "/* expr */", applicability = "has-placeholders", style = "verbose")]
122122
pub span: Span,
123123
}
124124

125-
#[derive(Diagnostic)]
125+
#[derive(IntoDiag)]
126126
#[diag(ast_lowering_await_only_in_async_fn_and_blocks, code = E0728)]
127127
pub struct AwaitOnlyInAsyncFnAndBlocks {
128128
#[primary_span]
@@ -132,50 +132,50 @@ pub struct AwaitOnlyInAsyncFnAndBlocks {
132132
pub item_span: Option<Span>,
133133
}
134134

135-
#[derive(Diagnostic)]
135+
#[derive(IntoDiag)]
136136
#[diag(ast_lowering_coroutine_too_many_parameters, code = E0628)]
137137
pub struct CoroutineTooManyParameters {
138138
#[primary_span]
139139
pub fn_decl_span: Span,
140140
}
141141

142-
#[derive(Diagnostic)]
142+
#[derive(IntoDiag)]
143143
#[diag(ast_lowering_closure_cannot_be_static, code = E0697)]
144144
pub struct ClosureCannotBeStatic {
145145
#[primary_span]
146146
pub fn_decl_span: Span,
147147
}
148148

149-
#[derive(Diagnostic)]
149+
#[derive(IntoDiag)]
150150
#[diag(ast_lowering_functional_record_update_destructuring_assignment)]
151151
pub struct FunctionalRecordUpdateDestructuringAssignment {
152152
#[primary_span]
153153
#[suggestion(code = "", applicability = "machine-applicable")]
154154
pub span: Span,
155155
}
156156

157-
#[derive(Diagnostic)]
157+
#[derive(IntoDiag)]
158158
#[diag(ast_lowering_async_coroutines_not_supported, code = E0727)]
159159
pub struct AsyncCoroutinesNotSupported {
160160
#[primary_span]
161161
pub span: Span,
162162
}
163163

164-
#[derive(Diagnostic)]
164+
#[derive(IntoDiag)]
165165
#[diag(ast_lowering_inline_asm_unsupported_target, code = E0472)]
166166
pub struct InlineAsmUnsupportedTarget {
167167
#[primary_span]
168168
pub span: Span,
169169
}
170170

171-
#[derive(Diagnostic)]
171+
#[derive(IntoDiag)]
172172
#[diag(ast_lowering_att_syntax_only_x86)]
173173
pub struct AttSyntaxOnlyX86 {
174174
#[primary_span]
175175
pub span: Span,
176176
}
177177

178-
#[derive(Diagnostic)]
178+
#[derive(IntoDiag)]
179179
#[diag(ast_lowering_abi_specified_multiple_times)]
180180
pub struct AbiSpecifiedMultipleTimes {
181181
#[primary_span]
@@ -187,14 +187,14 @@ pub struct AbiSpecifiedMultipleTimes {
187187
pub equivalent: Option<()>,
188188
}
189189

190-
#[derive(Diagnostic)]
190+
#[derive(IntoDiag)]
191191
#[diag(ast_lowering_clobber_abi_not_supported)]
192192
pub struct ClobberAbiNotSupported {
193193
#[primary_span]
194194
pub abi_span: Span,
195195
}
196196

197-
#[derive(Diagnostic)]
197+
#[derive(IntoDiag)]
198198
#[note]
199199
#[diag(ast_lowering_invalid_abi_clobber_abi)]
200200
pub struct InvalidAbiClobberAbi {
@@ -203,7 +203,7 @@ pub struct InvalidAbiClobberAbi {
203203
pub supported_abis: String,
204204
}
205205

206-
#[derive(Diagnostic)]
206+
#[derive(IntoDiag)]
207207
#[diag(ast_lowering_invalid_register)]
208208
pub struct InvalidRegister<'a> {
209209
#[primary_span]
@@ -212,7 +212,7 @@ pub struct InvalidRegister<'a> {
212212
pub error: &'a str,
213213
}
214214

215-
#[derive(Diagnostic)]
215+
#[derive(IntoDiag)]
216216
#[diag(ast_lowering_invalid_register_class)]
217217
pub struct InvalidRegisterClass<'a> {
218218
#[primary_span]
@@ -221,7 +221,7 @@ pub struct InvalidRegisterClass<'a> {
221221
pub error: &'a str,
222222
}
223223

224-
#[derive(Diagnostic)]
224+
#[derive(IntoDiag)]
225225
#[diag(ast_lowering_invalid_asm_template_modifier_reg_class)]
226226
pub struct InvalidAsmTemplateModifierRegClass {
227227
#[primary_span]
@@ -233,15 +233,15 @@ pub struct InvalidAsmTemplateModifierRegClass {
233233
pub sub: InvalidAsmTemplateModifierRegClassSub,
234234
}
235235

236-
#[derive(Subdiagnostic)]
236+
#[derive(AddToDiag)]
237237
pub enum InvalidAsmTemplateModifierRegClassSub {
238238
#[note(ast_lowering_support_modifiers)]
239239
SupportModifier { class_name: Symbol, modifiers: String },
240240
#[note(ast_lowering_does_not_support_modifiers)]
241241
DoesNotSupportModifier { class_name: Symbol },
242242
}
243243

244-
#[derive(Diagnostic)]
244+
#[derive(IntoDiag)]
245245
#[diag(ast_lowering_invalid_asm_template_modifier_const)]
246246
pub struct InvalidAsmTemplateModifierConst {
247247
#[primary_span]
@@ -251,7 +251,7 @@ pub struct InvalidAsmTemplateModifierConst {
251251
pub op_span: Span,
252252
}
253253

254-
#[derive(Diagnostic)]
254+
#[derive(IntoDiag)]
255255
#[diag(ast_lowering_invalid_asm_template_modifier_sym)]
256256
pub struct InvalidAsmTemplateModifierSym {
257257
#[primary_span]
@@ -261,15 +261,15 @@ pub struct InvalidAsmTemplateModifierSym {
261261
pub op_span: Span,
262262
}
263263

264-
#[derive(Diagnostic)]
264+
#[derive(IntoDiag)]
265265
#[diag(ast_lowering_register_class_only_clobber)]
266266
pub struct RegisterClassOnlyClobber {
267267
#[primary_span]
268268
pub op_span: Span,
269269
pub reg_class_name: Symbol,
270270
}
271271

272-
#[derive(Diagnostic)]
272+
#[derive(IntoDiag)]
273273
#[diag(ast_lowering_register_conflict)]
274274
pub struct RegisterConflict<'a> {
275275
#[primary_span]
@@ -283,7 +283,7 @@ pub struct RegisterConflict<'a> {
283283
pub in_out: Option<Span>,
284284
}
285285

286-
#[derive(Diagnostic)]
286+
#[derive(IntoDiag)]
287287
#[help]
288288
#[diag(ast_lowering_sub_tuple_binding)]
289289
pub struct SubTupleBinding<'a> {
@@ -301,7 +301,7 @@ pub struct SubTupleBinding<'a> {
301301
pub ctx: &'a str,
302302
}
303303

304-
#[derive(Diagnostic)]
304+
#[derive(IntoDiag)]
305305
#[diag(ast_lowering_extra_double_dot)]
306306
pub struct ExtraDoubleDot<'a> {
307307
#[primary_span]
@@ -312,22 +312,22 @@ pub struct ExtraDoubleDot<'a> {
312312
pub ctx: &'a str,
313313
}
314314

315-
#[derive(Diagnostic)]
315+
#[derive(IntoDiag)]
316316
#[note]
317317
#[diag(ast_lowering_misplaced_double_dot)]
318318
pub struct MisplacedDoubleDot {
319319
#[primary_span]
320320
pub span: Span,
321321
}
322322

323-
#[derive(Diagnostic)]
323+
#[derive(IntoDiag)]
324324
#[diag(ast_lowering_misplaced_relax_trait_bound)]
325325
pub struct MisplacedRelaxTraitBound {
326326
#[primary_span]
327327
pub span: Span,
328328
}
329329

330-
#[derive(Diagnostic)]
330+
#[derive(IntoDiag)]
331331
#[diag(ast_lowering_match_arm_with_no_body)]
332332
pub struct MatchArmWithNoBody {
333333
#[primary_span]
@@ -336,7 +336,7 @@ pub struct MatchArmWithNoBody {
336336
pub suggestion: Span,
337337
}
338338

339-
#[derive(Diagnostic)]
339+
#[derive(IntoDiag)]
340340
#[diag(ast_lowering_never_pattern_with_body)]
341341
pub struct NeverPatternWithBody {
342342
#[primary_span]
@@ -345,29 +345,29 @@ pub struct NeverPatternWithBody {
345345
pub span: Span,
346346
}
347347

348-
#[derive(Diagnostic)]
348+
#[derive(IntoDiag)]
349349
#[diag(ast_lowering_never_pattern_with_guard)]
350350
pub struct NeverPatternWithGuard {
351351
#[primary_span]
352352
#[suggestion(code = "", applicability = "maybe-incorrect")]
353353
pub span: Span,
354354
}
355355

356-
#[derive(Diagnostic)]
356+
#[derive(IntoDiag)]
357357
#[diag(ast_lowering_arbitrary_expression_in_pattern)]
358358
pub struct ArbitraryExpressionInPattern {
359359
#[primary_span]
360360
pub span: Span,
361361
}
362362

363-
#[derive(Diagnostic)]
363+
#[derive(IntoDiag)]
364364
#[diag(ast_lowering_inclusive_range_with_no_end)]
365365
pub struct InclusiveRangeWithNoEnd {
366366
#[primary_span]
367367
pub span: Span,
368368
}
369369

370-
#[derive(Diagnostic)]
370+
#[derive(IntoDiag)]
371371
pub enum BadReturnTypeNotation {
372372
#[diag(ast_lowering_bad_return_type_notation_inputs)]
373373
Inputs {
@@ -383,22 +383,22 @@ pub enum BadReturnTypeNotation {
383383
},
384384
}
385385

386-
#[derive(Diagnostic)]
386+
#[derive(IntoDiag)]
387387
#[diag(ast_lowering_generic_param_default_in_binder)]
388388
pub(crate) struct GenericParamDefaultInBinder {
389389
#[primary_span]
390390
pub span: Span,
391391
}
392392

393-
#[derive(Diagnostic)]
393+
#[derive(IntoDiag)]
394394
#[diag(ast_lowering_async_bound_not_on_trait)]
395395
pub(crate) struct AsyncBoundNotOnTrait {
396396
#[primary_span]
397397
pub span: Span,
398398
pub descr: &'static str,
399399
}
400400

401-
#[derive(Diagnostic)]
401+
#[derive(IntoDiag)]
402402
#[diag(ast_lowering_async_bound_only_for_fn_traits)]
403403
pub(crate) struct AsyncBoundOnlyForFnTraits {
404404
#[primary_span]

0 commit comments

Comments
 (0)