mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
Update Tokio to use std::future. (#1120)
A first pass at updating Tokio to use `std::future`. Implementations of `Future` from the futures crate are updated to implement `Future` from std. Implementations of `Stream` are moved to a feature flag. This commits disables a number of crates that have not yet been updated.
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
#![deny(warnings, rust_2018_idioms)]
|
||||
#![feature(await_macro, async_await)]
|
||||
|
||||
use futures::{self, future::lazy, Future};
|
||||
use tokio_executor::{self, DefaultExecutor};
|
||||
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
mod out_of_executor_context {
|
||||
use super::*;
|
||||
use tokio_executor::Executor;
|
||||
|
||||
fn test<F, E>(spawn: F)
|
||||
where
|
||||
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>) -> Result<(), E>,
|
||||
F: Fn(Pin<Box<dyn Future<Output = ()> + Send>>) -> Result<(), E>,
|
||||
{
|
||||
let res = spawn(Box::new(lazy(|| Ok(()))));
|
||||
let res = spawn(Box::pin(async {}));
|
||||
assert!(res.is_err());
|
||||
}
|
||||
|
||||
@@ -19,10 +22,4 @@ mod out_of_executor_context {
|
||||
fn spawn() {
|
||||
test(|f| DefaultExecutor::current().spawn(f));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn execute() {
|
||||
use futures::future::Executor as FuturesExecutor;
|
||||
test(|f| DefaultExecutor::current().execute(f));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user