Skip to content

Fix the parsing of where-clauses for tuple-structs #20424

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
Jan 6, 2015

Conversation

jroesch
Copy link
Member

@jroesch jroesch commented Jan 2, 2015

Fixes #17904. All the cases that I believe we should support are detailed in the test case, let me know if there is there is any more desired behavior. cc @japaric.

r? @nikomatsakis or whoever is appropriate.

@jroesch jroesch force-pushed the tuple-struct-where-clause-fix branch 3 times, most recently from 0b1bf63 to be684b5 Compare January 2, 2015 12:12
@jroesch
Copy link
Member Author

jroesch commented Jan 2, 2015

We might want to make this parsing code less flexible and reject code like: struct Foo<T> where T: Copy (T) where T: Sized which will parse unless we track to see if we have already parsed a where clause. We can't do this with a single look ahead AFAIK.

@sfackler
Copy link
Member

sfackler commented Jan 2, 2015

I would personally prefer to reject where clauses in the old location entirely.

@nikomatsakis
Copy link
Contributor

I agree with @sfackler, we should not accept struct Foo<T> where T : Copy (T) -- and in general I'd like to see some compile-fail tests with "weird" constructs that should not parse.

@jroesch jroesch force-pushed the tuple-struct-where-clause-fix branch 2 times, most recently from 2ae38a9 to 58f19fd Compare January 4, 2015 10:49
@nikomatsakis
Copy link
Contributor

Travis is unhappy

/home/travis/build/rust-lang/rust/src/libsyntax/parse/parser.rs:4943: line longer than 100 chars

@nikomatsakis
Copy link
Contributor

r+ once tidy error is fixed

@jroesch jroesch force-pushed the tuple-struct-where-clause-fix branch 2 times, most recently from 5e971a8 to a0495ed Compare January 4, 2015 10:56
@jroesch jroesch force-pushed the tuple-struct-where-clause-fix branch from a0495ed to fb1871d Compare January 5, 2015 01:31
@jroesch
Copy link
Member Author

jroesch commented Jan 5, 2015

A small test failure was lurking, rebased, fixed it and pushed again.

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 5, 2015
Fixes rust-lang#17904. All the cases that I believe we should support are detailed in the test case, let me know if there is there is any more desired behavior. cc @japaric.

r? @nikomatsakis or whoever is appropriate.
@jroesch jroesch force-pushed the tuple-struct-where-clause-fix branch from fb1871d to c02fac4 Compare January 5, 2015 08:46
// <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.

Copy link
Member

Choose a reason for hiding this comment

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

Currently this file doesn't pretty print correctly: alexcrichton@acef292

(it's fine to ignore pretty printing for now)

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 6, 2015
Fixes rust-lang#17904. All the cases that I believe we should support are detailed in the test case, let me know if there is there is any more desired behavior. cc @japaric.

r? @nikomatsakis or whoever is appropriate.
@bors bors merged commit c02fac4 into rust-lang:master Jan 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't use where clauses with tuple structs
5 participants