Skip to content
Merged
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
14 changes: 6 additions & 8 deletions tokio/src/macros/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,7 @@ doc! {macro_rules! select {

// `tokio::macros::support` is a public, but doc(hidden) module
// including a re-export of all types needed by this macro.
use $crate::macros::support::Future;
use $crate::macros::support::Pin;
use $crate::macros::support::Poll::{Ready, Pending};

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

Expand Down Expand Up @@ -704,9 +702,9 @@ doc! {macro_rules! select {
let mut fut = unsafe { Pin::new_unchecked(fut) };

// Try polling it
let out = match Future::poll(fut, cx) {
Ready(out) => out,
Pending => {
let out = match $crate::macros::support::Future::poll(fut, cx) {
$crate::macros::support::Poll::Ready(out) => out,
$crate::macros::support::Poll::Pending => {
// Track that at least one future is
// still pending and continue polling.
is_pending = true;
Expand All @@ -727,18 +725,18 @@ doc! {macro_rules! select {
}

// The select is complete, return the value
return Ready($crate::select_variant!(__tokio_select_util::Out, ($($skip)*))(out));
return $crate::macros::support::Poll::Ready($crate::select_variant!(__tokio_select_util::Out, ($($skip)*))(out));
}
)*
_ => unreachable!("reaching this means there probably is an off by one bug"),
}
}

if is_pending {
Pending
$crate::macros::support::Poll::Pending
} else {
// All branches have been disabled.
Ready(__tokio_select_util::Out::Disabled)
$crate::macros::support::Poll::Ready(__tokio_select_util::Out::Disabled)
}
}).await
};
Expand Down