From 56acde069fe7fc57259e72de612f0c91c1320972 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Thu, 24 Sep 2020 14:36:42 -0700 Subject: chore: remove internal io-driver cargo feature (#2881) --- .github/workflows/ci.yml | 4 ++-- tokio/Cargo.toml | 11 +++++------ tokio/src/loom/std/mod.rs | 9 ++++++++- tokio/src/macros/cfg.rs | 47 +++++++++++++++++++++++++++++++++++++------- tokio/src/runtime/builder.rs | 8 +++++++- 5 files changed, 62 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a07b32f..756a7677 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,11 +150,11 @@ jobs: run: cargo install cargo-hack - 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 - 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: RUSTFLAGS: --cfg tokio_unstable -Dwarnings diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 4d8edf63..9e7ebf12 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -50,16 +50,15 @@ full = [ blocking = ["rt-core"] dns = ["rt-core"] fs = ["rt-core", "io-util"] -io-driver = ["mio", "lazy_static"] # internal only io-util = ["memchr"] # stdin, stdout, stderr io-std = ["rt-core"] macros = ["tokio-macros"] net = ["dns", "tcp", "udp", "uds"] process = [ - "io-driver", "lazy_static", "libc", + "mio", "mio-named-pipes", "mio-uds", "signal-hook-registry", @@ -73,9 +72,9 @@ rt-threaded = [ "rt-core", ] signal = [ - "io-driver", "lazy_static", "libc", + "mio", "mio-uds", "signal-hook-registry", "winapi/consoleapi", @@ -83,10 +82,10 @@ signal = [ stream = ["futures-core"] sync = ["fnv"] test-util = [] -tcp = ["io-driver", "iovec"] +tcp = ["iovec", "lazy_static", "mio"] time = ["slab"] -udp = ["io-driver"] -uds = ["io-driver", "mio-uds", "libc"] +udp = ["lazy_static", "mio"] +uds = ["lazy_static", "libc", "mio", "mio-uds"] [dependencies] tokio-macros = { version = "0.3.0", path = "../tokio-macros", optional = true } diff --git a/tokio/src/loom/std/mod.rs b/tokio/src/loom/std/mod.rs index 60ee56ad..15a15f0a 100644 --- a/tokio/src/loom/std/mod.rs +++ b/tokio/src/loom/std/mod.rs @@ -14,7 +14,14 @@ pub(crate) mod cell { 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) use crate::sync::AtomicWaker; } diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index 447d81ef..f245b09e 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -3,7 +3,14 @@ macro_rules! cfg_resource_drivers { ($($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 )* } @@ -89,9 +96,13 @@ macro_rules! cfg_atomic_waker_impl { ($($item:item)*) => { $( #[cfg(any( - feature = "io-driver", + feature = "process", + all(feature = "rt-core", feature = "rt-util"), + feature = "signal", + feature = "tcp", feature = "time", - all(feature = "rt-core", feature = "rt-util") + feature = "udp", + feature = "uds", ))] #[cfg(not(loom))] $item @@ -128,7 +139,20 @@ macro_rules! cfg_io_blocking { macro_rules! cfg_io_driver { ($($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 )* } @@ -137,7 +161,13 @@ macro_rules! cfg_io_driver { macro_rules! cfg_not_io_driver { ($($item:item)*) => { $( - #[cfg(not(feature = "io-driver"))] + #[cfg(not(any( + feature = "process", + all(unix, feature = "signal"), + feature = "tcp", + feature = "udp", + feature = "uds", + )))] $item )* } @@ -407,13 +437,16 @@ macro_rules! cfg_coop { feature = "blocking", feature = "dns", feature = "fs", - feature = "io-driver", feature = "io-std", feature = "process", feature = "rt-core", + feature = "signal", feature = "sync", feature = "stream", - feature = "time" + feature = "tcp", + feature = "time", + feature = "udp", + feature = "uds", ))] $item )* diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 043371c7..d43666d3 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -138,7 +138,13 @@ impl Builder { /// .unwrap(); /// ``` 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(); #[cfg(feature = "time")] self.enable_time(); -- cgit v1.2.3