mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-03 00:00:05 +02:00
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.
This commit is contained in:
+12
-5
@@ -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 = [
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user