Auto merge of #114028 - Centri3:ternary-operator, r=compiler-errors

Gracefully handle ternary operator

Fixes #112578

~~May not be the best way to do this as it doesn't check for a single `:`, so it could perhaps appear even when the actual issue is just a missing semicolon. May not be the biggest deal, though?~~

Nevermind, got it working properly now ^^
This commit is contained in:
bors 2023-07-29 16:45:29 +00:00
commit a04e649c09
5 changed files with 241 additions and 2 deletions

View file

@ -365,6 +365,14 @@ pub(crate) enum IfExpressionMissingThenBlockSub {
AddThenBlock(#[primary_span] Span),
}
#[derive(Diagnostic)]
#[diag(parse_ternary_operator)]
#[help]
pub struct TernaryOperator {
#[primary_span]
pub span: Span,
}
#[derive(Subdiagnostic)]
#[suggestion(parse_extra_if_in_let_else, applicability = "maybe-incorrect", code = "")]
pub(crate) struct IfExpressionLetSomeSub {