UPDATE - mention of Diagnostic derive on enums

Updated Diagnostic text to use the same language used in Subdiagnostic
This commit is contained in:
Jhonny Bill Mena 2022-10-31 10:27:21 -04:00 committed by David Wood
parent 431fcf5e20
commit 43e20eff99
1 changed files with 5 additions and 3 deletions

View File

@ -28,8 +28,10 @@ pub struct FieldAlreadyDeclared {
}
```
`Diagnostic` can only be applied to structs. Every `Diagnostic`
has to have one attribute, `#[diag(...)]`, applied to the struct itself.
`Diagnostic` can only be applied to structs and enums.
Attributes that are placed on the type for structs are placed on each
variants for enums (or vice versa). Each `Diagnostic` has to have one
attribute, `#[diag(...)]`, applied to the struct or each enum variant.
If an error has an error code (e.g. "E0624"), then that can be specified using
the `code` sub-attribute. Specifying a `code` isn't mandatory, but if you are
@ -243,7 +245,7 @@ pub enum ExpectedReturnTypeLabel<'tcx> {
}
```
Unlike `Diagnostic`, `Subdiagnostic` can be applied to structs or
Like `Diagnostic`, `Subdiagnostic` can be applied to structs or
enums. Attributes that are placed on the type for structs are placed on each
variants for enums (or vice versa). Each `Subdiagnostic` should have one
attribute applied to the struct or each variant, one of: