diff options
| author | David Wood <david.wood@huawei.com> | 2022-03-30 09:45:36 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-04-05 07:01:02 +0100 |
| commit | 9956d4f99d021fa255d007dc17f23a3b0cd351e9 (patch) | |
| tree | ca4296ee715ff51f04bbf3d728f14a6752f04e9f /src | |
| parent | 8677fef192a1d121b9123aa481422505833b57fe (diff) | |
| download | rust-9956d4f99d021fa255d007dc17f23a3b0cd351e9.tar.gz rust-9956d4f99d021fa255d007dc17f23a3b0cd351e9.zip | |
macros: add args for non-subdiagnostic fields
Non-subdiagnostic fields (i.e. those that don't have `#[label]` attributes or similar and are just additional context) have to be added as arguments for Fluent messages to refer them. This commit extends the `SessionDiagnostic` derive to do this for all fields that do not have attributes and introduces an `IntoDiagnosticArg` trait that is implemented on all types that can be converted to a argument for Fluent. Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui-fulldeps/session-derive-errors.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/ui-fulldeps/session-derive-errors.rs b/src/test/ui-fulldeps/session-derive-errors.rs index 140aaad3b38..715d0a0490f 100644 --- a/src/test/ui-fulldeps/session-derive-errors.rs +++ b/src/test/ui-fulldeps/session-derive-errors.rs @@ -11,8 +11,8 @@ #![crate_type = "lib"] extern crate rustc_span; -use rustc_span::Span; use rustc_span::symbol::Ident; +use rustc_span::Span; extern crate rustc_macros; use rustc_macros::SessionDiagnostic; @@ -108,7 +108,7 @@ struct ErrorWithMessageAppliedToField { #[message = "This error has a field, and references {name}"] //~^ ERROR `name` doesn't refer to a field on this type struct ErrorWithNonexistentField { - span: Span + descr: String, } #[derive(SessionDiagnostic)] @@ -117,7 +117,7 @@ struct ErrorWithNonexistentField { //~^ ERROR invalid format string: expected `'}'` struct ErrorMissingClosingBrace { name: String, - span: Span + val: usize, } #[derive(SessionDiagnostic)] @@ -126,7 +126,7 @@ struct ErrorMissingClosingBrace { //~^ ERROR invalid format string: unmatched `}` struct ErrorMissingOpeningBrace { name: String, - span: Span + val: usize, } #[derive(SessionDiagnostic)] |
