From 828a8dfb1f74bc8eedb49d30bcd4d31ac1ccee8f Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 29 Apr 2018 15:52:07 +0200 Subject: [PATCH] Fix async/await support for latest nightly After https://github.com/rust-lang/rust/pull/50120 procedural macros do not receive the parentheses as part of their attributes TokenStream. Also the proc_macro_non_items feature is necessary to use async_block. --- futures-macro-async/src/lib.rs | 8 ++++---- futures/testcrate/ui/move-captured-variable.rs | 2 +- futures/tests/async_await_tests.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/futures-macro-async/src/lib.rs b/futures-macro-async/src/lib.rs index b88a23c1c3..d0ab36094b 100644 --- a/futures-macro-async/src/lib.rs +++ b/futures-macro-async/src/lib.rs @@ -525,8 +525,8 @@ if_nightly! { impl synom::Synom for AsyncArgs { named!(parse -> Self, map!( - option!(parens!(call!(Punctuated::::parse_separated_nonempty))), - |p| AsyncArgs(p.map(|d| d.1.into_iter().collect()).unwrap_or_default()) + call!(Punctuated::::parse_separated), + |p| AsyncArgs(p.into_iter().collect()) )); } @@ -546,8 +546,8 @@ if_nightly! { impl synom::Synom for AsyncStreamArgs { named!(parse -> Self, map!( - option!(parens!(call!(Punctuated::::parse_separated_nonempty))), - |p| AsyncStreamArgs(p.map(|d| d.1.into_iter().collect()).unwrap_or_default()) + call!(Punctuated::::parse_separated), + |p| AsyncStreamArgs(p.into_iter().collect()) )); } } diff --git a/futures/testcrate/ui/move-captured-variable.rs b/futures/testcrate/ui/move-captured-variable.rs index 52d1d192b9..e0122c8b41 100644 --- a/futures/testcrate/ui/move-captured-variable.rs +++ b/futures/testcrate/ui/move-captured-variable.rs @@ -1,4 +1,4 @@ -#![feature(proc_macro, generators, pin)] +#![feature(proc_macro, proc_macro_non_items, generators, pin)] extern crate futures; diff --git a/futures/tests/async_await_tests.rs b/futures/tests/async_await_tests.rs index 5d27629f39..56c610604e 100644 --- a/futures/tests/async_await_tests.rs +++ b/futures/tests/async_await_tests.rs @@ -1,4 +1,4 @@ -#![cfg_attr(feature = "nightly", feature(proc_macro, generators, pin))] +#![cfg_attr(feature = "nightly", feature(proc_macro, proc_macro_non_items, generators, pin))] extern crate futures;