Skip to content

Commit 7ed6673

Browse files
ldm0hawkw
authored andcommitted
feat(subscriber): Add cfg console_without_tokio_unstable (#446)
Add cfg `console_without_tokio_unstable` for developers to turn off the assertion on `tokio_unstable`. This is useful for non-tokio runtimes which has `tokio-console` support.
1 parent 9c77414 commit 7ed6673

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

console-subscriber/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ tracing_subscriber::registry()
206206
[`tokio-console`]: https://github.com/tokio-rs/console
207207
[Tokio]: https://tokio.rs
208208

209+
### Using other runtimes
210+
211+
If you are using a custom runtime that supports tokio-console, you may not need
212+
to enable the `tokio_unstable` cfg flag. In this case, you need to enable cfg
213+
`console_without_tokio_unstable` for console-subscriber to disable its check for
214+
`tokio_unstable`.
215+
209216
### Crate Feature Flags
210217

211218
This crate provides the following feature flags and optional dependencies:

console-subscriber/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl ConsoleLayer {
267267
// depending on the build-time configuration...
268268
#![allow(clippy::assertions_on_constants)]
269269
assert!(
270-
cfg!(tokio_unstable),
270+
cfg!(any(tokio_unstable, console_without_tokio_unstable)),
271271
"task tracing requires Tokio to be built with RUSTFLAGS=\"--cfg tokio_unstable\"!"
272272
);
273273

0 commit comments

Comments
 (0)