small change in `select` example.
In the previous example one future always finished first (because of
implementation details), possibly confusing users about what `select`
does.
This commit resolves the issue by being explicit about one future
finishing before the other.
@@ -32,12 +32,20 @@ impl<A: Unpin, B: Unpin> Unpin for Select<A, B> {}
///
/// ```
/// # futures::executor::block_on(async {
-/// use futures::future::{self, Either};
-/// use futures::pin_mut;
+/// use futures::{
+/// pin_mut,
+/// future::Either,
+/// future::self,
+/// };
///
-/// // These two futures have different types even though their outputs have the same type
-/// let future1 = async { 1 };
-/// let future2 = async { 2 };
+/// // These two futures have different types even though their outputs have the same type.
+/// let future1 = async {
+/// future::pending::<()>().await; // will never finish
+/// 1
+/// };
+/// let future2 = async {
+/// future::ready(2).await
+/// };
///
/// // 'select' requires Future + Unpin bounds
/// pin_mut!(future1);
@@ -50,7 +58,7 @@ impl<A: Unpin, B: Unpin> Unpin for Select<A, B> {}
/// // `_` represents `future1`
/// };
///
-/// assert!(value == 1 || value == 2);
+/// assert!(value == 2);
/// # });
/// ```
///
