diff options
| author | Jhonny Bill Mena <jhonnybillm@gmail.com> | 2022-10-31 10:27:21 -0400 |
|---|---|---|
| committer | David Wood <agile.lion3441@fuligin.ink> | 2022-11-01 15:13:38 +0000 |
| commit | 51e837ae017f6f32cc48e1cf0fb83a85afe0df16 (patch) | |
| tree | 5d0608082ddc276cce190fefa7c23732b76af772 /src/doc/rustc-dev-guide | |
| parent | d3e6e89125f40a527e751bda789a6e425faa30cc (diff) | |
| download | rust-51e837ae017f6f32cc48e1cf0fb83a85afe0df16.tar.gz rust-51e837ae017f6f32cc48e1cf0fb83a85afe0df16.zip | |
UPDATE - mention of Diagnostic derive on enums
Updated Diagnostic text to use the same language used in Subdiagnostic
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md b/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md index d51e7934846..81a8db6244b 100644 --- a/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md +++ b/src/doc/rustc-dev-guide/src/diagnostics/diagnostic-structs.md @@ -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: |
