chore: remove internal io-driver cargo feature (#2881)

This commit is contained in:
Ivan Petkov 2020-09-24 14:36:42 -07:00 committed by GitHub
parent ffa5bdb22d
commit 56acde069f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 62 additions and 17 deletions

View File

@ -150,11 +150,11 @@ jobs:
run: cargo install cargo-hack run: cargo install cargo-hack
- name: check --each-feature - name: check --each-feature
run: cargo hack check --all --each-feature --skip io-driver -Z avoid-dev-deps run: cargo hack check --all --each-feature -Z avoid-dev-deps
# Try with unstable feature flags # Try with unstable feature flags
- name: check --each-feature --unstable - name: check --each-feature --unstable
run: cargo hack check --all --each-feature --skip io-driver -Z avoid-dev-deps run: cargo hack check --all --each-feature -Z avoid-dev-deps
env: env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings

View File

@ -50,16 +50,15 @@ full = [
blocking = ["rt-core"] blocking = ["rt-core"]
dns = ["rt-core"] dns = ["rt-core"]
fs = ["rt-core", "io-util"] fs = ["rt-core", "io-util"]
io-driver = ["mio", "lazy_static"] # internal only
io-util = ["memchr"] io-util = ["memchr"]
# stdin, stdout, stderr # stdin, stdout, stderr
io-std = ["rt-core"] io-std = ["rt-core"]
macros = ["tokio-macros"] macros = ["tokio-macros"]
net = ["dns", "tcp", "udp", "uds"] net = ["dns", "tcp", "udp", "uds"]
process = [ process = [
"io-driver",
"lazy_static", "lazy_static",
"libc", "libc",
"mio",
"mio-named-pipes", "mio-named-pipes",
"mio-uds", "mio-uds",
"signal-hook-registry", "signal-hook-registry",
@ -73,9 +72,9 @@ rt-threaded = [
"rt-core", "rt-core",
] ]
signal = [ signal = [
"io-driver",
"lazy_static", "lazy_static",
"libc", "libc",
"mio",
"mio-uds", "mio-uds",
"signal-hook-registry", "signal-hook-registry",
"winapi/consoleapi", "winapi/consoleapi",
@ -83,10 +82,10 @@ signal = [
stream = ["futures-core"] stream = ["futures-core"]
sync = ["fnv"] sync = ["fnv"]
test-util = [] test-util = []
tcp = ["io-driver", "iovec"] tcp = ["iovec", "lazy_static", "mio"]
time = ["slab"] time = ["slab"]
udp = ["io-driver"] udp = ["lazy_static", "mio"]
uds = ["io-driver", "mio-uds", "libc"] uds = ["lazy_static", "libc", "mio", "mio-uds"]
[dependencies] [dependencies]
tokio-macros = { version = "0.3.0", path = "../tokio-macros", optional = true } tokio-macros = { version = "0.3.0", path = "../tokio-macros", optional = true }

View File

@ -14,7 +14,14 @@ pub(crate) mod cell {
pub(crate) use super::unsafe_cell::UnsafeCell; pub(crate) use super::unsafe_cell::UnsafeCell;
} }
#[cfg(any(feature = "sync", feature = "io-driver"))] #[cfg(any(
feature = "process",
feature = "signal",
feature = "sync",
feature = "tcp",
feature = "udp",
feature = "uds",
))]
pub(crate) mod future { pub(crate) mod future {
pub(crate) use crate::sync::AtomicWaker; pub(crate) use crate::sync::AtomicWaker;
} }

View File

@ -3,7 +3,14 @@
macro_rules! cfg_resource_drivers { macro_rules! cfg_resource_drivers {
($($item:item)*) => { ($($item:item)*) => {
$( $(
#[cfg(any(feature = "io-driver", feature = "time"))] #[cfg(any(
feature = "process",
all(unix, feature = "signal"),
all(not(loom), feature = "tcp"),
feature = "time",
all(not(loom), feature = "udp"),
all(not(loom), feature = "uds"),
))]
$item $item
)* )*
} }
@ -89,9 +96,13 @@ macro_rules! cfg_atomic_waker_impl {
($($item:item)*) => { ($($item:item)*) => {
$( $(
#[cfg(any( #[cfg(any(
feature = "io-driver", feature = "process",
all(feature = "rt-core", feature = "rt-util"),
feature = "signal",
feature = "tcp",
feature = "time", feature = "time",
all(feature = "rt-core", feature = "rt-util") feature = "udp",
feature = "uds",
))] ))]
#[cfg(not(loom))] #[cfg(not(loom))]
$item $item
@ -128,7 +139,20 @@ macro_rules! cfg_io_blocking {
macro_rules! cfg_io_driver { macro_rules! cfg_io_driver {
($($item:item)*) => { ($($item:item)*) => {
$( $(
#[cfg(feature = "io-driver")] #[cfg(any(
feature = "process",
all(unix, feature = "signal"),
feature = "tcp",
feature = "udp",
feature = "uds",
))]
#[cfg_attr(docsrs, doc(cfg(any(
feature = "process",
all(unix, feature = "signal"),
feature = "tcp",
feature = "udp",
feature = "uds",
))))]
$item $item
)* )*
} }
@ -137,7 +161,13 @@ macro_rules! cfg_io_driver {
macro_rules! cfg_not_io_driver { macro_rules! cfg_not_io_driver {
($($item:item)*) => { ($($item:item)*) => {
$( $(
#[cfg(not(feature = "io-driver"))] #[cfg(not(any(
feature = "process",
all(unix, feature = "signal"),
feature = "tcp",
feature = "udp",
feature = "uds",
)))]
$item $item
)* )*
} }
@ -407,13 +437,16 @@ macro_rules! cfg_coop {
feature = "blocking", feature = "blocking",
feature = "dns", feature = "dns",
feature = "fs", feature = "fs",
feature = "io-driver",
feature = "io-std", feature = "io-std",
feature = "process", feature = "process",
feature = "rt-core", feature = "rt-core",
feature = "signal",
feature = "sync", feature = "sync",
feature = "stream", feature = "stream",
feature = "time" feature = "tcp",
feature = "time",
feature = "udp",
feature = "uds",
))] ))]
$item $item
)* )*

View File

@ -138,7 +138,13 @@ impl Builder {
/// .unwrap(); /// .unwrap();
/// ``` /// ```
pub fn enable_all(&mut self) -> &mut Self { pub fn enable_all(&mut self) -> &mut Self {
#[cfg(feature = "io-driver")] #[cfg(any(
feature = "process",
all(unix, feature = "signal"),
feature = "tcp",
feature = "udp",
feature = "uds",
))]
self.enable_io(); self.enable_io();
#[cfg(feature = "time")] #[cfg(feature = "time")]
self.enable_time(); self.enable_time();