Skip to content

Commit da891f2

Browse files
nicklimmmtshepang
authored andcommitted
Update to new warning attribute
1 parent 8cd3eb9 commit da891f2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/diagnostics/diagnostic-structs.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Diagnostics are more than just their primary message, they often include
7070
labels, notes, help messages and suggestions, all of which can also be
7171
specified 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
7474
type `Span`. Applying any of these attributes will create the corresponding
7575
subdiagnostic with that `Span`. These attributes will look for their
7676
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:
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
9191
they work exactly like when applied to fields except the subdiagnostic won't
9292
have a `Span`. These attributes can also be applied to fields of type `()` for
9393
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.
9595

9696
Suggestions 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

258259
All 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

Comments
 (0)