Migrate "struct literal body without path" error to diagnostic struct
This commit is contained in:
parent
ba10f2c0f2
commit
760c4352d6
2 changed files with 30 additions and 17 deletions
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue