parser: recover from where clauses placed before tuple struct bodies
This commit is contained in:
parent
b22c152958
commit
70ddde76df
11 changed files with 266 additions and 17 deletions
|
@ -1237,3 +1237,27 @@ pub(crate) struct ExpectedFnPathFoundFnKeyword {
|
|||
#[suggestion(applicability = "machine-applicable", code = "Fn", style = "verbose")]
|
||||
pub fn_token_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_where_clause_before_tuple_struct_body)]
|
||||
pub(crate) struct WhereClauseBeforeTupleStructBody {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[label(name_label)]
|
||||
pub name: Span,
|
||||
#[label(body_label)]
|
||||
pub body: Span,
|
||||
#[subdiagnostic]
|
||||
pub sugg: Option<WhereClauseBeforeTupleStructBodySugg>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(suggestion, applicability = "machine-applicable")]
|
||||
pub(crate) struct WhereClauseBeforeTupleStructBodySugg {
|
||||
#[suggestion_part(code = "{snippet}")]
|
||||
pub left: Span,
|
||||
pub snippet: String,
|
||||
#[suggestion_part(code = "")]
|
||||
pub right: Span,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue