Rollup merge of #60676 - davidtwco:issue-60674, r=cramertj

Fix async desugaring providing wrong input to procedural macros.

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 is contained in:
Mazdak Farrokhzad 2019-05-09 23:56:18 +02:00 committed by GitHub
commit 45b09453db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 43 deletions

View file

@ -0,0 +1,12 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn attr(_args: TokenStream, input: TokenStream) -> TokenStream {
println!("{}", input);
TokenStream::new()
}

View file

@ -0,0 +1,14 @@
// aux-build:issue-60674.rs
// compile-pass
// edition:2018
#![feature(async_await)]
// This is a regression test that ensures that `mut` patterns are not lost when provided as input
// to a proc macro.
extern crate issue_60674;
#[issue_60674::attr]
async fn f(mut x: u8) {}
fn main() {}

View file

@ -0,0 +1 @@
async fn f(mut x: u8) { }