diff options
author | Taiki Endo <te316e89@gmail.com> | 2019-11-01 13:09:32 +0900 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2019-10-31 21:09:32 -0700 |
commit | 02f7264008e0333d7c4df183d3bcfbda8a6d930f (patch) | |
tree | 6100ae0b9a96178970d9e9a73e3225134a5b38a8 /tokio | |
parent | 2902e39db0151c9064be535b7983748eb9a0d92f (diff) |
chore: check each feature works properly (#1695)
It is hard to maintain features list manually, so use cargo-hack's
`--each-feature` flag. And cargo-hack provides a workaround for an issue
that dev-dependencies leaking into normal build (`--no-dev-deps` flag),
so removed own ci tool.
Also, compared to running tests on all features, there is not much
advantage in running tests on each feature, so only the default features
and all features are tested.
If the behavior changes depending on the feature, we need to test it as
another job in CI.
Diffstat (limited to 'tokio')
-rw-r--r-- | tokio/Cargo.toml | 17 | ||||
-rw-r--r-- | tokio/src/executor/current_thread/mod.rs | 2 | ||||
-rw-r--r-- | tokio/src/executor/thread_pool/pool.rs | 7 | ||||
-rw-r--r-- | tokio/src/lib.rs | 6 |
4 files changed, 22 insertions, 10 deletions
diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 057055e2..48b27a39 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -36,19 +36,24 @@ default = [ "timer", ] -blocking = [] -fs = ["blocking"] +executor-core = [] +blocking = ["executor-core", "sync"] +fs = ["blocking", "io-traits"] io-traits = ["bytes", "iovec"] io-util = ["io-traits", "pin-project", "memchr"] io = ["io-traits", "io-util"] macros = ["tokio-macros"] net-full = ["tcp", "udp", "uds"] -net-driver = ["mio", "blocking", "lazy_static"] +net-driver = ["io-traits", "mio", "blocking", "lazy_static"] rt-current-thread = [ + "executor-core", "crossbeam-channel", "timer", + "sync", + "net-driver", ] rt-full = [ + "executor-core", "macros", "num_cpus", "net-full", @@ -61,11 +66,13 @@ signal = [ "libc", "mio-uds", "net-driver", - "signal-hook-registry" + "signal-hook-registry", + "winapi/consoleapi", + "winapi/minwindef", ] sync = ["fnv"] tcp = ["io", "net-driver"] -timer = ["slab"] +timer = ["executor-core", "sync", "slab"] udp = ["io", "net-driver"] uds = ["io", "net-driver", "mio-uds", "libc"] process = [ diff --git a/tokio/src/executor/current_thread/mod.rs b/tokio/src/executor/current_thread/mod.rs index dcc9c51a..62619f2a 100644 --- a/tokio/src/executor/current_thread/mod.rs +++ b/tokio/src/executor/current_thread/mod.rs @@ -18,10 +18,10 @@ mod scheduler; use self::scheduler::{Scheduler, TickArgs}; -use crate::executor::{EnterError, Executor, SpawnError, TypedExecutor}; #[cfg(feature = "blocking")] use crate::executor::blocking::{Pool, PoolWaiter}; use crate::executor::park::{Park, ParkThread, Unpark}; +use crate::executor::{EnterError, Executor, SpawnError, TypedExecutor}; use std::cell::Cell; use std::error::Error; diff --git a/tokio/src/executor/thread_pool/pool.rs b/tokio/src/executor/thread_pool/pool.rs index 1da4239b..6a83e97d 100644 --- a/tokio/src/executor/thread_pool/pool.rs +++ b/tokio/src/executor/thread_pool/pool.rs @@ -68,8 +68,11 @@ impl ThreadPool { F: Future, { crate::executor::global::with_threadpool(self, || { - let mut enter = crate::executor::enter().expect("attempting to block while on a Tokio executor"); - crate::executor::blocking::with_pool(self.spawner.blocking_pool(), || enter.block_on(future)) + let mut enter = + crate::executor::enter().expect("attempting to block while on a Tokio executor"); + crate::executor::blocking::with_pool(self.spawner.blocking_pool(), || { + enter.block_on(future) + }) }) } diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 94eb3072..f42a8a1e 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -95,7 +95,7 @@ pub mod fs; pub mod future; -#[cfg(feature = "io")] +#[cfg(feature = "io-traits")] pub mod io; #[cfg(feature = "net-driver")] @@ -121,8 +121,10 @@ pub mod sync; #[cfg(feature = "timer")] pub mod timer; +#[cfg(feature = "executor-core")] +pub mod executor; + if_runtime! { - pub mod executor; pub mod runtime; #[doc(inline)] |