Detect missing =>
after match guard during parsing
``` error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/missing-fat-arrow.rs:25:14 | LL | Some(a) if a.value == b { | - while parsing this struct LL | a.value = 1; | -^ expected one of `,`, `:`, or `}` | | | while parsing this struct field | help: try naming a field | LL | a: a.value = 1; | ++ help: you might have meant to start a match arm after the match guard | LL | Some(a) if a.value == b => { | ++ ``` Fix #78585.
This commit is contained in:
parent
a6dfd89fa7
commit
745c1ea438
13 changed files with 229 additions and 41 deletions
|
@ -430,6 +430,17 @@ pub(crate) struct ExpectedElseBlock {
|
|||
pub condition_start: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_expected_struct_field)]
|
||||
pub(crate) struct ExpectedStructField {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub token: Token,
|
||||
#[label(parse_ident_label)]
|
||||
pub ident_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_outer_attribute_not_allowed_on_if_else)]
|
||||
pub(crate) struct OuterAttributeNotAllowedOnIfElse {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue