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

Fix implicit closure return type generation for libsyntax #49279

Merged
merged 2 commits into from
Mar 27, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented Mar 22, 2018

The lambda function for constructing closures in libsyntax was explicitly setting the return type to _, which resulted in incorrect corresponding syntax (as || -> _ x is not valid, without the enclosing brackets). This meant the generated code, when printed, was invalid.

I also took the opportunity to slightly improve the generated code for the RustcEncodable::encode method for unit structs.

Fixes #42213.

varkor added 2 commits March 22, 2018 15:55
…lambda-building

This prevents explicit `-> _` return type annotations for closures generated by `lambda`.
@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2018
@pietroalbini
Copy link
Member

Ping from triage @michaelwoerister! This PR needs your review.

@michaelwoerister
Copy link
Member

r? @alexcrichton maybe?

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 26, 2018

📌 Commit ad50f33 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 26, 2018
@bors
Copy link
Contributor

bors commented Mar 27, 2018

⌛ Testing commit ad50f33 with merge 14ac1b5...

bors added a commit that referenced this pull request Mar 27, 2018
…ichton

Fix implicit closure return type generation for libsyntax

The `lambda` function for constructing closures in libsyntax was explicitly setting the return type to `_`, which resulted in incorrect corresponding syntax (as `|| -> _ x` is not valid, without the enclosing brackets). This meant the generated code, when printed, was invalid.

I also took the opportunity to slightly improve the generated code for the `RustcEncodable::encode` method for unit structs.

Fixes #42213.
@bors
Copy link
Contributor

bors commented Mar 27, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 14ac1b5 to master...

@bors bors merged commit ad50f33 into rust-lang:master Mar 27, 2018
@varkor varkor deleted the generated-closure-return-type branch March 27, 2018 16:44
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.

6 participants