Skip to content

Issue 21033 struct var pattern fix #21278

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
Jan 19, 2015
Merged

Issue 21033 struct var pattern fix #21278

merged 1 commit into from
Jan 19, 2015

Conversation

thchittenden
Copy link
Contributor

Closes #21033. The new strategy for parsing a field pattern is to look 1 token ahead and if it's a colon, parse as "fieldname: pat", otherwise parse the shorthand form "(box) (ref) (mut) fieldname)". The previous strategy was to parse "(ref) (mut) fieldname" then if we encounter a colon, throw an error if either "ref" or "mut" were encountered.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@alexcrichton
Copy link
Member

Thanks! Could you add a few more tests for mixing box, ref, and mut to make sure everything checks out ok? Also, could you squash the commits into one? Otherwise this looks great to me!

@thchittenden
Copy link
Contributor Author

Ok, done. I'm not sure if you want the tests in separate files or not but if you do I can separate them.

}
match a {
E::StructVar { mut boxed } => { }
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this test compile? Isn't a moved into one of the branches above?

@alexcrichton
Copy link
Member

Ah and all one test is fine by me, just wondering about whether the test compiles today

@thchittenden
Copy link
Contributor Author

Bah, not sure how I missed that. Should be fixed now.

@alexcrichton
Copy link
Member

@bors: r+ d8372131

@bors
Copy link
Collaborator

bors commented Jan 19, 2015

🙀 You have the wrong number! Please try again with d837.

@alexcrichton
Copy link
Member

@bors: r+ d837213

@bors
Copy link
Collaborator

bors commented Jan 19, 2015

⌛ Testing commit d837213 with merge 4032b85...

bors added a commit that referenced this pull request Jan 19, 2015
…x, r=alexcrichton

Closes #21033. The new strategy for parsing a field pattern is to look 1 token ahead and if it's a colon, parse as "fieldname: pat", otherwise parse the shorthand form "(box) (ref) (mut) fieldname)". The previous strategy was to parse "(ref) (mut) fieldname" then if we encounter a colon, throw an error if either "ref" or "mut" were encountered.
@bors
Copy link
Collaborator

bors commented Jan 19, 2015

@bors bors merged commit d837213 into rust-lang:master Jan 19, 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.

Inconsistent pattern matching on struct variants
4 participants