summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaiki Endo <te316e89@gmail.com>2020-10-13 06:13:23 +0900
committerGitHub <noreply@github.com>2020-10-12 14:13:23 -0700
commitc90681bd8e629b5fde988b9f5be7b915e5cf8ae5 (patch)
treee70838b9437123dc986ebcfeb8fc0c44ca3fe667
parent24d0a0cfa8916eaef17f40f044d978aa3904d654 (diff)
rt: simplify rt-* features (#2949)
tokio: merge rt-core and rt-util as rt rename rt-threaded to rt-multi-thread tokio-util: rename rt-core to rt Closes #2942
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--tests-build/Cargo.toml2
-rw-r--r--tests-build/tests/fail/macros_core_no_default.stderr2
-rw-r--r--tests-build/tests/macros.rs2
-rw-r--r--tests-integration/Cargo.toml8
-rw-r--r--tests-integration/tests/macros_main.rs2
-rw-r--r--tokio-macros/src/entry.rs24
-rw-r--r--tokio-macros/src/lib.rs12
-rw-r--r--tokio-test/Cargo.toml2
-rw-r--r--tokio-util/Cargo.toml2
-rw-r--r--tokio-util/src/cfg.rs6
-rw-r--r--tokio-util/src/lib.rs2
-rw-r--r--tokio-util/tests/context.rs2
-rw-r--r--tokio/Cargo.toml12
-rw-r--r--tokio/src/blocking.rs6
-rw-r--r--tokio/src/coop.rs6
-rw-r--r--tokio/src/future/block_on.rs4
-rw-r--r--tokio/src/io/driver/mod.rs12
-rw-r--r--tokio/src/lib.rs40
-rw-r--r--tokio/src/loom/std/mod.rs4
-rw-r--r--tokio/src/macros/cfg.rs56
-rw-r--r--tokio/src/macros/mod.rs2
-rw-r--r--tokio/src/park/mod.rs4
-rw-r--r--tokio/src/process/unix/driver.rs2
-rw-r--r--tokio/src/runtime/builder.rs8
-rw-r--r--tokio/src/runtime/context.rs2
-rw-r--r--tokio/src/runtime/enter.rs12
-rw-r--r--tokio/src/runtime/mod.rs30
-rw-r--r--tokio/src/runtime/spawner.rs16
-rw-r--r--tokio/src/runtime/task/core.rs2
-rw-r--r--tokio/src/runtime/task/error.rs2
-rw-r--r--tokio/src/runtime/task/join.rs2
-rw-r--r--tokio/src/runtime/task/mod.rs8
-rw-r--r--tokio/src/signal/unix/driver.rs8
-rw-r--r--tokio/src/sync/mod.rs4
-rw-r--r--tokio/src/sync/notify.rs4
-rw-r--r--tokio/src/task/blocking.rs2
-rw-r--r--tokio/src/task/local.rs8
-rw-r--r--tokio/src/task/mod.rs14
-rw-r--r--tokio/src/task/spawn.rs2
-rw-r--r--tokio/src/task/yield_now.rs2
-rw-r--r--tokio/src/time/clock.rs6
-rw-r--r--tokio/src/time/driver/handle.rs6
-rw-r--r--tokio/src/time/driver/mod.rs2
-rw-r--r--tokio/src/util/linked_list.rs2
-rw-r--r--tokio/src/util/mod.rs9
-rw-r--r--tokio/src/util/slab.rs2
-rw-r--r--tokio/src/util/trace.rs4
48 files changed, 167 insertions, 206 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 756a7677..b6a939ce 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -110,7 +110,7 @@ jobs:
rm -rf tokio/tests
- name: miri
- run: cargo miri test --features rt-core,rt-threaded,rt-util,sync task
+ run: cargo miri test --features rt,rt-multi-thread,sync task
working-directory: tokio
cross:
diff --git a/tests-build/Cargo.toml b/tests-build/Cargo.toml
index e76621b4..299af0cf 100644
--- a/tests-build/Cargo.toml
+++ b/tests-build/Cargo.toml
@@ -7,7 +7,7 @@ publish = false
[features]
full = ["tokio/full"]
-rt-core = ["tokio/rt-core", "tokio/macros"]
+rt = ["tokio/rt", "tokio/macros"]
[dependencies]
tokio = { path = "../tokio", optional = true }
diff --git a/tests-build/tests/fail/macros_core_no_default.stderr b/tests-build/tests/fail/macros_core_no_default.stderr
index a3ae32cd..6b3f8fa6 100644
--- a/tests-build/tests/fail/macros_core_no_default.stderr
+++ b/tests-build/tests/fail/macros_core_no_default.stderr
@@ -1,4 +1,4 @@
-error: The default runtime flavor is `multi_thread`, but the `rt-threaded` feature is disabled.
+error: The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled.
--> $DIR/macros_core_no_default.rs:3:1
|
3 | #[tokio::main]
diff --git a/tests-build/tests/macros.rs b/tests-build/tests/macros.rs
index a12a20ef..048e7f09 100644
--- a/tests-build/tests/macros.rs
+++ b/tests-build/tests/macros.rs
@@ -5,7 +5,7 @@ fn compile_fail_full() {
#[cfg(feature = "full")]
t.compile_fail("tests/fail/macros_invalid_input.rs");
- #[cfg(all(feature = "rt-core", not(feature = "full")))]
+ #[cfg(all(feature = "rt", not(feature = "full")))]
t.compile_fail("tests/fail/macros_core_no_default.rs");
drop(t);
diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml
index c6dd8450..105b9c61 100644
--- a/tests-integration/Cargo.toml
+++ b/tests-integration/Cargo.toml
@@ -8,16 +8,16 @@ publish = false
[features]
full = [
"macros",
- "rt-core",
- "rt-threaded",
+ "rt",
+ "rt-multi-thread",
"tokio/full",
"tokio-test"
]
macros = ["tokio/macros"]
sync = ["tokio/sync"]
-rt-core = ["tokio/rt-core"]
-rt-threaded = ["rt-core", "tokio/rt-threaded"]
+rt = ["tokio/rt"]
+rt-multi-thread = ["rt", "tokio/rt-multi-thread"]
[dependencies]
tokio = { path = "../tokio" }
diff --git a/tests-integration/tests/macros_main.rs b/tests-integration/tests/macros_main.rs
index 868adb0f..efe1ea9b 100644
--- a/tests-integration/tests/macros_main.rs
+++ b/tests-integration/tests/macros_main.rs
@@ -1,4 +1,4 @@
-#![cfg(all(feature = "macros", feature = "rt-core"))]
+#![cfg(all(feature = "macros", feature = "rt"))]
#[tokio::main]
async fn basic_main() -> usize {
diff --git a/tokio-macros/src/entry.rs b/tokio-macros/src/entry.rs
index f3c7c230..8eb184a3 100644
--- a/tokio-macros/src/entry.rs
+++ b/tokio-macros/src/entry.rs
@@ -28,16 +28,16 @@ struct FinalConfig {
}
struct Configuration {
- rt_threaded_available: bool,
+ rt_multi_thread_available: bool,
default_flavor: RuntimeFlavor,
flavor: Option<RuntimeFlavor>,
worker_threads: Option<(usize, Span)>,
}
impl Configuration {
- fn new(is_test: bool, rt_threaded: bool) -> Self {
+ fn new(is_test: bool, rt_multi_thread: bool) -> Self {
Configuration {
- rt_threaded_available: rt_threaded,
+ rt_multi_thread_available: rt_multi_thread,
default_flavor: match is_test {
true => RuntimeFlavor::CurrentThread,
false => RuntimeFlavor::Threaded,
@@ -91,15 +91,15 @@ impl Configuration {
flavor,
worker_threads: None,
}),
- (Threaded, worker_threads) if self.rt_threaded_available => Ok(FinalConfig {
+ (Threaded, worker_threads) if self.rt_multi_thread_available => Ok(FinalConfig {
flavor,
worker_threads: worker_threads.map(|(val, _span)| val),
}),
(Threaded, _) => {
let msg = if self.flavor.is_none() {
- "The default runtime flavor is `multi_thread`, but the `rt-threaded` feature is disabled."
+ "The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled."
} else {
- "The runtime flavor `multi_thread` requires the `rt-threaded` feature."
+ "The runtime flavor `multi_thread` requires the `rt-multi-thread` feature."
};
Err(syn::Error::new(Span::call_site(), msg))
}
@@ -138,7 +138,7 @@ fn parse_knobs(
mut input: syn::ItemFn,
args: syn::AttributeArgs,
is_test: bool,
- rt_threaded: bool,
+ rt_multi_thread: bool,
) -> Result<TokenStream, syn::Error> {
let sig = &mut input.sig;
let body = &input.block;
@@ -157,7 +157,7 @@ fn parse_knobs(
} else {
"tokio::main"
};
- let mut config = Configuration::new(is_test, rt_threaded);
+ let mut config = Configuration::new(is_test, rt_multi_thread);
for arg in args {
match arg {
@@ -256,7 +256,7 @@ fn parse_knobs(
}
#[cfg(not(test))] // Work around for rust-lang/rust#62127
-pub(crate) fn main(args: TokenStream, item: TokenStream, rt_threaded: bool) -> TokenStream {
+pub(crate) fn main(args: TokenStream, item: TokenStream, rt_multi_thread: bool) -> TokenStream {
let input = syn::parse_macro_input!(item as syn::ItemFn);
let args = syn::parse_macro_input!(args as syn::AttributeArgs);
@@ -267,10 +267,10 @@ pub(crate) fn main(args: TokenStream, item: TokenStream, rt_threaded: bool) -> T
.into();
}
- parse_knobs(input, args, false, rt_threaded).unwrap_or_else(|e| e.to_compile_error().into())
+ parse_knobs(input, args, false, rt_multi_thread).unwrap_or_else(|e| e.to_compile_error().into())
}
-pub(crate) fn test(args: TokenStream, item: TokenStream, rt_threaded: bool) -> TokenStream {
+pub(crate) fn test(args: TokenStream, item: TokenStream, rt_multi_thread: bool) -> TokenStream {
let input = syn::parse_macro_input!(item as syn::ItemFn);
let args = syn::parse_macro_input!(args as syn::AttributeArgs);
@@ -290,5 +290,5 @@ pub(crate) fn test(args: TokenStream, item: TokenStream, rt_threaded: bool) -> T
.into();
}
- parse_knobs(input, args, true, rt_threaded).unwrap_or_else(|e| e.to_compile_error().into())
+ parse_knobs(input, args, true, rt_multi_thread).unwrap_or_else(|e| e.to_compile_error().into())
}
diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs
index 1d6f577a..47d780a2 100644
--- a/tokio-macros/src/lib.rs
+++ b/tokio-macros/src/lib.rs
@@ -189,7 +189,7 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream {
/// macro is expanded.
#[proc_macro_attribute]
#[cfg(not(test))] // Work around for rust-lang/rust#62127
-pub fn main_rt_core(args: TokenStream, item: TokenStream) -> TokenStream {
+pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream {
entry::main(args, item, false)
}
@@ -252,19 +252,19 @@ pub fn test(args: TokenStream, item: TokenStream) -> TokenStream {
/// tokio 0.2 crate available as `tokio` in the module where this
/// macro is expanded.
#[proc_macro_attribute]
-pub fn test_rt_core(args: TokenStream, item: TokenStream) -> TokenStream {
+pub fn test_rt(args: TokenStream, item: TokenStream) -> TokenStream {
entry::test(args, item, false)
}
/// Always fails with the error message below.
/// ```text
-/// The #[tokio::main] macro requires rt-core or rt-threaded.
+/// The #[tokio::main] macro requires rt or rt-multi-thread.
/// ```
#[proc_macro_attribute]
pub fn main_fail(_args: TokenStream, _item: TokenStream) -> TokenStream {
syn::Error::new(
proc_macro2::Span::call_site(),
- "The #[tokio::main] macro requires rt-core or rt-threaded.",
+ "The #[tokio::main] macro requires rt or rt-multi-thread.",
)
.to_compile_error()
.into()
@@ -272,13 +272,13 @@ pub fn main_fail(_args: TokenStream, _item: TokenStream) -> TokenStream {
/// Always fails with the error message below.
/// ```text
-/// The #[tokio::test] macro requires rt-core or rt-threaded.
+/// The #[tokio::test] macro requires rt or rt-multi-thread.
/// ```
#[proc_macro_attribute]
pub fn test_fail(_args: TokenStream, _item: TokenStream) -> TokenStream {
syn::Error::new(
proc_macro2::Span::call_site(),
- "The #[tokio::test] macro requires rt-core or rt-threaded.",
+ "The #[tokio::test] macro requires rt or rt-multi-thread.",
)
.to_compile_error()
.into()
diff --git a/tokio-test/Cargo.toml b/tokio-test/Cargo.toml
index 9522fa8d..311d40de 100644
--- a/tokio-test/Cargo.toml
+++ b/tokio-test/Cargo.toml
@@ -21,7 +21,7 @@ categories = ["asynchronous", "testing"]
publish = false
[dependencies]
-tokio = { version = "0.3.0", path = "../tokio", features = ["rt-core", "stream", "sync", "time", "test-util"] }
+tokio = { version = "0.3.0", path = "../tokio", features = ["rt", "stream", "sync", "time", "test-util"] }
bytes = "0.5.0"
futures-core = "0.3.0"
diff --git a/tokio-util/Cargo.toml b/tokio-util/Cargo.toml
index f6007ce2..7a235b58 100644
--- a/tokio-util/Cargo.toml
+++ b/tokio-util/Cargo.toml
@@ -31,7 +31,7 @@ compat = ["futures-io",]
codec = ["tokio/stream"]
time = ["tokio/time","slab"]
io = []
-rt-core = ["tokio/rt-core"]
+rt = ["tokio/rt"]
[dependencies]
tokio = { version = "0.3.0", path = "../tokio" }
diff --git a/tokio-util/src/cfg.rs b/tokio-util/src/cfg.rs
index a848223f..ee423d43 100644
--- a/tokio-util/src/cfg.rs
+++ b/tokio-util/src/cfg.rs
@@ -40,11 +40,11 @@ macro_rules! cfg_io {
}
}
-macro_rules! cfg_rt_core {
+macro_rules! cfg_rt {
($($item:item)*) => {
$(
- #[cfg(feature = "rt-core")]
- #[cfg_attr(docsrs, doc(cfg(feature = "rt-core")))]
+ #[cfg(feature = "rt")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
$item
)*
}
diff --git a/tokio-util/src/lib.rs b/tokio-util/src/lib.rs
index 55fd67eb..10b828ef 100644
--- a/tokio-util/src/lib.rs
+++ b/tokio-util/src/lib.rs
@@ -47,7 +47,7 @@ cfg_io! {
pub mod io;
}
-cfg_rt_core! {
+cfg_rt! {
pub mod context;
}
diff --git a/tokio-util/tests/context.rs b/tokio-util/tests/context.rs
index 852dcd0b..7510f36f 100644
--- a/tokio-util/tests/context.rs
+++ b/tokio-util/tests/context.rs
@@ -1,4 +1,4 @@
-#![cfg(feature = "rt-core")]
+#![cfg(feature = "rt")]
#![warn(rust_2018_idioms)]
use tokio::runtime::Builder;
diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml
index 5b361e6b..6b0c4d8c 100644
--- a/tokio/Cargo.toml
+++ b/tokio/Cargo.toml
@@ -37,9 +37,8 @@ full = [
"macros",
"net",
"process",
- "rt-core",
- "rt-util",
- "rt-threaded",
+ "rt",
+ "rt-multi-thread",
"signal",
"stream",
"sync",
@@ -71,11 +70,10 @@ process = [
"winapi/threadpoollegacyapiset",
]
# Includes basic task execution capabilities
-rt-core = ["slab"]
-rt-util = []
-rt-threaded = [
+rt = ["slab"]
+rt-multi-thread = [
"num_cpus",
- "rt-core",
+ "rt",
]
signal = [
"lazy_static",
diff --git a/tokio/src/blocking.rs b/tokio/src/blocking.rs
index d6ef5915..f88b1db1 100644
--- a/tokio/src/blocking.rs
+++ b/tokio/src/blocking.rs
@@ -1,9 +1,9 @@
-cfg_rt_core! {
+cfg_rt! {
pub(crate) use crate::runtime::spawn_blocking;
pub(crate) use crate::task::JoinHandle;
}
-cfg_not_rt_core! {
+cfg_not_rt! {
use std::fmt;
use std::future::Future;
use std::pin::Pin;
@@ -15,7 +15,7 @@ cfg_not_rt_core! {
R: Send + 'static,
{
assert_send_sync::<JoinHandle<std::cell::Cell<()>>>();
- panic!("requires the `rt-core` Tokio feature flag")
+ panic!("requires the `rt` Tokio feature flag")
}
diff --git a/tokio/src/coop.rs b/tokio/src/coop.rs
index f6cca1c5..980cdf8c 100644
--- a/tokio/src/coop.rs
+++ b/tokio/src/coop.rs
@@ -83,7 +83,7 @@ impl Budget {
}
}
-cfg_rt_threaded! {
+cfg_rt_multi_thread! {
impl Budget {
fn has_remaining(self) -> bool {
self.0.map(|budget| budget > 0).unwrap_or(true)
@@ -122,7 +122,7 @@ fn with_budget<R>(budget: Budget, f: impl FnOnce() -> R) -> R {
})
}
-cfg_rt_threaded! {
+cfg_rt_multi_thread! {
/// Set the current task's budget
pub(crate) fn set(budget: Budget) {
CURRENT.with(|cell| cell.set(budget))
@@ -134,7 +134,7 @@ cfg_rt_threaded! {
}
}
-cfg_rt_core! {
+cfg_rt! {
/// Forcibly remove the budgeting constraints early.
///
/// Returns the remaining budget
diff --git a/tokio/src/future/block_on.rs b/tokio/src/future/block_on.rs
index 9fc7abc6..91f9cc00 100644
--- a/tokio/src/future/block_on.rs
+++ b/tokio/src/future/block_on.rs
@@ -1,13 +1,13 @@
use std::future::Future;
-cfg_rt_core! {
+cfg_rt! {
pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
let mut e = crate::runtime::enter::enter(false);
e.block_on(f).unwrap()
}
}
-cfg_not_rt_core! {
+cfg_not_rt! {
pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
let mut park = crate::park::thread::CachedParkThread::new();
park.block_on(f).unwrap()
diff --git a/tokio/src/io/driver/mod.rs b/tokio/src/io/driver/mod.rs
index 0d4133a5..cd82b26f 100644
--- a/tokio/src/io/driver/mod.rs
+++ b/tokio/src/io/driver/mod.rs
@@ -1,4 +1,4 @@
-#![cfg_attr(not(feature = "rt-core"), allow(dead_code))]
+#![cfg_attr(not(feature = "rt"), allow(dead_code))]
mod ready;
use ready::Ready;
@@ -219,13 +219,13 @@ impl fmt::Debug for Driver {
// ===== impl Handle =====
-cfg_rt_core! {
+cfg_rt! {
impl Handle {
/// Returns a handle to the current reactor
///
/// # Panics
///
- /// This function panics if there is no current reactor set and `rt-core` feature
+ /// This function panics if there is no current reactor set and `rt` feature
/// flag is not enabled.
pub(super) fn current() -> Self {
crate::runtime::context::io_handle()
@@ -234,16 +234,16 @@ cfg_rt_core! {
}
}
-cfg_not_rt_core! {
+cfg_not_rt! {
impl Handle {
/// Returns a handle to the current reactor
///
/// # Panics
///
- /// This function panics if there is no current reactor set, or if the `rt-core`
+ /// This function panics if there is no current reactor set, or if the `rt`
/// feature flag is not enabled.
pub(super) fn current() -> Self {
- panic!("there is no reactor running, must be called from the context of Tokio runtime with `rt-core` enabled.")
+ panic!("there is no reactor running, must be called from the context of Tokio runtime with `rt` enabled.")
}
}
}
diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs
index 92d2c35d..483f13ed 100644
--- a/tokio/src/lib.rs
+++ b/tokio/src/lib.rs
@@ -73,9 +73,9 @@
//! need.
//!
//! - `full`: Enables all Tokio public API features listed below.
-//! - `rt-core`: Enables `tokio::spawn` and the basic (single-threaded) scheduler.
-//! - `rt-threaded`: Enables the heavier, multi-threaded, work-stealing scheduler.
-//! - `rt-util`: Enables non-scheduler utilities.
+//! - `rt-core`: Enables `tokio::spawn`, the basic (current thread) scheduler,
+//! and non-scheduler utilities.
+//! - `rt-multi-thread`: Enables the heavier, multi-threaded, work-stealing scheduler.
//! - `io-util`: Enables the IO based `Ext` traits.
//! - `io-std`: Enable `Stdout`, `Stdin` and `Stderr` types.
//! - `net`: Enables `tokio::net` types such as `TcpStream`, `UnixStream` and `UdpSocket`.
@@ -134,7 +134,7 @@
//! needs to `tokio::spawn` and use a `TcpStream`.
//!
//! ```toml
-//! tokio = { version = "0.2", features = ["rt-core", "net"] }
+//! tokio = { version = "0.2", features = ["rt", "net"] }
//! ```
//!
//! ## Working With Tasks
@@ -148,7 +148,7 @@
//! * Functions for [running blocking operations][blocking] in an asynchronous
//! task context.
//!
-//! The [`tokio::task`] module is present only when the "rt-core" feature flag
+//! The [`tokio::task`] module is present only when the "rt" feature flag
//! is enabled.
//!
//! [tasks]: task/index.html#what-are-tasks
@@ -196,9 +196,9 @@
//! and managing runtimes. You should use that module if the `#[tokio::main]` macro doesn't
//! provide the functionality you need.
//!
-//! Using the runtime requires the "rt-core" or "rt-threaded" feature flags, to
-//! enable the basic [single-threaded scheduler][rt-core] and the [thread-pool
-//! scheduler][rt-threaded], respectively. See the [`runtime` module
+//! Using the runtime requires the "rt" or "rt-multi-thread" feature flags, to
+//! enable the basic [single-threaded scheduler][rt] and the [thread-pool
+//! scheduler][rt-multi-thread], respectively. See the [`runtime` module
//! documentation][rt-features] for details. In addition, the "macros" feature
//! flag enables the `#[tokio::main]` and `#[tokio::test]` attributes.
//!
@@ -206,8 +206,8 @@
//! [`tokio::runtime`]: crate::runtime
//! [`Builder`]: crate::runtime::Builder
//! [`Runtime`]: crate::runtime::Runtime
-//! [rt-core]: runtime/index.html#basic-scheduler
-//! [rt-threaded]: runtime/index.html#threaded-scheduler
+//! [rt]: runtime/index.html#basic-scheduler
+//! [rt-multi-thread]: runtime/index.html#threaded-scheduler
//! [rt-features]: runtime/index.html#runtime-scheduler
//!
//! ## CPU-bound tasks and blocking code
@@ -362,11 +362,9 @@ cfg_process! {
#[cfg(any(feature = "dns", feature = "fs", feature = "io-std"))]
mod blocking;
-cfg_rt_core! {
+cfg_rt! {
pub mod runtime;
}
-#[cfg(all(not(feature = "rt-core"), feature = "rt-util"))]
-mod runtime;
pub(crate) mod coop;
@@ -393,7 +391,7 @@ cfg_not_sync! {
}
pub mod task;
-cfg_rt_core! {
+cfg_rt! {
pub use task::spawn;
}
@@ -410,8 +408,8 @@ cfg_macros! {
#[doc(hidden)]
pub use tokio_macros::select_priv_declare_output_enum;
- doc_rt_core! {
- cfg_rt_threaded! {
+ cfg_rt! {
+ cfg_rt_multi_thread! {
// This is the docs.rs case (with all features) so make sure macros
// is included in doc(cfg).
@@ -423,15 +421,15 @@ cfg_macros! {
pub use tokio_macros::test;
}
- cfg_not_rt_threaded! {
+ cfg_not_rt_multi_thread! {
#[cfg(not(test))] // Work around for rust-lang/rust#62127
- pub use tokio_macros::main_rt_core as main;
- pub use tokio_macros::test_rt_core as test;
+ pub use tokio_macros::main_rt as main;
+ pub use tokio_macros::test_rt as test;
}
}
- // Always fail if rt-core is not enabled.
- cfg_not_rt_core! {
+ // Always fail if rt is not enabled.
+ cfg_not_rt! {
#[cfg(not(test))]
pub use tokio_macros::main_fail as main;
pub use tokio_macros::test_fail as test;
diff --git a/tokio/src/loom/std/mod.rs b/tokio/src/loom/std/mod.rs
index fc32fc9f..95252868 100644
--- a/tokio/src/loom/std/mod.rs
+++ b/tokio/src/loom/std/mod.rs
@@ -79,12 +79,12 @@ pub(crate) mod sync {
}
pub(crate) mod sys {
- #[cfg(feature = "rt-threaded")]
+ #[cfg(feature = "rt-multi-thread")]
pub(crate) fn num_cpus() -> usize {
usize::max(1, num_cpus::get())
}
- #[cfg(not(feature = "rt-threaded"))]
+ #[cfg(not(feature = "rt-multi-thread"))]
pub(crate) fn num_cpus() -> usize {
1
}
diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs
index 849fb42b..fedef7ad 100644
--- a/tokio/src/macros/cfg.rs
+++ b/tokio/src/macros/cfg.rs
@@ -8,7 +8,7 @@ macro_rules! cfg_block_on {
feature = "fs",
feature = "dns",
feature = "io-std",
- feature = "rt-core",
+ feature = "rt",
))]
$item
)*
@@ -22,7 +22,7 @@ macro_rules! cfg_atomic_waker_impl {
#[cfg(any(
feature = "net",
feature = "process",
- feature = "rt-util",
+ feature = "rt",
feature = "signal",
feature = "time",
))]
@@ -251,64 +251,35 @@ macro_rules! cfg_not_sync {
}
}
-macro_rules! cfg_rt_core {
+macro_rules! cfg_rt {
($($item:item)*) => {
$(
- #[cfg(feature = "rt-core")]
+ #[cfg(feature = "rt")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
$item
)*
}
}
-macro_rules! cfg_task {
+macro_rules! cfg_not_rt {
($($item:item)*) => {
- $(
- #[cfg(any(feature = "rt-core", feature = "rt-util"))]
- #[cfg_attr(docsrs, doc(cfg(any(feature = "rt-core", feature = "rt-util"))))]
- $item
- )*
- }
-}