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.
This commit is contained in:
bors 2016-05-06 22:39:43 -07:00
commit 6478583cdb
2 changed files with 20 additions and 9 deletions

View file

@ -0,0 +1,18 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z parse-only
// Issue #33262
pub fn main() {
for i in 0..a as { }
//~^ ERROR expected type, found `{`
}