diff options
| author | David Tolnay <dtolnay@gmail.com> | 2024-12-29 11:04:49 -0800 | 
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2024-12-29 11:06:20 -0800 | 
| commit | 462604d8256348901e042ad0de600c76d4c8d029 (patch) | |
| tree | a7127323e3d7b8a01335bd13a55c2aba0a1ef02e /compiler/rustc_parse/src/parser/expr.rs | |
| parent | adaa756b555f751201440bca4ba65fc9b5691ace (diff) | |
| download | rust-462604d8256348901e042ad0de600c76d4c8d029.tar.gz rust-462604d8256348901e042ad0de600c76d4c8d029.zip  | |
Fix parsing of ranges after unary operators
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 6 | 
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 7533e75ffe2..3405733f39f 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -605,7 +605,11 @@ impl<'a> Parser<'a> { fn parse_expr_prefix_common(&mut self, lo: Span) -> PResult<'a, (Span, P<Expr>)> { self.bump(); let attrs = self.parse_outer_attributes()?; - let expr = self.parse_expr_prefix(attrs)?; + let expr = if self.token.is_range_separator() { + self.parse_expr_prefix_range(attrs) + } else { + self.parse_expr_prefix(attrs) + }?; let span = self.interpolated_or_expr_span(&expr); Ok((lo.to(span), expr)) }  | 
