@@ -148,9 +148,9 @@ impl DiagnosticDeriveBuilder {
148
148
// `#[help(..)]`/`#[note(..)]` when the user is specifying a alternative slug.
149
149
Meta :: List ( MetaList { ref nested, .. } ) => nested,
150
150
// Subdiagnostics without spans can be applied to the type too, and these are just
151
- // paths: `#[help]`, `#[note]` and `#[warn_ ]`
151
+ // paths: `#[help]`, `#[note]` and `#[warning ]`
152
152
Meta :: Path ( _) if !is_diag => {
153
- let fn_name = if name == "warn_ " {
153
+ let fn_name = if name == "warning " {
154
154
Ident :: new ( "warn" , attr. span ( ) )
155
155
} else {
156
156
Ident :: new ( name, attr. span ( ) )
@@ -163,12 +163,15 @@ impl DiagnosticDeriveBuilder {
163
163
// Check the kind before doing any further processing so that there aren't misleading
164
164
// "no kind specified" errors if there are failures later.
165
165
match name {
166
- "error" | "warning" | " lint" => throw_invalid_attr ! ( attr, & meta, |diag| {
167
- diag. help( "`error`, `warning` and `lint` have been replaced by `diag`" )
166
+ "error" | "lint" => throw_invalid_attr ! ( attr, & meta, |diag| {
167
+ diag. help( "`error` and `lint` have been replaced by `diag`" )
168
168
} ) ,
169
- "diag" | "help" | "note" | "warn_" => ( ) ,
169
+ "warn_" => throw_invalid_attr ! ( attr, & meta, |diag| {
170
+ diag. help( "`warn_` have been replaced by `warning`" )
171
+ } ) ,
172
+ "diag" | "help" | "note" | "warning" => ( ) ,
170
173
_ => throw_invalid_attr ! ( attr, & meta, |diag| {
171
- diag. help( "only `diag`, `help`, `note` and `warn_ ` are valid attributes" )
174
+ diag. help( "only `diag`, `help`, `note` and `warning ` are valid attributes" )
172
175
} ) ,
173
176
}
174
177
@@ -180,7 +183,7 @@ impl DiagnosticDeriveBuilder {
180
183
if !is_diag && nested_iter. next ( ) . is_some ( ) {
181
184
throw_invalid_nested_attr ! ( attr, & nested_attr, |diag| {
182
185
diag. help(
183
- "`help`, `note` and `warn_ ` struct attributes can only have one argument" ,
186
+ "`help`, `note` and `warning ` struct attributes can only have one argument" ,
184
187
)
185
188
} ) ;
186
189
}
@@ -348,12 +351,12 @@ impl DiagnosticDeriveBuilder {
348
351
report_error_if_not_applied_to_span ( attr, & info) ?;
349
352
Ok ( self . add_spanned_subdiagnostic ( binding, ident, parse_quote ! { _subdiag:: label } ) )
350
353
}
351
- "note" | "help" | "warn_ " => {
354
+ "note" | "help" | "warning " => {
352
355
let warn_ident = Ident :: new ( "warn" , Span :: call_site ( ) ) ;
353
356
let ( ident, path) = match name {
354
357
"note" => ( ident, parse_quote ! { _subdiag:: note } ) ,
355
358
"help" => ( ident, parse_quote ! { _subdiag:: help } ) ,
356
- "warn_ " => ( & warn_ident, parse_quote ! { _subdiag:: warn } ) ,
359
+ "warning " => ( & warn_ident, parse_quote ! { _subdiag:: warn } ) ,
357
360
_ => unreachable ! ( ) ,
358
361
} ;
359
362
if type_matches_path ( & info. ty , & [ "rustc_span" , "Span" ] ) {
@@ -390,7 +393,7 @@ impl DiagnosticDeriveBuilder {
390
393
"suggestion" | "suggestion_short" | "suggestion_hidden" | "suggestion_verbose" => {
391
394
return self . generate_inner_field_code_suggestion ( attr, info) ;
392
395
}
393
- "label" | "help" | "note" | "warn_ " => ( ) ,
396
+ "label" | "help" | "note" | "warning " => ( ) ,
394
397
_ => throw_invalid_attr ! ( attr, & meta, |diag| {
395
398
diag. help(
396
399
"only `label`, `help`, `note`, `warn` or `suggestion{,_short,_hidden,_verbose}` are \
@@ -422,14 +425,14 @@ impl DiagnosticDeriveBuilder {
422
425
Ok ( self . add_spanned_subdiagnostic ( binding, ident, msg) )
423
426
}
424
427
"note" | "help" if type_is_unit ( & info. ty ) => Ok ( self . add_subdiagnostic ( ident, msg) ) ,
425
- // `warn_ ` must be special-cased because the attribute `warn` already has meaning and
428
+ // `warning ` must be special-cased because the attribute `warn` already has meaning and
426
429
// so isn't used, despite the diagnostic API being named `warn`.
427
- "warn_ " if type_matches_path ( & info. ty , & [ "rustc_span" , "Span" ] ) => Ok ( self
430
+ "warning " if type_matches_path ( & info. ty , & [ "rustc_span" , "Span" ] ) => Ok ( self
428
431
. add_spanned_subdiagnostic ( binding, & Ident :: new ( "warn" , Span :: call_site ( ) ) , msg) ) ,
429
- "warn_ " if type_is_unit ( & info. ty ) => {
432
+ "warning " if type_is_unit ( & info. ty ) => {
430
433
Ok ( self . add_subdiagnostic ( & Ident :: new ( "warn" , Span :: call_site ( ) ) , msg) )
431
434
}
432
- "note" | "help" | "warn_ " => report_type_error ( attr, "`Span` or `()`" ) ?,
435
+ "note" | "help" | "warning " => report_type_error ( attr, "`Span` or `()`" ) ?,
433
436
_ => unreachable ! ( ) ,
434
437
}
435
438
}
0 commit comments