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 async desugaring providing wrong input to procedural macros. #60676

Merged
merged 3 commits into from May 10, 2019

Conversation

davidtwco
Copy link
Member

Fixes #60674.

This PR fixes a minor oversight introduced by #60535 where unused mut binding modes were removed from the arguments to an async fn (as they were added to the statement that we insert into the closure body). However, this meant that the input to procedural macros was incorrect. This removes that and instead fixes the unused_mut error that it avoided.

r? @cramertj
cc @taiki-e

This commit adds a regression test (with current broken behaviour) that
tests that `mut` patterns are not lost when provided as input to a proc macro.
This commit removes the modification of the mutability of simple
bindings. While the mutability isn't used, it is important that it is
kept so that the input to procedural macros matches what the user wrote.
This commit also modifies the span of the binding mode so that it is
considered a compiler desugaring and won't be linted against for being
unused..
This is unrelated to the rest of this PR but it made sense to add a
FIXME explaining that the function shouldn't really be in the parser.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 9, 2019
@cramertj
Copy link
Member

cramertj commented May 9, 2019

@bors r+

@bors
Copy link
Contributor

bors commented May 9, 2019

📌 Commit d5e0406 has been approved by cramertj

@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 May 9, 2019
Centril added a commit to Centril/rust that referenced this pull request May 9, 2019
Fix async desugaring providing wrong input to procedural macros.

Fixes rust-lang#60674.

This PR fixes a minor oversight introduced by rust-lang#60535 where unused `mut` binding modes were removed from the arguments to an `async fn` (as they were added to the statement that we insert into the closure body). However, this meant that the input to procedural macros was incorrect. This removes that and instead fixes the `unused_mut` error that it avoided.

r? @cramertj
cc @taiki-e
bors added a commit that referenced this pull request May 10, 2019
Rollup of 8 pull requests

Successful merges:

 - #59348 (Clean up and add tests for slice drop shims)
 - #60188 (Identify when a stmt could have been parsed as an expr)
 - #60234 (std: Derive `Default` for `io::Cursor`)
 - #60618 (Comment ext::tt::transcribe)
 - #60648 (Skip codegen for one UI test with long file path)
 - #60671 (remove unneeded `extern crate`s from build tools)
 - #60675 (Remove the old await! macro)
 - #60676 (Fix async desugaring providing wrong input to procedural macros.)

Failed merges:

r? @ghost
@bors bors merged commit d5e0406 into rust-lang:master May 10, 2019
@bors
Copy link
Contributor

bors commented May 10, 2019

⌛ Testing commit d5e0406 with merge 03bd2f6...

@davidtwco davidtwco deleted the issue-60674 branch May 10, 2019 07:27
davidtwco added a commit to davidtwco/rust that referenced this pull request May 10, 2019
At request of `@centril`, this commit extends the existing test added
by rust-lang#60676 to include nested `mut` patterns.
Centril added a commit to Centril/rust that referenced this pull request May 10, 2019
Extend rust-lang#60676 test for nested mut patterns.

At request of @Centril, this commit extends the existing test added by rust-lang#60676 to include nested `mut` patterns.

cc @Centril
bors added a commit that referenced this pull request May 10, 2019
Rollup of 6 pull requests

Successful merges:

 - #60529 (RFC 2008: Uninhabitedness fixes for enum variants and tests)
 - #60620 (Fix a couple of FIXMEs in ext::tt::transcribe)
 - #60659 (Tweak `Symbol` and `InternedString`)
 - #60692 (Extend #60676 test for nested mut patterns.)
 - #60697 (add regression test for #60629)
 - #60701 (Update mailmap for mati865)

Failed merges:

r? @ghost
davidtwco pushed a commit to davidtwco/rust that referenced this pull request Jun 3, 2019
Here follows the main reverts applied in order to make this commit:

Revert "Rollup merge of rust-lang#60676 - davidtwco:issue-60674, r=cramertj"

This reverts commit 45b0945, reversing
changes made to f6df1f6.

Revert "Rollup merge of rust-lang#60437 - davidtwco:issue-60236, r=nikomatsakis"

This reverts commit 16939a5, reversing
changes made to 12bf981.

Revert "Rollup merge of rust-lang#59823 - davidtwco:issue-54716, r=cramertj"

This reverts commit 62d1574, reversing
changes made to 4eff852.
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.

Async fn loses mut pattern when passed to attribute macro
5 participants