diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-03-24 00:01:30 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2025-03-25 15:15:21 +0100 |
| commit | 82796dd8585c0c160fe2a50b12f77455a7e0f8d7 (patch) | |
| tree | 201d11e67d43b164d736942aedd27a90e0bc94cd /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 848b0da34fa20d0ff5d12d1d4f506affc765534b (diff) | |
| download | rust-82796dd8585c0c160fe2a50b12f77455a7e0f8d7.tar.gz rust-82796dd8585c0c160fe2a50b12f77455a7e0f8d7.zip | |
Brace-ident-colon can certainly no longer start a block
thanks to the removal of type ascription.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index c48f91643e8..79d12ed4bbe 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3474,19 +3474,9 @@ impl<'a> Parser<'a> { } fn is_certainly_not_a_block(&self) -> bool { + // `{ ident, ` and `{ ident: ` cannot start a block. self.look_ahead(1, |t| t.is_ident()) - && ( - // `{ ident, ` cannot start a block. - self.look_ahead(2, |t| t == &token::Comma) - || self.look_ahead(2, |t| t == &token::Colon) - && ( - // `{ ident: token, ` cannot start a block. - self.look_ahead(4, |t| t == &token::Comma) - // `{ ident: ` cannot start a block unless it's a type ascription - // `ident: Type`. - || self.look_ahead(3, |t| !t.can_begin_type()) - ) - ) + && self.look_ahead(2, |t| t == &token::Comma || t == &token::Colon) } fn maybe_parse_struct_expr( |
