mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-18 00:00:09 +02:00
macros: rename tokio::select!'s internal util module (#4543)
This internal module's identifier can clash with existing identifiers in library users' code and produce confusing error messages.
This commit is contained in:
@@ -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)* ) );
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
)*
|
||||
@@ -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"),
|
||||
@@ -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"),
|
||||
}
|
||||
}};
|
||||
|
||||
Reference in New Issue
Block a user