Skip to content
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

Parse nested closure with two consecutive parameter lists properly #44484

Merged
merged 1 commit into from
Sep 14, 2017

Conversation

tirr-c
Copy link
Contributor

@tirr-c tirr-c commented Sep 11, 2017

This is a followup of #44332.


Currently, in nightly, this does not compile:

fn main() {
    let f = |_||x, y| x+y;
    println!("{}", f(())(1, 2)); // should print 3
}

|_||x, y| x+y should be parsed as |_| (|x, y| x+y), but the parser didn't accept || between _ and x. This patch fixes the problem.

r? @petrochenkov

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (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. Due to 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 the contribution instructions for more information.

@petrochenkov
Copy link
Contributor

@bors r+
Thanks!

@bors
Copy link
Contributor

bors commented Sep 11, 2017

📌 Commit 31cf11a has been approved by petrochenkov

@carols10cents carols10cents added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 11, 2017
@bors
Copy link
Contributor

bors commented Sep 14, 2017

⌛ Testing commit 31cf11a with merge d1ca653...

bors added a commit that referenced this pull request Sep 14, 2017
Parse nested closure with two consecutive parameter lists properly

This is a followup of #44332.

---

Currently, in nightly, this does not compile:

```rust
fn main() {
    let f = |_||x, y| x+y;
    println!("{}", f(())(1, 2)); // should print 3
}
```

`|_||x, y| x+y` should be parsed as `|_| (|x, y| x+y)`, but the parser didn't accept `||` between `_` and `x`. This patch fixes the problem.

r? @petrochenkov
@bors
Copy link
Contributor

bors commented Sep 14, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: petrochenkov
Pushing d1ca653 to master...

@bors bors merged commit 31cf11a into rust-lang:master Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants