Skip to content

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
Contributor

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
Collaborator

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
Collaborator

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
Collaborator

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