Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion futures-core/src/task/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// This macro bakes in propagation of `Pending` signals by returning early.
#[macro_export]
macro_rules! ready {
($e:expr) => (match $e {
($e:expr $(,)?) => (match $e {
$crate::core_reexport::task::Poll::Ready(t) => t,
$crate::core_reexport::task::Poll::Pending =>
return $crate::core_reexport::task::Poll::Pending,
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/async_await/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/// ```
#[macro_export]
macro_rules! join {
($($fut:ident),*) => { {
($($fut:ident),* $(,)?) => { {
$(
// Move future into a local so that it is pinned in one place and
// is no longer accessible by the end user.
Expand Down Expand Up @@ -91,7 +91,7 @@ macro_rules! join {
/// ```
#[macro_export]
macro_rules! try_join {
($($fut:ident),*) => { {
($($fut:ident),* $(,)?) => { {
$(
// Move future into a local so that it is pinned in one place and
// is no longer accessible by the end user.
Expand Down
2 changes: 1 addition & 1 deletion futures-util/src/async_await/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use futures_core::task::{Context, Poll};
/// _not_ activated by default.
#[macro_export]
macro_rules! poll {
($x:expr) => {
($x:expr $(,)?) => {
$crate::async_await::poll($x).await
}
}
Expand Down
44 changes: 44 additions & 0 deletions futures/tests/macro_comma_support.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#![feature(async_await)]

#[macro_use]
extern crate futures;

use futures::{
executor::block_on,
future::{self, FutureExt},
task::Poll,
};

#[test]
fn ready() {
block_on(future::poll_fn(|_| {
ready!(Poll::Ready(()),);
Poll::Ready(())
}))
}

#[test]
fn poll() {
block_on(async {
let _ = poll!(async { () }.boxed(),);
})
}

#[test]
fn join() {
block_on(async {
let future1 = async { 1 };
let future2 = async { 2 };
join!(future1, future2,);
})
}

#[test]
fn try_join() {
block_on(async {
let future1 = async { 1 }.never_error();
let future2 = async { 2 }.never_error();
try_join!(future1, future2,)
})
.unwrap();
}