Skip to content

Commit

Permalink
Bring back the colon separators for the macro munching.
Browse files Browse the repository at this point in the history
Co-Authored-By: Ibraheem Ahmed <ibrah1440@gmail.com>
  • Loading branch information
danielhenrymantilla and ibraheemdev committed Dec 9, 2021
1 parent 846cb9c commit 07bcf4a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions library/core/src/future/join.rs
Expand Up @@ -48,9 +48,9 @@ use crate::task::{Context, Poll};
pub macro join( $($fut:expr),+ $(,)? ) {
// Funnel through an internal macro not to leak implementation details.
join_internal! {
current_position[]
futures_and_positions[]
munching[ $($fut)+ ]
current_position: []
futures_and_positions: []
munching: [ $($fut)+ ]
}
}

Expand All @@ -64,44 +64,44 @@ macro join_internal {
// Recursion step: map each future with its "position" (underscore count).
(
// Accumulate a token for each future that has been expanded: "_ _ _".
current_position[
current_position: [
$($underscores:tt)*
]
// Accumulate Futures and their positions in the tuple: `_0th () _1st ( _ ) …`.
futures_and_positions[
futures_and_positions: [
$($acc:tt)*
]
// Munch one future.
munching[
munching: [
$current:tt
$($rest:tt)*
]
) => (
join_internal! {
current_position[
current_position: [
$($underscores)*
_
]
futures_and_positions[
futures_and_positions: [
$($acc)*
$current ( $($underscores)* )
]
munching[
munching: [
$($rest)*
]
}
),

// End of recursion: generate the output future.
(
current_position $_:tt
futures_and_positions[
current_position: $_:tt
futures_and_positions: [
$(
$fut_expr:tt ( $($pos:tt)* )
)*
]
// Nothing left to munch.
munching[]
munching: []
) => (
match ( $( MaybeDone::Future($fut_expr), )* ) { futures => async {
let mut futures = futures;
Expand Down

0 comments on commit 07bcf4a

Please sign in to comment.