Skip to content

Commit 03fe2d4

Browse files
JhonnyBillMdavidtwco
authored andcommitted
UPDATE - mention of Diagnostic derive on enums
Updated Diagnostic text to use the same language used in Subdiagnostic
1 parent 94ecbac commit 03fe2d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/diagnostics/diagnostic-structs.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ pub struct FieldAlreadyDeclared {
2828
}
2929
```
3030

31-
`Diagnostic` can only be applied to structs. Every `Diagnostic`
32-
has to have one attribute, `#[diag(...)]`, applied to the struct itself.
31+
`Diagnostic` can only be applied to structs and enums.
32+
Attributes that are placed on the type for structs are placed on each
33+
variants for enums (or vice versa). Each `Diagnostic` has to have one
34+
attribute, `#[diag(...)]`, applied to the struct or each enum variant.
3335

3436
If an error has an error code (e.g. "E0624"), then that can be specified using
3537
the `code` sub-attribute. Specifying a `code` isn't mandatory, but if you are
@@ -243,7 +245,7 @@ pub enum ExpectedReturnTypeLabel<'tcx> {
243245
}
244246
```
245247

246-
Unlike `Diagnostic`, `Subdiagnostic` can be applied to structs or
248+
Like `Diagnostic`, `Subdiagnostic` can be applied to structs or
247249
enums. Attributes that are placed on the type for structs are placed on each
248250
variants for enums (or vice versa). Each `Subdiagnostic` should have one
249251
attribute applied to the struct or each variant, one of:

0 commit comments

Comments
 (0)