about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-05-06 22:39:43 -0700
committerbors <bors@rust-lang.org>2016-05-06 22:39:43 -0700
commit6478583cdb57aea8d2b9ceb25dfe5ba60a7083a3 (patch)
tree7e8175cbf2dbf219f71c27543bb5b781a71f05e6 /src/libsyntax
parentc95cda56a6b515e8a1117db0648058f892339821 (diff)
parenta36fb461addccb41d9a0cb75857efa41a9f2681e (diff)
downloadrust-6478583cdb57aea8d2b9ceb25dfe5ba60a7083a3.tar.gz
rust-6478583cdb57aea8d2b9ceb25dfe5ba60a7083a3.zip
Auto merge of #33311 - birkenfeld:issue33262, r=nrc
parser: fix suppression of syntax errors in range RHS

Invalid expressions on the RHS were just swallowed without generating an error.  The new version more closely mirrors the code for parsing `..x` in the `parse_prefix_range_expr` method below, where no cancel is done either.

Fixes #33262.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 9cd2e6ef7d6..94e7d0a3939 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3028,15 +3028,8 @@ impl<'a> Parser<'a> {
                 // We have 2 alternatives here: `x..y`/`x...y` and `x..`/`x...` The other
                 // two variants are handled with `parse_prefix_range_expr` call above.
                 let rhs = if self.is_at_start_of_range_notation_rhs() {
-                    let rhs = self.parse_assoc_expr_with(op.precedence() + 1,
-                                                         LhsExpr::NotYetParsed);
-                    match rhs {
-                        Ok(e) => Some(e),
-                        Err(mut e) => {
-                            e.cancel();
-                            None
-                        }
-                    }
+                    Some(self.parse_assoc_expr_with(op.precedence() + 1,
+                                                    LhsExpr::NotYetParsed)?)
                 } else {
                     None
                 };