1
Fork 0

Disallow an arm without a body (except for never patterns)

Parsing now accepts a match arm without a body, so we must make sure to
only accept that if the pattern is a never pattern.
This commit is contained in:
Nadrieril 2023-11-27 01:53:05 +01:00
parent 0bfebc6105
commit a2dcb3a6d9
9 changed files with 128 additions and 12 deletions

View file

@ -340,6 +340,15 @@ pub struct NotSupportedForLifetimeBinderAsyncClosure {
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_lowering_match_arm_with_no_body)]
pub struct MatchArmWithNoBody {
#[primary_span]
pub span: Span,
#[suggestion(code = " => todo!(),", applicability = "has-placeholders")]
pub suggestion: Span,
}
#[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering_arbitrary_expression_in_pattern)]
pub struct ArbitraryExpressionInPattern {