Skip to content

Commit 5c13a65

Browse files
Nemo157cramertj
authored andcommitted
Fix compatibility of futures-util with futures 0.3.1
1 parent b825f30 commit 5c13a65

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

futures-util/src/async_await/select_mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use proc_macro_hack::proc_macro_hack;
55
#[doc(hidden)]
66
#[macro_export]
77
macro_rules! document_select_macro {
8-
($select:item $select_biased:item) => {
8+
// This branch is required for `futures 0.3.1`, from before select_biased was introduced
9+
($select:item) => {
910
/// Polls multiple futures and streams simultaneously, executing the branch
1011
/// for the future that finishes first. If multiple futures are ready,
1112
/// one will be pseudo-randomly selected at runtime. Futures directly
@@ -154,6 +155,10 @@ macro_rules! document_select_macro {
154155
/// more complex behavior such as timer resets or writing into the head of
155156
/// a stream.
156157
$select
158+
};
159+
160+
($select:item $select_biased:item) => {
161+
$crate::document_select_macro!($select);
157162

158163
/// Polls multiple futures and streams simultaneously, executing the branch
159164
/// for the future that finishes first. Unlike [`select!`], if multiple futures are ready,
@@ -302,7 +307,7 @@ macro_rules! document_select_macro {
302307
///
303308
/// [`select!`]: macro.select.html
304309
$select_biased
305-
}
310+
};
306311
}
307312

308313
document_select_macro! {

0 commit comments

Comments
 (0)