diff options
| author | David Tolnay <dtolnay@gmail.com> | 2023-12-29 16:28:47 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2024-05-11 15:48:58 -0700 |
| commit | cbb8714a3f8a04cce698719df338fb095c40f479 (patch) | |
| tree | 879c1e33e0af831225249de1c1f0233afaf0c96e /compiler/rustc_parse/src/parser/expr.rs | |
| parent | b431eec6f28d64cd3852584f9a59736c6c09ee68 (diff) | |
| download | rust-cbb8714a3f8a04cce698719df338fb095c40f479.tar.gz rust-cbb8714a3f8a04cce698719df338fb095c40f479.zip | |
Mark expr_requires_semi_to_be_stmt call sites
For each of these, we need to decide whether they need to be using `expr_requires_semi_to_be_stmt`, or `expr_requires_comma_to_be_match_arm`, which are supposed to be 2 different behaviors. Previously they were conflated into one, causing either too much or too little parenthesization.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 577003e94fb..951c3495995 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -498,7 +498,7 @@ impl<'a> Parser<'a> { /// Checks if this expression is a successfully parsed statement. fn expr_is_complete(&self, e: &Expr) -> bool { self.restrictions.contains(Restrictions::STMT_EXPR) - && !classify::expr_requires_semi_to_be_stmt(e) + && !classify::expr_requires_semi_to_be_stmt_FIXME(e) } /// Parses `x..y`, `x..=y`, and `x..`/`x..=`. @@ -2694,7 +2694,7 @@ impl<'a> Parser<'a> { // If it's not a free-standing expression, and is followed by a block, // then it's very likely the condition to an `else if`. if self.check(&TokenKind::OpenDelim(Delimiter::Brace)) - && classify::expr_requires_semi_to_be_stmt(&cond) => + && classify::expr_requires_semi_to_be_stmt_FIXME(&cond) => { self.dcx().emit_err(errors::ExpectedElseBlock { first_tok_span, @@ -3136,7 +3136,7 @@ impl<'a> Parser<'a> { err })?; - let require_comma = classify::expr_requires_semi_to_be_stmt(&expr) + let require_comma = classify::expr_requires_semi_to_be_stmt_FIXME(&expr) && this.token != token::CloseDelim(Delimiter::Brace); if !require_comma { |
