about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-01 06:23:19 +0000
committerbors <bors@rust-lang.org>2023-03-01 06:23:19 +0000
commitbcb610da7fae8297689883782601ecb8645604e2 (patch)
tree322f92893bf5d1856feab6d6ea44f308b0bea092 /compiler/rustc_parse/src/parser/expr.rs
parent5983a3a99ea631da9d7d1ce510a6761913f92a89 (diff)
parentcd5352dbce21a71cad920c5e9efe9edfd6555147 (diff)
downloadrust-bcb610da7fae8297689883782601ecb8645604e2.tar.gz
rust-bcb610da7fae8297689883782601ecb8645604e2.zip
Auto merge of #108587 - matthiaskrgr:rollup-rw6po59, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #108376 (compiler/rustc_session: fix sysroot detection logic)
 - #108400 (add llvm cgu instructions stats to perf)
 - #108496 (fix #108495, postfix decrement and prefix decrement has no warning)
 - #108505 (Further unify validity intrinsics)
 - #108520 (Small cleanup to `one_bound_for_assoc_type`)
 - #108560 (Some `infer/mod.rs` cleanups)
 - #108563 (Make mailmap more correct)
 - #108564 (Fix `x clean` with specific paths)
 - #108571 (Add contains_key to SortedIndexMultiMap)
 - #108578 (Update Fuchsia platform team members)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 33254d034c9..24d4c17f5d8 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -282,6 +282,18 @@ impl<'a> Parser<'a> {
                 continue;
             }
 
+            if self.prev_token == token::BinOp(token::Minus)
+                && self.token == token::BinOp(token::Minus)
+                && self.prev_token.span.between(self.token.span).is_empty()
+                && !self.look_ahead(1, |tok| tok.can_begin_expr())
+            {
+                let op_span = self.prev_token.span.to(self.token.span);
+                // Eat the second `-`
+                self.bump();
+                lhs = self.recover_from_postfix_decrement(lhs, op_span, starts_stmt)?;
+                continue;
+            }
+
             let op = op.node;
             // Special cases:
             if op == AssocOp::As {