@@ -70,7 +70,7 @@ Diagnostics are more than just their primary message, they often include
7070labels, notes, help messages and suggestions, all of which can also be
7171specified on a ` Diagnostic ` .
7272
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
7474type ` Span ` . Applying any of these attributes will create the corresponding
7575subdiagnostic with that ` Span ` . These attributes will look for their
7676diagnostic 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:
8787- Any attribute applied to a ` Vec<T> ` will be repeated for each element of the
8888 vector.
8989
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
9191they work exactly like when applied to fields except the subdiagnostic won't
9292have a ` Span ` . These attributes can also be applied to fields of type ` () ` for
9393the 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.
9595
9696Suggestions can be emitted using one of four field attributes:
9797
@@ -180,8 +180,8 @@ following attributes:
180180 - Value is a path to an item in ` rustc_errors::fluent ` for the note's
181181 message.
182182 - 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._
185185 - Adds a warning subdiagnostic.
186186 - Value is a path to an item in ` rustc_errors::fluent ` for the note's
187187 message.
@@ -253,6 +253,7 @@ attribute applied to the struct or each variant, one of:
253253- ` #[label(..)] ` for defining a label
254254- ` #[note(..)] ` for defining a note
255255- ` #[help(..)] ` for defining a help
256+ - ` #[warning(..)] ` for defining a warning
256257- ` #[suggestion{,_hidden,_short,_verbose}(..)] ` for defining a suggestion
257258
258259All of the above must provide a slug as the first positional argument (a path
@@ -333,7 +334,7 @@ diagnostic struct.
333334### Reference
334335` #[derive(Subdiagnostic)] ` supports the following attributes:
335336
336- - ` #[label(slug)] ` , ` #[help(slug)] ` or ` #[note(slug)] `
337+ - ` #[label(slug)] ` , ` #[help(slug)] ` , ` #[warning(slug)] ` or ` #[note(slug)] `
337338 - _ Applied to struct or enum variant. Mutually exclusive with struct/enum variant attributes._
338339 - _ Mandatory_
339340 - Defines the type to be representing a label, help or note.
0 commit comments