Skip to content

Commit d5adeb4

Browse files
committed
---
yaml --- r: 271812 b: refs/heads/auto c: 221d0fb h: refs/heads/master
1 parent 217c8e7 commit d5adeb4

File tree

7 files changed

+39
-15
lines changed

7 files changed

+39
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 6abab49029dacfaa616b726f49817213adc1065b
11+
refs/heads/auto: 221d0fbad0b201ef9264d3c9a30cd8c143ed51b2
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/libsyntax/parse/parser.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,9 @@ impl<'a> Parser<'a> {
957957
{
958958
self.expect(bra)?;
959959
let result = self.parse_seq_to_before_end(ket, sep, f);
960-
self.bump();
960+
if self.token == *ket {
961+
self.bump();
962+
}
961963
Ok(result)
962964
}
963965

@@ -1292,15 +1294,21 @@ impl<'a> Parser<'a> {
12921294
Ok(cua) => cua,
12931295
Err(e) => {
12941296
loop {
1295-
p.bump();
1296-
if p.token == token::Semi {
1297-
p.bump();
1298-
break;
1299-
}
1297+
match p.token {
1298+
token::Eof => break,
1299+
1300+
token::CloseDelim(token::Brace) |
1301+
token::Semi => {
1302+
p.bump();
1303+
break;
1304+
}
1305+
1306+
token::OpenDelim(token::Brace) => {
1307+
p.parse_token_tree()?;
1308+
break;
1309+
}
13001310

1301-
if p.token == token::OpenDelim(token::DelimToken::Brace) {
1302-
p.parse_token_tree()?;
1303-
break;
1311+
_ => p.bump()
13041312
}
13051313
}
13061314

branches/auto/src/test/compile-fail/issue-10636-2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
pub fn trace_option(option: Option<isize>) {
1515
option.map(|some| 42; //~ NOTE: unclosed delimiter
1616
//~^ ERROR: expected one of
17-
//~^^ ERROR: mismatched types
1817
} //~ ERROR: incorrect close delimiter
19-
//~^ ERROR: expected one of
18+
//~^ ERROR: unexpected token

branches/auto/src/test/compile-fail/token-error-correct-3.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ pub mod raw {
2121
if !is_directory(path.as_ref()) { //~ ERROR: unresolved name `is_directory`
2222
callback(path.as_ref(); //~ NOTE: unclosed delimiter
2323
//~^ ERROR: expected one of
24-
fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: expected one of
24+
fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
2525
} else { //~ ERROR: incorrect close delimiter: `}`
26+
//~^ ERROR: expected one of
2627
Ok(false);
2728
}
2829

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: -Z parse-only
12+
13+
fn main() {}
14+
15+
// This used to end up in an infite loop trying to bump past EOF.
16+
trait T { ... } //~ ERROR

branches/auto/src/test/parse-fail/pat-lt-bracket-6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn main() {
1212
let Test(&desc[..]) = x; //~ error: expected one of `,` or `@`, found `[`
13-
//~^ ERROR expected one of `:`, `;`, or `=`, found `..`
13+
//~^ ERROR expected one of `:`, `;`, `=`, or `@`, found `[`
1414
}

branches/auto/src/test/parse-fail/pat-lt-bracket-7.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn main() {
1212
for thing(x[]) in foo {} //~ error: expected one of `,` or `@`, found `[`
13-
//~^ ERROR: expected `in`, found `]`
13+
//~^ ERROR expected one of `@` or `in`, found `[`
1414
}

0 commit comments

Comments
 (0)