From 8786741ba986375a9ab9731968a5788460244cfa Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Wed, 21 Mar 2018 14:21:02 -0700 Subject: [PATCH] Update to futures 0.2.0-beta (#246) --- .travis.yml | 2 ++ futures2/Cargo.toml | 2 +- tests/echo2.rs | 2 +- tests/global2.rs | 2 +- tests/tcp2.rs | 4 ++-- tokio-threadpool/tests/threadpool.rs | 16 ++++++++++++++-- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index a353843ac..9676bcc84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,11 +13,13 @@ matrix: script: - | + set -e if [[ "$TRAVIS_RUST_VERSION" == nightly ]] then cargo build --benches --all fi - | + set -e if [[ "$TARGET" ]] then rustup target add $TARGET diff --git a/futures2/Cargo.toml b/futures2/Cargo.toml index a78a42d8c..256c61084 100644 --- a/futures2/Cargo.toml +++ b/futures2/Cargo.toml @@ -8,4 +8,4 @@ repository = "https://github.com/tokio-rs/tokio" homepage = "https://tokio.rs" [dependencies] -futures = "0.2.0-alpha" +futures = "=0.2.0-beta" diff --git a/tests/echo2.rs b/tests/echo2.rs index c05a5f478..6ead07d81 100755 --- a/tests/echo2.rs +++ b/tests/echo2.rs @@ -42,7 +42,7 @@ fn echo_server() { }); let clients = srv.incoming(); - let client = clients.into_future().map(|e| e.0.unwrap()).map_err(|e| e.0); + let client = clients.next().map(|e| e.0.unwrap()).map_err(|e| e.0); let halves = client.map(|s| s.split()); let copied = halves.and_then(|(a, b)| a.copy_into(b)); diff --git a/tests/global2.rs b/tests/global2.rs index 2ad52b8b0..24244abb1 100755 --- a/tests/global2.rs +++ b/tests/global2.rs @@ -34,7 +34,7 @@ fn hammer() { let srv = t!(TcpListener::bind(&"127.0.0.1:0".parse().unwrap())); let addr = t!(srv.local_addr()); let mine = TcpStream::connect(&addr); - let theirs = srv.incoming().into_future() + let theirs = srv.incoming().next() .map(|(s, _)| s.unwrap()) .map_err(|(s, _)| s); let (mine, theirs) = t!(block_on(mine.join(theirs))); diff --git a/tests/tcp2.rs b/tests/tcp2.rs index 464939c8c..4fbc978cb 100755 --- a/tests/tcp2.rs +++ b/tests/tcp2.rs @@ -48,7 +48,7 @@ fn accept() { let client = srv.incoming().map(move |t| { tx.send(()).unwrap(); t - }).into_future().map_err(|e| e.0); + }).next().map_err(|e| e.0); assert!(rx.try_recv().is_err()); let t = thread::spawn(move || { net::TcpStream::connect(&addr).unwrap() @@ -76,7 +76,7 @@ fn accept2() { let client = srv.incoming().map(move |t| { tx.send(()).unwrap(); t - }).into_future().map_err(|e| e.0); + }).next().map_err(|e| e.0); assert!(rx.try_recv().is_err()); let (mine, _remaining) = t!(block_on(client)); diff --git a/tokio-threadpool/tests/threadpool.rs b/tokio-threadpool/tests/threadpool.rs index 61dd5cf22..5edc4028b 100644 --- a/tokio-threadpool/tests/threadpool.rs +++ b/tokio-threadpool/tests/threadpool.rs @@ -16,7 +16,13 @@ use futures::future::lazy; #[cfg(feature = "unstable-futures")] use futures2::prelude::*; #[cfg(feature = "unstable-futures")] -use futures2::future::lazy; +fn lazy(f: F) -> Box + Send> where + F: Send + 'static + FnOnce() -> R, + R: Send + 'static + IntoFuture, + R::Future: Send, +{ + Box::new(::futures2::future::lazy(|_| f())) +} use std::cell::Cell; use std::sync::{mpsc, Arc}; @@ -416,7 +422,13 @@ fn many_multishot_futures() { } for final_rx in final_rxs { - block_on(final_rx.into_future()).unwrap(); + {#![cfg(feature = "unstable-futures")] + block_on(final_rx.next()).unwrap(); + } + + {#![cfg(not(feature = "unstable-futures"))] + block_on(final_rx.into_future()).unwrap(); + } } // Shutdown the pool