tokio: use cargo feature for taskdump support instead of cfg (#7655)

Signed-off-by: ADD-SP <[email protected]>
Co-authored-by: Alice Ryhl <[email protected]>
This commit is contained in:
Qi
2025-10-10 11:31:41 +08:00
committed by GitHub
co-authored by Alice Ryhl
parent ad6f618952
commit d1f1499f63
24 changed files with 111 additions and 96 deletions
+9 -4
View File
@@ -29,9 +29,12 @@ task:
# Free the disk space before the next build, # Free the disk space before the next build,
# otherwise cirrus-ci complains about "No space left on device". # otherwise cirrus-ci complains about "No space left on device".
- cargo clean - cargo clean
# Enable all unstable features, including io_uring, because it supports # Enable all unstable features except `taskdump`, which is Linux-only.
# x86_64 FreeBSD. - |
- RUSTFLAGS="$RUSTFLAGS --cfg tokio_unstable" RUSTDOCFLAGS="$RUSTDOCFLAGS --cfg tokio_unstable" cargo test --all --all-features RUSTFLAGS="$RUSTFLAGS --cfg tokio_unstable" \
RUSTDOCFLAGS="$RUSTDOCFLAGS --cfg tokio_unstable" \
cargo test \
--features $TOKIO_STABLE_FEATURES,io-uring,tracing
task: task:
name: FreeBSD docs name: FreeBSD docs
@@ -48,7 +51,9 @@ task:
rustc --version rustc --version
test_script: test_script:
- . $HOME/.cargo/env - . $HOME/.cargo/env
- cargo doc --lib --no-deps --all-features --document-private-items # We use `--features $TOKIO_STABLE_FEATURES,io-uring,tracing` instead of
# `--all-features` to exclude `taskdump`, which is Linux-only.
- cargo doc --lib --no-deps --features $TOKIO_STABLE_FEATURES,io-uring,tracing --document-private-items
task: task:
name: FreeBSD 32-bit name: FreeBSD 32-bit
+59 -49
View File
@@ -309,17 +309,14 @@ jobs:
- name: test tokio full --cfg unstable --cfg taskdump - name: test tokio full --cfg unstable --cfg taskdump
run: | run: |
set -euxo pipefail set -euxo pipefail
# taskdump is an unstable feature, but it can only be enabled cargo nextest run --features $TOKIO_STABLE_FEATURES,taskdump
# by --cfg tokio_taskdump, not by a feature flag, so we can
# use $TOKIO_STABLE_FEATURES here.
cargo nextest run --features $TOKIO_STABLE_FEATURES
cargo test --doc --features $TOKIO_STABLE_FEATURES cargo test --doc --features $TOKIO_STABLE_FEATURES
working-directory: tokio working-directory: tokio
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
# in order to run doctests for unstable features, we must also pass # in order to run doctests for unstable features, we must also pass
# the unstable cfg to RustDoc # the unstable cfg to RustDoc
RUSTDOCFLAGS: --cfg tokio_unstable --cfg tokio_taskdump RUSTDOCFLAGS: --cfg tokio_unstable
check-unstable-mt-counters: check-unstable-mt-counters:
name: check tokio full --internal-mt-counters name: check tokio full --internal-mt-counters
@@ -484,7 +481,7 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
# We don't use --all-features since io-uring will be enabled and is not supported on those targets. # We don't use --all-features since io-uring will be enabled and is not supported on those targets.
- run: cargo check --workspace --features full,test-util --target ${{ matrix.target }} - run: cargo check --workspace --features $TOKIO_STABLE_FEATURES --target ${{ matrix.target }}
env: env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
@@ -496,8 +493,9 @@ jobs:
matrix: matrix:
target: target:
- name: x86_64-unknown-haiku - name: x86_64-unknown-haiku
exclude_features: "taskdump" # taskdump is only available on Linux
- name: armv7-sony-vita-newlibeabihf - name: armv7-sony-vita-newlibeabihf
exclude_features: "process,signal,rt-process-signal,full" exclude_features: "process,signal,rt-process-signal,full,taskdump"
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
@@ -522,14 +520,14 @@ jobs:
include: include:
- target: i686-unknown-linux-gnu - target: i686-unknown-linux-gnu
os: ubuntu-latest os: ubuntu-latest
rustflags: --cfg tokio_taskdump extra_features: "taskdump"
- target: armv5te-unknown-linux-gnueabi - target: armv5te-unknown-linux-gnueabi
os: ubuntu-latest os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf - target: armv7-unknown-linux-gnueabihf
os: ubuntu-24.04-arm os: ubuntu-24.04-arm
- target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm os: ubuntu-24.04-arm
rustflags: --cfg tokio_taskdump extra_features: "io-uring,taskdump"
- target: aarch64-pc-windows-msvc - target: aarch64-pc-windows-msvc
os: windows-11-arm os: windows-11-arm
steps: steps:
@@ -554,13 +552,15 @@ jobs:
- name: Tests run with all features (including parking_lot) - name: Tests run with all features (including parking_lot)
run: | run: |
set -euxo pipefail set -euxo pipefail
# We use `--features "full,test-util"` instead of `--all-features` since # We use `--features "$TOKIO_STABLE_FEATURES"` instead of `--all-features` since
# `--all-features` includes `io_uring`, which is not available on all targets. # `--all-features` includes `io_uring` and `taskdump`,
cargo nextest run -p tokio --features full,test-util --target ${{ matrix.target }} # which is not available on all targets.
cargo test --doc -p tokio --features full,test-util --target ${{ matrix.target }} cargo nextest run -p tokio --features $TOKIO_STABLE_FEATURES,${{ matrix.extra_features }} --target ${{ matrix.target }}
cargo test --doc -p tokio --features $TOKIO_STABLE_FEATURES,${{ matrix.extra_features }} --target ${{ matrix.target }}
env: env:
RUST_TEST_THREADS: 1 RUST_TEST_THREADS: 1
RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_tuning_tests ${{ matrix.rustflags }} RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_tuning_tests
RUSTDOCFLAGS: --cfg tokio_unstable -Dwarnings
cross-test-without-parking_lot: cross-test-without-parking_lot:
needs: basics needs: basics
@@ -570,14 +570,14 @@ jobs:
include: include:
- target: i686-unknown-linux-gnu - target: i686-unknown-linux-gnu
os: ubuntu-latest os: ubuntu-latest
rustflags: --cfg tokio_taskdump extra_features: "taskdump"
- target: armv5te-unknown-linux-gnueabi - target: armv5te-unknown-linux-gnueabi
os: ubuntu-latest os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf - target: armv7-unknown-linux-gnueabihf
os: ubuntu-24.04-arm os: ubuntu-24.04-arm
- target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm os: ubuntu-24.04-arm
rustflags: --cfg tokio_taskdump extra_features: "io-uring,taskdump"
- target: aarch64-pc-windows-msvc - target: aarch64-pc-windows-msvc
os: windows-11-arm os: windows-11-arm
steps: steps:
@@ -606,13 +606,15 @@ jobs:
- name: Tests run with all features (without parking_lot) - name: Tests run with all features (without parking_lot)
run: | run: |
set -euxo pipefail set -euxo pipefail
# We use `--features "full,test-util"` instead of `--all-features` since # We use `--features "$TOKIO_STABLE_FEATURES"` instead of `--all-features` since
# `--all-features` includes `io_uring`, which is not available on all targets. # `--all-features` includes `io_uring` and `taskdump`,
cargo nextest run -p tokio --features full,test-util --target ${{ matrix.target }} # which is not available on all targets.
cargo test --doc -p tokio --features full,test-util --target ${{ matrix.target }} cargo nextest run -p tokio --features $TOKIO_STABLE_FEATURES,${{ matrix.extra_features }} --target ${{ matrix.target }}
cargo test --doc -p tokio --features $TOKIO_STABLE_FEATURES,${{ matrix.extra_features }} --target ${{ matrix.target }}
env: env:
RUST_TEST_THREADS: 1 RUST_TEST_THREADS: 1
RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_parking_lot --cfg tokio_no_tuning_tests ${{ matrix.rustflags }} RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_parking_lot --cfg tokio_no_tuning_tests ${{ matrix.rustflags }}
RUSTDOCFLAGS: --cfg tokio_unstable -Dwarnings
# See https://github.com/tokio-rs/tokio/issues/5187 # See https://github.com/tokio-rs/tokio/issues/5187
no-atomic-u64-test: no-atomic-u64-test:
@@ -640,13 +642,11 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: test tokio --all-features - name: test tokio --all-features
run: | run: |
# We use `--features "full,test-util"` instead of `--all-features` since cargo nextest run -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --features $TOKIO_STABLE_FEATURES,taskdump
# `--all-features` includes `io_uring`, which is not available on all targets. cargo test --doc -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --features $TOKIO_STABLE_FEATURES,taskdump
cargo nextest run -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --features full,test-util
cargo test --doc -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --features full,test-util
env: env:
RUST_TEST_THREADS: 1 RUST_TEST_THREADS: 1
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_tuning_tests RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_tuning_tests
no-atomic-u64-check: no-atomic-u64-check:
name: Check tokio --feature-powerset --depth 2 on i686-unknown-linux-gnu without AtomicU64 name: Check tokio --feature-powerset --depth 2 on i686-unknown-linux-gnu without AtomicU64
@@ -672,18 +672,24 @@ jobs:
# We use `--skip io-uring` since io-uring crate doesn't provide a binding for the i686 target. # We use `--skip io-uring` since io-uring crate doesn't provide a binding for the i686 target.
run: cargo hack check -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --feature-powerset --skip io-uring --depth 2 --keep-going run: cargo hack check -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --feature-powerset --skip io-uring --depth 2 --keep-going
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
features: features:
name: features ${{ matrix.name }} name: features exclude ${{ matrix.name }}
needs: basics needs: basics
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
include: include:
- { name: "", rustflags: "", exclude_features: "io-uring" } - name: ""
- { name: "--unstable", rustflags: "--cfg tokio_unstable -Dwarnings", exclude_features: "" } rustflags: ""
- { name: "--unstable --taskdump", rustflags: "--cfg tokio_unstable -Dwarnings --cfg tokio_taskdump", exclude_features: "" } exclude_features: "io-uring,taskdump"
- name: "--unstable"
rustflags: "--cfg tokio_unstable -Dwarnings"
exclude_features: "io-uring,taskdump"
- name: "--unstable io-uring,taskdump"
rustflags: "--cfg tokio_unstable -Dwarnings"
exclude_features: ""
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
@@ -749,7 +755,7 @@ jobs:
cargo hack check -p tokio-macros -p tokio-stream -p tokio-util -p tokio-test --all-features --ignore-private cargo hack check -p tokio-macros -p tokio-stream -p tokio-util -p tokio-test --all-features --ignore-private
- name: "check --all-features --unstable -Z minimal-versions" - name: "check --all-features --unstable -Z minimal-versions"
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
run: | run: |
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update` # Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
# from determining minimal versions based on dev-dependencies. # from determining minimal versions based on dev-dependencies.
@@ -795,7 +801,7 @@ jobs:
- name: "clippy --all --all-features --unstable" - name: "clippy --all --all-features --unstable"
run: cargo clippy --all --tests --no-deps --all-features run: cargo clippy --all --tests --no-deps --all-features
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
docs: docs:
name: docs name: docs
@@ -804,9 +810,9 @@ jobs:
matrix: matrix:
run: run:
- os: windows-latest - os: windows-latest
extra_features: "tracing"
- os: ubuntu-latest - os: ubuntu-latest
RUSTFLAGS: --cfg tokio_taskdump extra_features: "tracing,io-uring,taskdump"
RUSTDOCFLAGS: --cfg tokio_taskdump
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
@@ -816,11 +822,10 @@ jobs:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: "doc --lib --all-features" - name: "doc --lib --all-features"
run: | run: cargo doc --lib --no-deps --document-private-items --features $TOKIO_STABLE_FEATURES,${{ matrix.run.extra_features }}
cargo doc --lib --no-deps --all-features --document-private-items
env: env:
RUSTFLAGS: --cfg docsrs --cfg tokio_unstable ${{ matrix.run.RUSTFLAGS }} RUSTFLAGS: --cfg docsrs --cfg tokio_unstable
RUSTDOCFLAGS: --cfg docsrs --cfg tokio_unstable -Dwarnings ${{ matrix.run.RUSTDOCFLAGS }} RUSTDOCFLAGS: --cfg docsrs --cfg tokio_unstable -Dwarnings
loom-compile: loom-compile:
name: build loom tests name: build loom tests
@@ -1083,26 +1088,31 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: include:
- windows-latest - os: windows-latest
- ubuntu-latest # Windows neither supports io-uring nor taskdump.
rust: extra_features: "tracing"
# `check-external-types` requires a specific Rust nightly version. See - os: ubuntu-latest
# the README for details: https://github.com/awslabs/cargo-check-external-types # includes all unstable features.
- nightly-2024-06-30 extra_features: "tracing,io-uring,taskdump"
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
- name: Install Rust ${{ matrix.rust }} - name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ matrix.rust }} # `check-external-types` requires a specific Rust nightly version. See
# the README for details: https://github.com/awslabs/cargo-check-external-types
toolchain: nightly-2025-08-06
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Install cargo-check-external-types - name: Install cargo-check-external-types
uses: taiki-e/cache-cargo-install-action@v1 uses: taiki-e/cache-cargo-install-action@v1
with: with:
tool: cargo-check-external-types@0.1.13 tool: cargo-check-external-types@0.3.0
- name: check-external-types - name: check-external-types
run: cargo check-external-types --features $TOKIO_STABLE_FEATURES env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings
RUSTDOCFLAGS: --cfg tokio_unstable
run: cargo check-external-types --features $TOKIO_STABLE_FEATURES,${{ matrix.extra_features }}
working-directory: tokio working-directory: tokio
check-fuzzing: check-fuzzing:
-1
View File
@@ -27,7 +27,6 @@ unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(tokio_internal_mt_counters)', 'cfg(tokio_internal_mt_counters)',
'cfg(tokio_no_parking_lot)', 'cfg(tokio_no_parking_lot)',
'cfg(tokio_no_tuning_tests)', 'cfg(tokio_no_tuning_tests)',
'cfg(tokio_taskdump)',
'cfg(tokio_unstable)', 'cfg(tokio_unstable)',
'cfg(target_os, values("cygwin"))', 'cfg(target_os, values("cygwin"))',
] } ] }
+3
View File
@@ -24,6 +24,9 @@ httparse = "1.0"
httpdate = "1.0" httpdate = "1.0"
once_cell = "1.5.2" once_cell = "1.5.2"
[target.'cfg(all(tokio_unstable, target_os = "linux"))'.dev-dependencies]
tokio = { version = "1.0.0", path = "../tokio", features = ["full", "tracing", "taskdump"] }
[target.'cfg(windows)'.dev-dependencies.windows-sys] [target.'cfg(windows)'.dev-dependencies.windows-sys]
version = "0.61" version = "0.61"
-2
View File
@@ -4,7 +4,6 @@
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump,
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))] ))]
@@ -82,7 +81,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(not(all( #[cfg(not(all(
tokio_unstable, tokio_unstable,
tokio_taskdump,
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
)))] )))]
+4 -2
View File
@@ -17,9 +17,11 @@
RUSTDOCFLAGS=""" RUSTDOCFLAGS="""
--cfg docsrs \ --cfg docsrs \
--cfg tokio_unstable \ --cfg tokio_unstable \
--cfg tokio_taskdump \
""" """
RUSTFLAGS="--cfg tokio_unstable --cfg tokio_taskdump --cfg docsrs" RUSTFLAGS="""
--cfg docsrs \
--cfg tokio_unstable
"""
[[redirects]] [[redirects]]
from = "/" from = "/"
+6 -8
View File
@@ -86,6 +86,8 @@ test-util = ["rt", "sync", "time"]
time = [] time = []
# Unstable feature. Requires `--cfg tokio_unstable` to enable. # Unstable feature. Requires `--cfg tokio_unstable` to enable.
io-uring = ["dep:io-uring", "libc", "mio/os-poll", "mio/os-ext", "dep:slab"] io-uring = ["dep:io-uring", "libc", "mio/os-poll", "mio/os-ext", "dep:slab"]
# Unstable feature. Requires `--cfg tokio_unstable` to enable.
taskdump = ["dep:backtrace"]
[dependencies] [dependencies]
tokio-macros = { version = "~2.5.0", path = "../tokio-macros", optional = true } tokio-macros = { version = "~2.5.0", path = "../tokio-macros", optional = true }
@@ -112,11 +114,7 @@ io-uring = { version = "0.7.6", default-features = false, optional = true }
libc = { version = "0.2.168", optional = true } libc = { version = "0.2.168", optional = true }
mio = { version = "1.0.1", default-features = false, features = ["os-poll", "os-ext"], optional = true } mio = { version = "1.0.1", default-features = false, features = ["os-poll", "os-ext"], optional = true }
slab = { version = "0.4.9", optional = true } slab = { version = "0.4.9", optional = true }
backtrace = { version = "0.3.58", optional = true }
# Currently unstable. The API exposed by these features may be broken at any time.
# Requires `--cfg tokio_unstable` to enable.
[target.'cfg(tokio_taskdump)'.dependencies]
backtrace = { version = "0.3.58" }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = { version = "0.2.168", optional = true } libc = { version = "0.2.168", optional = true }
@@ -169,10 +167,10 @@ tracing-mock = "= 0.1.0-beta.1"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
# enable unstable features in the documentation # enable unstable features in the documentation
rustdoc-args = ["--cfg", "docsrs", "--cfg", "tokio_unstable", "--cfg", "tokio_taskdump"] rustdoc-args = ["--cfg", "docsrs", "--cfg", "tokio_unstable"]
# it's necessary to _also_ pass `--cfg tokio_unstable` and `--cfg tokio_taskdump` # it's necessary to _also_ pass `--cfg tokio_unstable`
# to rustc, or else dependencies will not be enabled, and the docs build will fail. # to rustc, or else dependencies will not be enabled, and the docs build will fail.
rustc-args = ["--cfg", "tokio_unstable", "--cfg", "tokio_taskdump"] rustc-args = ["--cfg", "tokio_unstable"]
[package.metadata.playground] [package.metadata.playground]
features = ["full", "test-util"] features = ["full", "test-util"]
+4 -4
View File
@@ -483,11 +483,11 @@ compile_error!("Only features sync,macros,io-util,rt,time are supported on wasm.
#[cfg(all(not(tokio_unstable), feature = "io-uring"))] #[cfg(all(not(tokio_unstable), feature = "io-uring"))]
compile_error!("The `io-uring` feature requires `--cfg tokio_unstable`."); compile_error!("The `io-uring` feature requires `--cfg tokio_unstable`.");
#[cfg(all(not(tokio_unstable), tokio_taskdump))] #[cfg(all(not(tokio_unstable), feature = "taskdump"))]
compile_error!("The `tokio_taskdump` feature requires `--cfg tokio_unstable`."); compile_error!("The `taskdump` feature requires `--cfg tokio_unstable`.");
#[cfg(all( #[cfg(all(
tokio_taskdump, feature = "taskdump",
not(doc), not(doc),
not(all( not(all(
target_os = "linux", target_os = "linux",
@@ -495,7 +495,7 @@ compile_error!("The `tokio_taskdump` feature requires `--cfg tokio_unstable`.");
)) ))
))] ))]
compile_error!( compile_error!(
"The `tokio_taskdump` feature is only currently supported on \ "The `taskdump` feature is only currently supported on \
linux, on `aarch64`, `x86` and `x86_64`." linux, on `aarch64`, `x86` and `x86_64`."
); );
+2 -2
View File
@@ -499,7 +499,7 @@ macro_rules! cfg_taskdump {
$( $(
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any( any(
@@ -518,7 +518,7 @@ macro_rules! cfg_not_taskdump {
$( $(
#[cfg(not(all( #[cfg(not(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any( any(
+2 -2
View File
@@ -66,7 +66,7 @@ struct Context {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
@@ -107,7 +107,7 @@ tokio_thread_local! {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any( any(
+7 -7
View File
@@ -352,7 +352,7 @@ impl Handle {
fn block_on_inner<F: Future>(&self, future: F, _meta: SpawnMeta<'_>) -> F::Output { fn block_on_inner<F: Future>(&self, future: F, _meta: SpawnMeta<'_>) -> F::Output {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
@@ -379,7 +379,7 @@ impl Handle {
let id = crate::runtime::task::Id::next(); let id = crate::runtime::task::Id::next();
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
@@ -404,7 +404,7 @@ impl Handle {
let id = crate::runtime::task::Id::next(); let id = crate::runtime::task::Id::next();
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
@@ -559,19 +559,19 @@ cfg_taskdump! {
/// ## Unstable Features /// ## Unstable Features
/// ///
/// This functionality is **unstable**, and requires both the /// This functionality is **unstable**, and requires both the
/// `tokio_unstable` and `tokio_taskdump` `cfg` flags to be set. /// `--cfg tokio_unstable` and cargo feature `taskdump` to be set.
/// ///
/// You can do this by setting the `RUSTFLAGS` environment variable /// You can do this by setting the `RUSTFLAGS` environment variable
/// before invoking `cargo`; e.g.: /// before invoking `cargo`; e.g.:
/// ```bash /// ```bash
/// RUSTFLAGS="--cfg tokio_unstable --cfg tokio_taskdump" cargo run --example dump /// RUSTFLAGS="--cfg tokio_unstable cargo run --example dump
/// ``` /// ```
/// ///
/// Or by [configuring][cargo-config] `rustflags` in /// Or by [configuring][cargo-config] `rustflags` in
/// `.cargo/config.toml`: /// `.cargo/config.toml`:
/// ```text /// ```text
/// [build] /// [build]
/// rustflags = ["--cfg", "tokio_unstable", "--cfg", "tokio_taskdump"] /// rustflags = ["--cfg", "tokio_unstable"]
/// ``` /// ```
/// ///
/// [cargo-config]: /// [cargo-config]:
@@ -591,7 +591,7 @@ cfg_taskdump! {
/// ///
/// ## Performance /// ## Performance
/// ///
/// Although enabling the `tokio_taskdump` feature imposes virtually no /// Although enabling the `taskdump` feature imposes virtually no
/// additional runtime overhead, actually calling `Handle::dump` is /// additional runtime overhead, actually calling `Handle::dump` is
/// expensive. The runtime must synchronize and pause its workers, then /// expensive. The runtime must synchronize and pause its workers, then
/// re-poll every task in a special tracing mode. Avoid requesting dumps /// re-poll every task in a special tracing mode. Avoid requesting dumps
+1 -1
View File
@@ -232,7 +232,7 @@ impl LocalRuntime {
fn block_on_inner<F: Future>(&self, future: F, _meta: SpawnMeta<'_>) -> F::Output { fn block_on_inner<F: Future>(&self, future: F, _meta: SpawnMeta<'_>) -> F::Output {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
+1 -1
View File
@@ -347,7 +347,7 @@ impl Runtime {
fn block_on_inner<F: Future>(&self, future: F, _meta: SpawnMeta<'_>) -> F::Output { fn block_on_inner<F: Future>(&self, future: F, _meta: SpawnMeta<'_>) -> F::Output {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
@@ -350,7 +350,7 @@ impl Core {
} }
} }
#[cfg(tokio_taskdump)] #[cfg(feature = "taskdump")]
fn wake_deferred_tasks_and_free(context: &Context) { fn wake_deferred_tasks_and_free(context: &Context) {
let wakers = context.defer.take_deferred(); let wakers = context.defer.take_deferred();
for waker in wakers { for waker in wakers {
@@ -509,7 +509,7 @@ impl Handle {
/// Capture a snapshot of this runtime's state. /// Capture a snapshot of this runtime's state.
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))] ))]
+1 -1
View File
@@ -35,7 +35,7 @@ impl Defer {
} }
} }
#[cfg(tokio_taskdump)] #[cfg(feature = "taskdump")]
pub(crate) fn take_deferred(&self) -> Vec<Waker> { pub(crate) fn take_deferred(&self) -> Vec<Waker> {
let mut deferred = self.deferred.borrow_mut(); let mut deferred = self.deferred.borrow_mut();
std::mem::take(&mut *deferred) std::mem::take(&mut *deferred)
+1 -1
View File
@@ -36,7 +36,7 @@ impl<T: 'static> Inject<T> {
} }
// Kind of annoying to have to include the cfg here // Kind of annoying to have to include the cfg here
#[cfg(tokio_taskdump)] #[cfg(feature = "taskdump")]
pub(crate) fn is_closed(&self) -> bool { pub(crate) fn is_closed(&self) -> bool {
let synced = self.synced.lock(); let synced = self.synced.lock();
self.shared.is_closed(&synced) self.shared.is_closed(&synced)
+1 -1
View File
@@ -38,7 +38,7 @@ impl<T: 'static> Shared<T> {
} }
// Kind of annoying to have to include the cfg here // Kind of annoying to have to include the cfg here
#[cfg(any(tokio_taskdump, feature = "rt-multi-thread"))] #[cfg(any(feature = "taskdump", feature = "rt-multi-thread"))]
pub(crate) fn is_closed(&self, synced: &Synced) -> bool { pub(crate) fn is_closed(&self, synced: &Synced) -> bool {
synced.is_closed synced.is_closed
} }
+1 -1
View File
@@ -404,7 +404,7 @@ impl<S: 'static> Task<S> {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
+1 -1
View File
@@ -284,7 +284,7 @@ impl State {
/// otherwise `false.` /// otherwise `false.`
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
+2 -2
View File
@@ -1218,7 +1218,7 @@ impl NotifiedProject<'_> {
return Poll::Pending; return Poll::Pending;
} }
State::Waiting => { State::Waiting => {
#[cfg(tokio_taskdump)] #[cfg(feature = "taskdump")]
if let Some(waker) = waker { if let Some(waker) = waker {
let mut ctx = Context::from_waker(waker); let mut ctx = Context::from_waker(waker);
std::task::ready!(crate::trace::trace_leaf(&mut ctx)); std::task::ready!(crate::trace::trace_leaf(&mut ctx));
@@ -1312,7 +1312,7 @@ impl NotifiedProject<'_> {
drop(old_waker); drop(old_waker);
} }
State::Done => { State::Done => {
#[cfg(tokio_taskdump)] #[cfg(feature = "taskdump")]
if let Some(waker) = waker { if let Some(waker) = waker {
let mut ctx = Context::from_waker(waker); let mut ctx = Context::from_waker(waker);
std::task::ready!(crate::trace::trace_leaf(&mut ctx)); std::task::ready!(crate::trace::trace_leaf(&mut ctx));
+1 -1
View File
@@ -411,7 +411,7 @@ cfg_rt! {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any( any(
+1 -1
View File
@@ -189,7 +189,7 @@ cfg_rt! {
#[cfg(all( #[cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
feature = "rt", feature = "rt",
target_os = "linux", target_os = "linux",
any( any(
+1 -1
View File
@@ -1,6 +1,6 @@
#![cfg(all( #![cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))] ))]
+1 -1
View File
@@ -1,7 +1,7 @@
#![allow(unknown_lints, unexpected_cfgs)] #![allow(unknown_lints, unexpected_cfgs)]
#![cfg(all( #![cfg(all(
tokio_unstable, tokio_unstable,
tokio_taskdump, feature = "taskdump",
target_os = "linux", target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64") any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))] ))]