Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tokio::select!'s internal util module to __tokio_select_util #4543

Merged
merged 1 commit into from Mar 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions tokio/src/macros/select.rs
Expand Up @@ -429,7 +429,8 @@ macro_rules! select {
//
// This module is defined within a scope and should not leak out of this
// macro.
mod util {
#[doc(hidden)]
mod __tokio_select_util {
// Generate an enum with one variant per select branch
$crate::select_priv_declare_output_enum!( ( $($count)* ) );
}
Expand All @@ -442,13 +443,13 @@ macro_rules! select {

const BRANCHES: u32 = $crate::count!( $($count)* );

let mut disabled: util::Mask = Default::default();
let mut disabled: __tokio_select_util::Mask = Default::default();

// First, invoke all the pre-conditions. For any that return true,
// set the appropriate bit in `disabled`.
$(
if !$c {
let mask: util::Mask = 1 << $crate::count!( $($skip)* );
let mask: __tokio_select_util::Mask = 1 << $crate::count!( $($skip)* );
disabled |= mask;
}
)*
Expand Down Expand Up @@ -525,7 +526,7 @@ macro_rules! select {
}

// The select is complete, return the value
return Ready($crate::select_variant!(util::Out, ($($skip)*))(out));
return Ready($crate::select_variant!(__tokio_select_util::Out, ($($skip)*))(out));
}
)*
_ => unreachable!("reaching this means there probably is an off by one bug"),
Expand All @@ -536,16 +537,16 @@ macro_rules! select {
Pending
} else {
// All branches have been disabled.
Ready(util::Out::Disabled)
Ready(__tokio_select_util::Out::Disabled)
}
}).await
};

match output {
$(
$crate::select_variant!(util::Out, ($($skip)*) ($bind)) => $handle,
$crate::select_variant!(__tokio_select_util::Out, ($($skip)*) ($bind)) => $handle,
)*
util::Out::Disabled => $else,
__tokio_select_util::Out::Disabled => $else,
_ => unreachable!("failed to match bind"),
}
}};
Expand Down