Skip to content

Add tests for expect ident but find enum or struct panic #22720

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 1 commit into from
Feb 24, 2015

Conversation

edwardw
Copy link
Contributor

@edwardw edwardw commented Feb 23, 2015

Closes #22589
Closes #22647
Closes #22665
Closes #22712

@rust-highfive
Copy link
Contributor

r? @nick29581

(rust_highfive has picked a reviewer for you, use r? to override)

@edwardw edwardw changed the title syntax: do not panic if find enum or struct but find ident syntax: do not panic if expect ident but find enum or struct Feb 23, 2015
enum_path.segments.len() == 1 &&
enum_path.segments[0].parameters.is_empty()
{
// We expect an identifier, but duo to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit s/duo/due

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@nrc
Copy link
Member

nrc commented Feb 23, 2015

r+ with the typo fixed.

@edwardw edwardw force-pushed the enum-struct-ident-walk-into-a-bar branch from 4ce608b to 2931c21 Compare February 23, 2015 20:52
@nrc
Copy link
Member

nrc commented Feb 23, 2015

@bors r+ 2931c21

@Manishearth
Copy link
Member

When running check-stage1 on this I get the following error:

/opt/rust/src/test/parse-fail/issue-22426.rs:18:16: 18:17 error: unexpected token: `<`
/opt/rust/src/test/parse-fail/issue-22426.rs:18             Foo<T>(ref x, ref y) => {}  //~ ERROR expected identifier, found enum or struct
                                                               ^

Should I expect this to only work for check-stage2?

@edwardw
Copy link
Contributor Author

edwardw commented Feb 24, 2015

This is weird. This test in my local make check-stage1-pfail runs fine.

@Manishearth
Copy link
Member

@bors: r-

I figured it out, #22544 broke your PR. Please rebase onto master and ask me for an r+ again (I'll try to include it into the rollup if there's time). Thanks!

@bors
Copy link
Collaborator

bors commented Feb 24, 2015

🙀 again is not a valid commit SHA. Please try again with 2931c21.

@bors
Copy link
Collaborator

bors commented Feb 24, 2015

⌛ Trying commit 2931c21 with merge 1f28313...

bors added a commit that referenced this pull request Feb 24, 2015
@Manishearth
Copy link
Member

@bors: r-

@Manishearth
Copy link
Member

dammit bors

@edwardw
Copy link
Contributor Author

edwardw commented Feb 24, 2015

I'm looking into it right now, could be some in between commits caused behavior change of the parser. And building LLVM, it will take a while.

@Manishearth
Copy link
Member

@edwardw No need to look for it, the change that broke this PR was #22544 :)

@edwardw
Copy link
Contributor Author

edwardw commented Feb 24, 2015

@Manishearth yeah, but I still need to verify it locally first. Besides I have the feeling that my patch will reduce to just bunch of tests 🚴

@edwardw edwardw force-pushed the enum-struct-ident-walk-into-a-bar branch from 2931c21 to a1396d2 Compare February 24, 2015 07:00
@edwardw
Copy link
Contributor Author

edwardw commented Feb 24, 2015

It is merely tests now.

r? @Manishearth

@edwardw edwardw changed the title syntax: do not panic if expect ident but find enum or struct Add tests for expect ident but find enum or struct panic Feb 24, 2015
@Manishearth
Copy link
Member

@bors r=nick29581 rollup

@bors
Copy link
Collaborator

bors commented Feb 24, 2015

🙀 rollup is not a valid commit SHA. Please try again with a1396d2.

@Manishearth
Copy link
Member

@bors r=nick29581 a1396d2 rollup

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 24, 2015
@bors bors merged commit a1396d2 into rust-lang:master Feb 24, 2015
@l0kod
Copy link
Contributor

l0kod commented Feb 25, 2015

Not sure it's exactly the same, but crash Rust nightly from play.rust-lang.org as well:

use std::rc::Rc;

fn main() {
    match Rc::new(1) {
        Rc<_> => {}
    }
}

@edwardw
Copy link
Contributor Author

edwardw commented Feb 25, 2015

@l0kod, playpen must've been a little bit lagged behind. Just run your code locally and rustc correctly bailed itself out:

use std::rc::Rc;

fn main() {
    match Rc::new(1) {
        Rc<_> => {}  // error: unexpected token: `<`
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment