Skip to content

Commit 80def6c

Browse files
committed
Auto merge of rust-lang#23930 - petrochenkov:issue23656, r=nrc
Fixes rust-lang#22757 Fixes rust-lang#22972 Fixes rust-lang#23044 Fixes rust-lang#23151 Fixes rust-lang#23597 Fixes rust-lang#23656 Fixes rust-lang#23929 It also fixes some other corner cases in range patterns, like incorrect spans or not accepting global paths after `...`. It passes `make check` but needs some additional tests (then it will fix rust-lang#22546 as well), I'll write them today or tomorrow.
2 parents 2615106 + 76567a6 commit 80def6c

10 files changed

+138
-234
lines changed

src/libsyntax/parse/parser.rs

+129-225
Large diffs are not rendered by default.

src/test/compile-fail/issue-22426-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn main() {
1212
match 42 {
1313
x < 7 => (),
14-
//~^ error: unexpected token: `<`
14+
//~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
1515
_ => ()
1616
}
1717
}

src/test/compile-fail/issue-22426-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
// except according to those terms.
1010

1111
fn a(B<) {}
12-
//~^ error: unexpected token: `<`
12+
//~^ error: expected one of `:` or `@`, found `<`

src/test/compile-fail/issue-22426-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl<T> Foo<T> {
1414
fn foo(&self) {
1515
match *self {
1616
Foo<T>(x, y) => {
17-
//~^ error: unexpected token: `<`
17+
//~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
1818
println!("Goodbye, World!")
1919
}
2020
}

src/test/parse-fail/issue-22647.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
let caller<F> = |f: F| //~ ERROR unexpected token: `<`
12+
let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
1313
where F: Fn() -> i32
1414
{
1515
let x = f();

src/test/parse-fail/issue-22712.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct Foo<B> {
1313
}
1414

1515
fn bar() {
16-
let Foo<Vec<u8>> //~ ERROR unexpected token: `<`
16+
let Foo<Vec<u8>> //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
1717
}
1818

1919
fn main() {}

src/test/parse-fail/match-vec-invalid.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn main() {
1212
let a = Vec::new();
1313
match a {
14-
[1, tail.., tail..] => {}, //~ ERROR: expected one of `!`, `,`, or `@`, found `..`
14+
[1, tail.., tail..] => {}, //~ ERROR: expected one of `,` or `@`, found `..`
1515
_ => ()
1616
}
1717
}

src/test/parse-fail/omitted-arg-in-item-fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn foo(x) { //~ ERROR expected one of `!`, `:`, or `@`, found `)`
11+
fn foo(x) { //~ ERROR expected one of `:` or `@`, found `)`
1212
}

src/test/parse-fail/removed-syntax-larrow-init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
fn removed_moves() {
1212
let mut x = 0;
1313
let y <- x;
14-
//~^ ERROR expected one of `!`, `:`, `;`, `=`, or `@`, found `<-`
14+
//~^ ERROR expected one of `:`, `;`, `=`, or `@`, found `<-`
1515
}

src/test/parse-fail/struct-literal-in-match-discriminant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct Foo {
1414

1515
fn main() {
1616
match Foo {
17-
x: 3 //~ ERROR expected one of `!`, `=>`, `@`, `if`, or `|`, found `:`
17+
x: 3 //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `:`
1818
} {
1919
Foo {
2020
x: x

0 commit comments

Comments
 (0)