Skip to content

Commit 944a3e2

Browse files
committed
Change to diag attributes
1 parent 1c28006 commit 944a3e2

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

compiler/rustc_attr/src/session_diagnostics.rs

+30-29
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ use rustc_span::{Span, Symbol};
88
use crate::UnsupportedLiteralReason;
99

1010
#[derive(SessionDiagnostic)]
11-
#[error(attr::expected_one_cfg_pattern, code = "E0536")]
11+
#[diag(attr::expected_one_cfg_pattern, code = "E0536")]
1212
pub(crate) struct ExpectedOneCfgPattern {
1313
#[primary_span]
1414
pub span: Span,
1515
}
1616

1717
#[derive(SessionDiagnostic)]
18-
#[error(attr::invalid_predicate, code = "E0537")]
18+
#[diag(attr::invalid_predicate, code = "E0537")]
1919
pub(crate) struct InvalidPredicate {
2020
#[primary_span]
2121
pub span: Span,
@@ -24,7 +24,7 @@ pub(crate) struct InvalidPredicate {
2424
}
2525

2626
#[derive(SessionDiagnostic)]
27-
#[error(attr::multiple_item, code = "E0538")]
27+
#[diag(attr::multiple_item, code = "E0538")]
2828
pub(crate) struct MultipleItem {
2929
#[primary_span]
3030
pub span: Span,
@@ -33,7 +33,7 @@ pub(crate) struct MultipleItem {
3333
}
3434

3535
#[derive(SessionDiagnostic)]
36-
#[error(attr::incorrect_meta_item, code = "E0539")]
36+
#[diag(attr::incorrect_meta_item, code = "E0539")]
3737
pub(crate) struct IncorrectMetaItem {
3838
#[primary_span]
3939
pub span: Span,
@@ -63,28 +63,28 @@ impl<'a> SessionDiagnostic<'a> for UnknownMetaItem<'_> {
6363
}
6464

6565
#[derive(SessionDiagnostic)]
66-
#[error(attr::missing_since, code = "E0542")]
66+
#[diag(attr::missing_since, code = "E0542")]
6767
pub(crate) struct MissingSince {
6868
#[primary_span]
6969
pub span: Span,
7070
}
7171

7272
#[derive(SessionDiagnostic)]
73-
#[error(attr::missing_note, code = "E0543")]
73+
#[diag(attr::missing_note, code = "E0543")]
7474
pub(crate) struct MissingNote {
7575
#[primary_span]
7676
pub span: Span,
7777
}
7878

7979
#[derive(SessionDiagnostic)]
80-
#[error(attr::multiple_stability_levels, code = "E0544")]
80+
#[diag(attr::multiple_stability_levels, code = "E0544")]
8181
pub(crate) struct MultipleStabilityLevels {
8282
#[primary_span]
8383
pub span: Span,
8484
}
8585

8686
#[derive(SessionDiagnostic)]
87-
#[error(attr::invalid_issue_string, code = "E0545")]
87+
#[diag(attr::invalid_issue_string, code = "E0545")]
8888
pub(crate) struct InvalidIssueString {
8989
#[primary_span]
9090
pub span: Span,
@@ -142,21 +142,21 @@ impl InvalidIssueStringCause {
142142
}
143143

144144
#[derive(SessionDiagnostic)]
145-
#[error(attr::missing_feature, code = "E0546")]
145+
#[diag(attr::missing_feature, code = "E0546")]
146146
pub(crate) struct MissingFeature {
147147
#[primary_span]
148148
pub span: Span,
149149
}
150150

151151
#[derive(SessionDiagnostic)]
152-
#[error(attr::non_ident_feature, code = "E0546")]
152+
#[diag(attr::non_ident_feature, code = "E0546")]
153153
pub(crate) struct NonIdentFeature {
154154
#[primary_span]
155155
pub span: Span,
156156
}
157157

158158
#[derive(SessionDiagnostic)]
159-
#[error(attr::missing_issue, code = "E0547")]
159+
#[diag(attr::missing_issue, code = "E0547")]
160160
pub(crate) struct MissingIssue {
161161
#[primary_span]
162162
pub span: Span,
@@ -165,7 +165,7 @@ pub(crate) struct MissingIssue {
165165
// FIXME: This diagnostic is identical to `IncorrectMetaItem`, barring the error code. Consider
166166
// changing this to `IncorrectMetaItem`. See #51489.
167167
#[derive(SessionDiagnostic)]
168-
#[error(attr::incorrect_meta_item, code = "E0551")]
168+
#[diag(attr::incorrect_meta_item, code = "E0551")]
169169
pub(crate) struct IncorrectMetaItem2 {
170170
#[primary_span]
171171
pub span: Span,
@@ -174,14 +174,14 @@ pub(crate) struct IncorrectMetaItem2 {
174174
// FIXME: Why is this the same error code as `InvalidReprHintNoParen` and `InvalidReprHintNoValue`?
175175
// It is more similar to `IncorrectReprFormatGeneric`.
176176
#[derive(SessionDiagnostic)]
177-
#[error(attr::incorrect_repr_format_packed_one_or_zero_arg, code = "E0552")]
177+
#[diag(attr::incorrect_repr_format_packed_one_or_zero_arg, code = "E0552")]
178178
pub(crate) struct IncorrectReprFormatPackedOneOrZeroArg {
179179
#[primary_span]
180180
pub span: Span,
181181
}
182182

183183
#[derive(SessionDiagnostic)]
184-
#[error(attr::invalid_repr_hint_no_paren, code = "E0552")]
184+
#[diag(attr::invalid_repr_hint_no_paren, code = "E0552")]
185185
pub(crate) struct InvalidReprHintNoParen {
186186
#[primary_span]
187187
pub span: Span,
@@ -190,7 +190,7 @@ pub(crate) struct InvalidReprHintNoParen {
190190
}
191191

192192
#[derive(SessionDiagnostic)]
193-
#[error(attr::invalid_repr_hint_no_value, code = "E0552")]
193+
#[diag(attr::invalid_repr_hint_no_value, code = "E0552")]
194194
pub(crate) struct InvalidReprHintNoValue {
195195
#[primary_span]
196196
pub span: Span,
@@ -234,16 +234,17 @@ impl<'a> SessionDiagnostic<'a> for UnsupportedLiteral {
234234
diag
235235
}
236236
}
237+
237238
#[derive(SessionDiagnostic)]
238-
#[error(attr::invalid_repr_align_need_arg, code = "E0589")]
239+
#[diag(attr::invalid_repr_align_need_arg, code = "E0589")]
239240
pub(crate) struct InvalidReprAlignNeedArg {
240241
#[primary_span]
241242
#[suggestion(code = "align(...)", applicability = "has-placeholders")]
242243
pub span: Span,
243244
}
244245

245246
#[derive(SessionDiagnostic)]
246-
#[error(attr::invalid_repr_generic, code = "E0589")]
247+
#[diag(attr::invalid_repr_generic, code = "E0589")]
247248
pub(crate) struct InvalidReprGeneric<'a> {
248249
#[primary_span]
249250
pub span: Span,
@@ -253,14 +254,14 @@ pub(crate) struct InvalidReprGeneric<'a> {
253254
}
254255

255256
#[derive(SessionDiagnostic)]
256-
#[error(attr::incorrect_repr_format_align_one_arg, code = "E0693")]
257+
#[diag(attr::incorrect_repr_format_align_one_arg, code = "E0693")]
257258
pub(crate) struct IncorrectReprFormatAlignOneArg {
258259
#[primary_span]
259260
pub span: Span,
260261
}
261262

262263
#[derive(SessionDiagnostic)]
263-
#[error(attr::incorrect_repr_format_generic, code = "E0693")]
264+
#[diag(attr::incorrect_repr_format_generic, code = "E0693")]
264265
pub(crate) struct IncorrectReprFormatGeneric<'a> {
265266
#[primary_span]
266267
pub span: Span,
@@ -303,28 +304,28 @@ pub(crate) enum IncorrectReprFormatGenericCause<'a> {
303304
}
304305

305306
#[derive(SessionDiagnostic)]
306-
#[error(attr::rustc_promotable_pairing, code = "E0717")]
307+
#[diag(attr::rustc_promotable_pairing, code = "E0717")]
307308
pub(crate) struct RustcPromotablePairing {
308309
#[primary_span]
309310
pub span: Span,
310311
}
311312

312313
#[derive(SessionDiagnostic)]
313-
#[error(attr::rustc_allowed_unstable_pairing, code = "E0789")]
314+
#[diag(attr::rustc_allowed_unstable_pairing, code = "E0789")]
314315
pub(crate) struct RustcAllowedUnstablePairing {
315316
#[primary_span]
316317
pub span: Span,
317318
}
318319

319320
#[derive(SessionDiagnostic)]
320-
#[error(attr::cfg_predicate_identifier)]
321+
#[diag(attr::cfg_predicate_identifier)]
321322
pub(crate) struct CfgPredicateIdentifier {
322323
#[primary_span]
323324
pub span: Span,
324325
}
325326

326327
#[derive(SessionDiagnostic)]
327-
#[error(attr::deprecated_item_suggestion)]
328+
#[diag(attr::deprecated_item_suggestion)]
328329
#[note]
329330
pub(crate) struct DeprecatedItemSuggestion {
330331
#[primary_span]
@@ -335,21 +336,21 @@ pub(crate) struct DeprecatedItemSuggestion {
335336
}
336337

337338
#[derive(SessionDiagnostic)]
338-
#[error(attr::expected_single_version_literal)]
339+
#[diag(attr::expected_single_version_literal)]
339340
pub(crate) struct ExpectedSingleVersionLiteral {
340341
#[primary_span]
341342
pub span: Span,
342343
}
343344

344345
#[derive(SessionDiagnostic)]
345-
#[error(attr::expected_version_literal)]
346+
#[diag(attr::expected_version_literal)]
346347
pub(crate) struct ExpectedVersionLiteral {
347348
#[primary_span]
348349
pub span: Span,
349350
}
350351

351352
#[derive(SessionDiagnostic)]
352-
#[error(attr::expects_feature_list)]
353+
#[diag(attr::expects_feature_list)]
353354
pub(crate) struct ExpectsFeatureList {
354355
#[primary_span]
355356
pub span: Span,
@@ -358,7 +359,7 @@ pub(crate) struct ExpectsFeatureList {
358359
}
359360

360361
#[derive(SessionDiagnostic)]
361-
#[error(attr::expects_features)]
362+
#[diag(attr::expects_features)]
362363
pub(crate) struct ExpectsFeatures {
363364
#[primary_span]
364365
pub span: Span,
@@ -367,14 +368,14 @@ pub(crate) struct ExpectsFeatures {
367368
}
368369

369370
#[derive(SessionDiagnostic)]
370-
#[error(attr::soft_no_args)]
371+
#[diag(attr::soft_no_args)]
371372
pub(crate) struct SoftNoArgs {
372373
#[primary_span]
373374
pub span: Span,
374375
}
375376

376377
#[derive(SessionDiagnostic)]
377-
#[warning(attr::unknown_version_literal)]
378+
#[diag(attr::unknown_version_literal)]
378379
pub(crate) struct UnknownVersionLiteral {
379380
#[primary_span]
380381
pub span: Span,

0 commit comments

Comments
 (0)