diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2023-11-27 01:53:05 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2023-12-03 12:25:46 +0100 |
| commit | a2dcb3a6d9aead3964b3b1cdf814dc7eb9c5d8ed (patch) | |
| tree | 6dface89197039eb8fddb71508a4522ac0892eca /compiler/rustc_ast_lowering/src/errors.rs | |
| parent | 0bfebc6105ea882d7048057718b2e34d09a5d17e (diff) | |
| download | rust-a2dcb3a6d9aead3964b3b1cdf814dc7eb9c5d8ed.tar.gz rust-a2dcb3a6d9aead3964b3b1cdf814dc7eb9c5d8ed.zip | |
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.
Diffstat (limited to 'compiler/rustc_ast_lowering/src/errors.rs')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/errors.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index 6e1a9eff500..1bcf4a07eb0 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -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 { |
