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

Fix compatibility of futures-util with futures 0.3.1 #2062

Merged
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
9 changes: 7 additions & 2 deletions futures-util/src/async_await/select_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use proc_macro_hack::proc_macro_hack;
#[doc(hidden)]
#[macro_export]
macro_rules! document_select_macro {
($select:item $select_biased:item) => {
// This branch is required for `futures 0.3.1`, from before select_biased was introduced
($select:item) => {
/// Polls multiple futures and streams simultaneously, executing the branch
/// for the future that finishes first. If multiple futures are ready,
/// one will be pseudo-randomly selected at runtime. Futures directly
Expand Down Expand Up @@ -154,6 +155,10 @@ macro_rules! document_select_macro {
/// more complex behavior such as timer resets or writing into the head of
/// a stream.
$select
};

($select:item $select_biased:item) => {
$crate::document_select_macro!($select);

/// Polls multiple futures and streams simultaneously, executing the branch
/// for the future that finishes first. Unlike [`select!`], if multiple futures are ready,
Expand Down Expand Up @@ -302,7 +307,7 @@ macro_rules! document_select_macro {
///
/// [`select!`]: macro.select.html
$select_biased
}
};
}

document_select_macro! {
Expand Down