Skip to content

Commit 921ff6f

Browse files
authored
Put the internal tokio module behind tokio* features (#1542)
This ensures that `tokio::task::Builder` is only used with `tokio` v1.0.
1 parent cfbb7b3 commit 921ff6f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/internal/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ pub mod prelude;
66
#[cfg(feature = "gateway")]
77
pub mod ws_impl;
88

9+
#[cfg(any(feature = "tokio", feature = "tokio_compat"))]
910
pub mod tokio;

src/internal/tokio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::future::Future;
22

3-
#[cfg(tokio_unstable)]
3+
#[cfg(all(tokio_unstable, not(feature = "tokio_compat")))]
44
pub fn spawn_named<F, T>(name: &str, future: F) -> tokio::task::JoinHandle<T>
55
where
66
F: Future<Output = T> + Send + 'static,
@@ -9,7 +9,7 @@ where
99
tokio::task::Builder::new().name(&*format!("serenity::{}", name)).spawn(future)
1010
}
1111

12-
#[cfg(not(tokio_unstable))]
12+
#[cfg(any(not(tokio_unstable), feature = "tokio_compat"))]
1313
pub fn spawn_named<F, T>(_name: &str, future: F) -> tokio::task::JoinHandle<T>
1414
where
1515
F: Future<Output = T> + Send + 'static,

0 commit comments

Comments
 (0)