Skip to content

syntax: Rewrite parsing of patterns #23930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
354 changes: 129 additions & 225 deletions src/libsyntax/parse/parser.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-22426-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
fn main() {
match 42 {
x < 7 => (),
//~^ error: unexpected token: `<`
//~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
_ => ()
}
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-22426-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
// except according to those terms.

fn a(B<) {}
//~^ error: unexpected token: `<`
//~^ error: expected one of `:` or `@`, found `<`
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-22426-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl<T> Foo<T> {
fn foo(&self) {
match *self {
Foo<T>(x, y) => {
//~^ error: unexpected token: `<`
//~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
println!("Goodbye, World!")
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/issue-22647.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

fn main() {
let caller<F> = |f: F| //~ ERROR unexpected token: `<`
let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
where F: Fn() -> i32
{
let x = f();
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/issue-22712.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct Foo<B> {
}

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

fn main() {}
2 changes: 1 addition & 1 deletion src/test/parse-fail/match-vec-invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
fn main() {
let a = Vec::new();
match a {
[1, tail.., tail..] => {}, //~ ERROR: expected one of `!`, `,`, or `@`, found `..`
[1, tail.., tail..] => {}, //~ ERROR: expected one of `,` or `@`, found `..`
_ => ()
}
}
2 changes: 1 addition & 1 deletion src/test/parse-fail/omitted-arg-in-item-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn foo(x) { //~ ERROR expected one of `!`, `:`, or `@`, found `)`
fn foo(x) { //~ ERROR expected one of `:` or `@`, found `)`
}
2 changes: 1 addition & 1 deletion src/test/parse-fail/removed-syntax-larrow-init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
fn removed_moves() {
let mut x = 0;
let y <- x;
//~^ ERROR expected one of `!`, `:`, `;`, `=`, or `@`, found `<-`
//~^ ERROR expected one of `:`, `;`, `=`, or `@`, found `<-`
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Foo {

fn main() {
match Foo {
x: 3 //~ ERROR expected one of `!`, `=>`, `@`, `if`, or `|`, found `:`
x: 3 //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `:`
} {
Foo {
x: x
Expand Down