diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2022-09-04 20:19:49 +0200 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2022-09-27 20:29:19 +0200 |
| commit | 760c4352d6c8a85bc3d692769fac6a3e14b9c053 (patch) | |
| tree | ec61f122e0238d1dc26213c83756140297d4bcdb /compiler/rustc_parse/src/errors.rs | |
| parent | ba10f2c0f2548bafa2bbdca346921c6719f2e6ea (diff) | |
| download | rust-760c4352d6c8a85bc3d692769fac6a3e14b9c053.tar.gz rust-760c4352d6c8a85bc3d692769fac6a3e14b9c053.zip | |
Migrate "struct literal body without path" error to diagnostic struct
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 07785b7344f..e49661bd4e5 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1014,3 +1014,21 @@ pub(crate) enum ExpectedSemiSugg { #[suggestion_short(parser::sugg_add_semi, code = ";", applicability = "machine-applicable")] AddSemi(#[primary_span] Span), } + +#[derive(Diagnostic)] +#[diag(parser::struct_literal_body_without_path)] +pub(crate) struct StructLiteralBodyWithoutPath { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub sugg: StructLiteralBodyWithoutPathSugg, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion(parser::suggestion, applicability = "has-placeholders")] +pub(crate) struct StructLiteralBodyWithoutPathSugg { + #[suggestion_part(code = "{{ SomeStruct ")] + pub before: Span, + #[suggestion_part(code = " }}")] + pub after: Span, +} |
