Recover for PAT = EXPR {}

This commit is contained in:
Michael Goulet
2025-08-08 18:46:02 +00:00
parent 2886b36df4
commit b2d524c43d
6 changed files with 33 additions and 22 deletions

View File

@@ -585,14 +585,13 @@ pub(crate) struct MissingInInForLoop {
#[derive(Subdiagnostic)]
pub(crate) enum MissingInInForLoopSub {
// User wrote `for pat of expr {}`
// Has been misleading, at least in the past (closed Issue #48492), thus maybe-incorrect
#[suggestion(
parse_use_in_not_of,
style = "verbose",
applicability = "maybe-incorrect",
code = "in"
)]
#[suggestion(parse_use_in, style = "verbose", applicability = "maybe-incorrect", code = "in")]
InNotOf(#[primary_span] Span),
// User wrote `for pat = expr {}`
#[suggestion(parse_use_in, style = "verbose", applicability = "maybe-incorrect", code = "in")]
InNotEq(#[primary_span] Span),
#[suggestion(parse_add_in, style = "verbose", applicability = "maybe-incorrect", code = " in ")]
AddIn(#[primary_span] Span),
}