Skip to content

Commit 8935088

Browse files
taiki-ecramertj
authored andcommitted
Add executor feature
1 parent 812ce0a commit 8935088

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

.travis.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,27 @@ matrix:
143143
--no-default-features
144144
--features async-await
145145

146-
- name: cargo check (sub crates)
146+
- name: cargo check (features)
147147
rust: nightly
148148
script:
149149
- cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml
150150

151+
# futures
152+
# Check default-features, all-features
153+
- cargo check --manifest-path futures/Cargo.toml
154+
- cargo check --manifest-path futures/Cargo.toml --all-features
155+
# Check each features
156+
- cargo check --manifest-path futures/Cargo.toml --features async-await
157+
- cargo check --manifest-path futures/Cargo.toml --features compat
158+
- cargo check --manifest-path futures/Cargo.toml --features io-compat
159+
- cargo check --manifest-path futures/Cargo.toml --features read-initializer,unstable
160+
- cargo check --manifest-path futures/Cargo.toml --features bilock,unstable
161+
# Check each features with --no-default-features
162+
- cargo check --manifest-path futures/Cargo.toml --no-default-features --features async-await
163+
- cargo check --manifest-path futures/Cargo.toml --no-default-features --features compat
164+
- cargo check --manifest-path futures/Cargo.toml --no-default-features --features io-compat
165+
- cargo check --manifest-path futures/Cargo.toml --no-default-features --features executor
166+
151167
# futures-io
152168
# Check default-features, all-features
153169
- cargo check --manifest-path futures-io/Cargo.toml
@@ -189,6 +205,8 @@ matrix:
189205
- cargo check --manifest-path futures-executor/Cargo.toml --all-features
190206
# Check each features
191207
- cargo check --manifest-path futures-executor/Cargo.toml --features thread-pool
208+
# Check each features with --no-default-features
209+
- cargo check --manifest-path futures-executor/Cargo.toml --no-default-features --features thread-pool
192210

193211
- name: cargo doc
194212
rust: nightly

futures-executor/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ name = "futures_executor"
1717
[features]
1818
default = ["std"]
1919
std = ["futures-core-preview/std", "futures-util-preview/std"]
20-
thread-pool = ["num_cpus"]
20+
thread-pool = ["std", "num_cpus"]
2121

2222
[dependencies]
2323
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.19", default-features = false }

futures/Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ travis-ci = { repository = "rust-lang-nursery/futures-rs" }
2424
[dependencies]
2525
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.19", default-features = false }
2626
futures-channel-preview = { path = "../futures-channel", version = "=0.3.0-alpha.19", default-features = false, features = ["sink"] }
27-
futures-executor-preview = { path = "../futures-executor", version = "=0.3.0-alpha.19", default-features = false }
27+
futures-executor-preview = { path = "../futures-executor", version = "=0.3.0-alpha.19", default-features = false, optional = true }
2828
futures-io-preview = { path = "../futures-io", version = "=0.3.0-alpha.19", default-features = false }
2929
futures-sink-preview = { path = "../futures-sink", version = "=0.3.0-alpha.19", default-features = false }
3030
futures-util-preview = { path = "../futures-util", version = "=0.3.0-alpha.19", default-features = false, features = ["sink"] }
@@ -36,13 +36,14 @@ tokio = "0.1.11"
3636
assert_matches = "1.3.0"
3737

3838
[features]
39-
default = ["std"]
40-
std = ["alloc", "futures-core-preview/std", "futures-executor-preview/std", "futures-io-preview/std", "futures-sink-preview/std", "futures-util-preview/std", "futures-util-preview/io", "futures-util-preview/channel"]
39+
default = ["std", "executor"]
40+
std = ["alloc", "futures-core-preview/std", "futures-io-preview/std", "futures-sink-preview/std", "futures-util-preview/std", "futures-util-preview/io", "futures-util-preview/channel"]
4141
alloc = ["futures-core-preview/alloc", "futures-sink-preview/alloc", "futures-channel-preview/alloc", "futures-util-preview/alloc"]
4242
async-await = ["futures-util-preview/async-await", "futures-util-preview/async-await-macro"]
4343
compat = ["std", "futures-util-preview/compat"]
4444
io-compat = ["compat", "futures-util-preview/io-compat"]
45-
thread-pool = ["futures-executor-preview/thread-pool"]
45+
executor = ["std", "futures-executor-preview/std"]
46+
thread-pool = ["executor", "futures-executor-preview/thread-pool"]
4647

4748
# Unstable features
4849
# These features are outside of the normal semver guarantees and require the

futures/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ pub mod compat {
115115
};
116116
}
117117

118-
#[cfg(feature = "std")]
118+
#[cfg(feature = "executor")]
119119
pub mod executor {
120120
//! Task execution.
121121
//!
122122
//! All asynchronous computation occurs within an executor, which is
123123
//! capable of spawning futures as tasks. This module provides several
124124
//! built-in executors, as well as tools for building your own.
125125
//!
126-
//! This module is only available when the `std` feature of this
126+
//! This module is only available when the `executor` feature of this
127127
//! library is activated, and it is activated by default.
128128
//!
129129
//! # Using a thread pool (M:N task scheduling)
@@ -134,7 +134,7 @@ pub mod executor {
134134
//! than threads). Tasks spawned onto the pool with the
135135
//! [`spawn_ok()`](crate::executor::ThreadPool::spawn_ok)
136136
//! function will run on ambiently on the created threads.
137-
//!
137+
//!
138138
//! # Spawning additional tasks
139139
//!
140140
//! Tasks can be spawned onto a spawner by calling its

0 commit comments

Comments
 (0)