@@ -70,7 +70,7 @@ Diagnostics are more than just their primary message, they often include
70
70
labels, notes, help messages and suggestions, all of which can also be
71
71
specified on a ` Diagnostic ` .
72
72
73
- ` #[label] ` , ` #[help] ` and ` #[note] ` can all be applied to fields which have the
73
+ ` #[label] ` , ` #[help] ` , ` #[warning] ` and ` #[note] ` can all be applied to fields which have the
74
74
type ` Span ` . Applying any of these attributes will create the corresponding
75
75
subdiagnostic with that ` Span ` . These attributes will look for their
76
76
diagnostic message in a Fluent attribute attached to the primary Fluent
@@ -87,11 +87,11 @@ Other types have special behavior when used in a `Diagnostic` derive:
87
87
- Any attribute applied to a ` Vec<T> ` will be repeated for each element of the
88
88
vector.
89
89
90
- ` #[help] ` and ` #[note] ` can also be applied to the struct itself, in which case
90
+ ` #[help] ` , ` #[warning] ` and ` #[note] ` can also be applied to the struct itself, in which case
91
91
they work exactly like when applied to fields except the subdiagnostic won't
92
92
have a ` Span ` . These attributes can also be applied to fields of type ` () ` for
93
93
the same effect, which when combined with the ` Option ` type can be used to
94
- represent optional ` #[note] ` /` #[help] ` subdiagnostics.
94
+ represent optional ` #[note] ` /` #[help] ` / ` #[warning] ` subdiagnostics.
95
95
96
96
Suggestions can be emitted using one of four field attributes:
97
97
@@ -180,8 +180,8 @@ following attributes:
180
180
- Value is a path to an item in ` rustc_errors::fluent ` for the note's
181
181
message.
182
182
- Defaults to equivalent of ` .label ` .
183
- - ` #[warn_ ] ` or ` #[warn_ (slug)] ` (_ Optional_ )
184
- - _ Applied to ` Span ` fields._
183
+ - ` #[warning ] ` or ` #[warning (slug)] ` (_ Optional_ )
184
+ - _ Applied to struct or ` Span ` / ` () ` fields._
185
185
- Adds a warning subdiagnostic.
186
186
- Value is a path to an item in ` rustc_errors::fluent ` for the note's
187
187
message.
@@ -253,6 +253,7 @@ attribute applied to the struct or each variant, one of:
253
253
- ` #[label(..)] ` for defining a label
254
254
- ` #[note(..)] ` for defining a note
255
255
- ` #[help(..)] ` for defining a help
256
+ - ` #[warning(..)] ` for defining a warning
256
257
- ` #[suggestion{,_hidden,_short,_verbose}(..)] ` for defining a suggestion
257
258
258
259
All of the above must provide a slug as the first positional argument (a path
@@ -333,7 +334,7 @@ diagnostic struct.
333
334
### Reference
334
335
` #[derive(Subdiagnostic)] ` supports the following attributes:
335
336
336
- - ` #[label(slug)] ` , ` #[help(slug)] ` or ` #[note(slug)] `
337
+ - ` #[label(slug)] ` , ` #[help(slug)] ` , ` #[warning(slug)] ` or ` #[note(slug)] `
337
338
- _ Applied to struct or enum variant. Mutually exclusive with struct/enum variant attributes._
338
339
- _ Mandatory_
339
340
- Defines the type to be representing a label, help or note.
0 commit comments