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:
commit
45b09453db
6 changed files with 76 additions and 43 deletions
12
src/test/ui/async-await/auxiliary/issue-60674.rs
Normal file
12
src/test/ui/async-await/auxiliary/issue-60674.rs
Normal 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()
|
||||
}
|
||||
14
src/test/ui/async-await/issue-60674.rs
Normal file
14
src/test/ui/async-await/issue-60674.rs
Normal 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() {}
|
||||
1
src/test/ui/async-await/issue-60674.stdout
Normal file
1
src/test/ui/async-await/issue-60674.stdout
Normal file
|
|
@ -0,0 +1 @@
|
|||
async fn f(mut x: u8) { }
|
||||
Loading…
Add table
Add a link
Reference in a new issue