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
4 changes: 3 additions & 1 deletion tokio/src/macros/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ macro_rules! join {

// ===== Entry point =====

( $($e:expr),* $(,)?) => {
( $($e:expr),+ $(,)?) => {
$crate::join!(@{ () (0) } $($e,)*)
};

() => { async {}.await }
}
4 changes: 3 additions & 1 deletion tokio/src/macros/try_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ macro_rules! try_join {

// ===== Entry point =====

( $($e:expr),* $(,)?) => {
( $($e:expr),+ $(,)?) => {
$crate::try_join!(@{ () (0) } $($e,)*)
};

() => { async { Ok(()) }.await }
}
6 changes: 6 additions & 0 deletions tokio/tests/macros_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,9 @@ async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
*poll_order.lock().unwrap()
);
}

#[tokio::test]
#[allow(clippy::unit_cmp)]
async fn empty_join() {
assert_eq!(tokio::join!(), ());
}
5 changes: 5 additions & 0 deletions tokio/tests/macros_try_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,8 @@ async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
*poll_order.lock().unwrap()
);
}

#[tokio::test]
async fn empty_try_join() {
assert_eq!(tokio::try_join!() as Result<_, ()>, Ok(()));
}