diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-05-09 23:56:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-09 23:56:18 +0200 |
| commit | 45b09453dbf120cc23d889435aac3ed7d2ec8eb7 (patch) | |
| tree | 67af0001a1a6863dba991d2b1ebe7592cd9c40c4 /src/test | |
| parent | f6df1f6c30b469cb9e65c5453a0efa03cbb6005e (diff) | |
| parent | d5e04067cb23df91070fea1a01aa6417afa714ed (diff) | |
| download | rust-45b09453dbf120cc23d889435aac3ed7d2ec8eb7.tar.gz rust-45b09453dbf120cc23d889435aac3ed7d2ec8eb7.zip | |
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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/async-await/auxiliary/issue-60674.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/async-await/issue-60674.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/async-await/issue-60674.stdout | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/async-await/auxiliary/issue-60674.rs b/src/test/ui/async-await/auxiliary/issue-60674.rs new file mode 100644 index 00000000000..680c6e55e56 --- /dev/null +++ b/src/test/ui/async-await/auxiliary/issue-60674.rs @@ -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() +} diff --git a/src/test/ui/async-await/issue-60674.rs b/src/test/ui/async-await/issue-60674.rs new file mode 100644 index 00000000000..37e356e5baf --- /dev/null +++ b/src/test/ui/async-await/issue-60674.rs @@ -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() {} diff --git a/src/test/ui/async-await/issue-60674.stdout b/src/test/ui/async-await/issue-60674.stdout new file mode 100644 index 00000000000..a93944db1c5 --- /dev/null +++ b/src/test/ui/async-await/issue-60674.stdout @@ -0,0 +1 @@ +async fn f(mut x: u8) { } |
