Skip to content

Commit

Permalink
chore: remove internal io-driver cargo feature (#2881)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetkov committed Sep 24, 2020
1 parent ffa5bdb commit 56acde0
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 5 additions & 6 deletions tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -73,20 +72,20 @@ rt-threaded = [
"rt-core",
]
signal = [
"io-driver",
"lazy_static",
"libc",
"mio",
"mio-uds",
"signal-hook-registry",
"winapi/consoleapi",
]
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 }
Expand Down
9 changes: 8 additions & 1 deletion tokio/src/loom/std/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
47 changes: 40 additions & 7 deletions tokio/src/macros/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)*
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
)*
}
Expand All @@ -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
)*
}
Expand Down Expand Up @@ -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
)*
Expand Down
8 changes: 7 additions & 1 deletion tokio/src/runtime/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 56acde0

Please sign in to comment.