From 32d8d578b80879fb645957e81e46660838cae617 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Fri, 28 Jul 2023 13:06:40 +1000 Subject: [PATCH] Removed unused `tokio_*` cfgs - tokio_no_const_thread_local - tokio_no_target_has_atomic - tokio_no_as_fd Signed-off-by: Jiahao XU --- tokio/src/fs/file.rs | 7 ++----- tokio/src/io/async_fd.rs | 1 - tokio/src/io/stderr.rs | 10 ++-------- tokio/src/io/stdin.rs | 10 ++-------- tokio/src/io/stdout.rs | 10 ++-------- tokio/src/macros/cfg.rs | 18 ++---------------- tokio/src/macros/thread_local.rs | 14 -------------- tokio/src/net/tcp/listener.rs | 7 +------ tokio/src/net/tcp/socket.rs | 11 +++-------- tokio/src/net/tcp/stream.rs | 7 +------ tokio/src/net/udp.rs | 3 --- tokio/src/net/unix/datagram/socket.rs | 5 +---- tokio/src/net/unix/listener.rs | 5 +---- tokio/src/net/unix/pipe.rs | 6 +----- tokio/src/net/unix/stream.rs | 5 +---- tokio/src/net/windows/named_pipe.rs | 6 +----- tokio/src/process/mod.rs | 14 ++------------ tokio/src/process/unix/mod.rs | 6 +----- tokio/src/task/task_local.rs | 17 ----------------- 19 files changed, 23 insertions(+), 139 deletions(-) diff --git a/tokio/src/fs/file.rs b/tokio/src/fs/file.rs index 2f1046ce18f..1e88f30434e 100644 --- a/tokio/src/fs/file.rs +++ b/tokio/src/fs/file.rs @@ -758,7 +758,7 @@ impl std::os::unix::io::AsRawFd for File { } } -#[cfg(all(unix, not(tokio_no_as_fd)))] +#[cfg(unix)] impl std::os::unix::io::AsFd for File { fn as_fd(&self) -> std::os::unix::io::BorrowedFd<'_> { unsafe { @@ -775,9 +775,7 @@ impl std::os::unix::io::FromRawFd for File { } cfg_windows! { - use crate::os::windows::io::{AsRawHandle, FromRawHandle, RawHandle}; - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsHandle, BorrowedHandle}; + use crate::os::windows::io::{AsRawHandle, FromRawHandle, RawHandle, AsHandle, BorrowedHandle}; impl AsRawHandle for File { fn as_raw_handle(&self) -> RawHandle { @@ -785,7 +783,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsHandle for File { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { diff --git a/tokio/src/io/async_fd.rs b/tokio/src/io/async_fd.rs index 0cde5a40761..db56359c5ad 100644 --- a/tokio/src/io/async_fd.rs +++ b/tokio/src/io/async_fd.rs @@ -797,7 +797,6 @@ impl AsRawFd for AsyncFd { } } -#[cfg(not(tokio_no_as_fd))] impl std::os::unix::io::AsFd for AsyncFd { fn as_fd(&self) -> std::os::unix::io::BorrowedFd<'_> { unsafe { std::os::unix::io::BorrowedFd::borrow_raw(self.as_raw_fd()) } diff --git a/tokio/src/io/stderr.rs b/tokio/src/io/stderr.rs index 2119c6d6ce9..e55cb1628fb 100644 --- a/tokio/src/io/stderr.rs +++ b/tokio/src/io/stderr.rs @@ -75,9 +75,7 @@ cfg_io_std! { #[cfg(unix)] mod sys { - #[cfg(not(tokio_no_as_fd))] - use std::os::unix::io::{AsFd, BorrowedFd}; - use std::os::unix::io::{AsRawFd, RawFd}; + use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd}; use super::Stderr; @@ -87,7 +85,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for Stderr { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -96,9 +93,7 @@ mod sys { } cfg_windows! { - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsHandle, BorrowedHandle}; - use crate::os::windows::io::{AsRawHandle, RawHandle}; + use crate::os::windows::io::{AsHandle, BorrowedHandle, AsRawHandle, RawHandle}; impl AsRawHandle for Stderr { fn as_raw_handle(&self) -> RawHandle { @@ -106,7 +101,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsHandle for Stderr { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } diff --git a/tokio/src/io/stdin.rs b/tokio/src/io/stdin.rs index 04cced425ff..640cb0b7236 100644 --- a/tokio/src/io/stdin.rs +++ b/tokio/src/io/stdin.rs @@ -50,9 +50,7 @@ cfg_io_std! { #[cfg(unix)] mod sys { - #[cfg(not(tokio_no_as_fd))] - use std::os::unix::io::{AsFd, BorrowedFd}; - use std::os::unix::io::{AsRawFd, RawFd}; + use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd}; use super::Stdin; @@ -62,7 +60,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for Stdin { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -71,9 +68,7 @@ mod sys { } cfg_windows! { - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsHandle, BorrowedHandle}; - use crate::os::windows::io::{AsRawHandle, RawHandle}; + use crate::os::windows::io::{AsHandle, BorrowedHandle, AsRawHandle, RawHandle}; impl AsRawHandle for Stdin { fn as_raw_handle(&self) -> RawHandle { @@ -81,7 +76,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsHandle for Stdin { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } diff --git a/tokio/src/io/stdout.rs b/tokio/src/io/stdout.rs index f52bf5a4bcf..7636fe9708c 100644 --- a/tokio/src/io/stdout.rs +++ b/tokio/src/io/stdout.rs @@ -74,9 +74,7 @@ cfg_io_std! { #[cfg(unix)] mod sys { - #[cfg(not(tokio_no_as_fd))] - use std::os::unix::io::{AsFd, BorrowedFd}; - use std::os::unix::io::{AsRawFd, RawFd}; + use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd}; use super::Stdout; @@ -86,7 +84,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for Stdout { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -95,9 +92,7 @@ mod sys { } cfg_windows! { - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsHandle, BorrowedHandle}; - use crate::os::windows::io::{AsRawHandle, RawHandle}; + use crate::os::windows::io::{AsHandle, BorrowedHandle, AsRawHandle, RawHandle}; impl AsRawHandle for Stdout { fn as_raw_handle(&self) -> RawHandle { @@ -105,7 +100,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsHandle for Stdout { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index f60c040fd01..60f526ec889 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -523,14 +523,7 @@ macro_rules! cfg_not_coop { macro_rules! cfg_has_atomic_u64 { ($($item:item)*) => { $( - #[cfg_attr( - not(tokio_no_target_has_atomic), - cfg(all(target_has_atomic = "64", not(tokio_no_atomic_u64)) - ))] - #[cfg_attr( - tokio_no_target_has_atomic, - cfg(not(tokio_no_atomic_u64)) - )] + #[cfg(all(target_has_atomic = "64", not(tokio_no_atomic_u64)))] $item )* } @@ -539,14 +532,7 @@ macro_rules! cfg_has_atomic_u64 { macro_rules! cfg_not_has_atomic_u64 { ($($item:item)*) => { $( - #[cfg_attr( - not(tokio_no_target_has_atomic), - cfg(any(not(target_has_atomic = "64"), tokio_no_atomic_u64) - ))] - #[cfg_attr( - tokio_no_target_has_atomic, - cfg(tokio_no_atomic_u64) - )] + #[cfg(any(not(target_has_atomic = "64"), tokio_no_atomic_u64))] $item )* } diff --git a/tokio/src/macros/thread_local.rs b/tokio/src/macros/thread_local.rs index 74be99abf65..6d4a6aacbff 100644 --- a/tokio/src/macros/thread_local.rs +++ b/tokio/src/macros/thread_local.rs @@ -10,23 +10,9 @@ macro_rules! tokio_thread_local { ($($tts:tt)+) => { loom::thread_local!{ $($tts)+ } } } -#[cfg(not(tokio_no_const_thread_local))] #[cfg(not(all(loom, test)))] macro_rules! tokio_thread_local { ($($tts:tt)+) => { ::std::thread_local!{ $($tts)+ } } } - -#[cfg(tokio_no_const_thread_local)] -#[cfg(not(all(loom, test)))] -macro_rules! tokio_thread_local { - ($(#[$attrs:meta])* $vis:vis static $name:ident: $ty:ty = const { $expr:expr } $(;)?) => { - ::std::thread_local! { - $(#[$attrs])* - $vis static $name: $ty = $expr; - } - }; - - ($($tts:tt)+) => { ::std::thread_local!{ $($tts)+ } } -} diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs index 07ac6311d1e..28da34afb29 100644 --- a/tokio/src/net/tcp/listener.rs +++ b/tokio/src/net/tcp/listener.rs @@ -407,7 +407,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for TcpListener { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -427,7 +426,6 @@ cfg_unstable! { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for TcpListener { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -437,9 +435,7 @@ cfg_unstable! { } cfg_windows! { - use crate::os::windows::io::{AsRawSocket, RawSocket}; - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsSocket, BorrowedSocket}; + use crate::os::windows::io::{AsRawSocket, RawSocket, AsSocket, BorrowedSocket}; impl AsRawSocket for TcpListener { fn as_raw_socket(&self) -> RawSocket { @@ -447,7 +443,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsSocket for TcpListener { fn as_socket(&self) -> BorrowedSocket<'_> { unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) } diff --git a/tokio/src/net/tcp/socket.rs b/tokio/src/net/tcp/socket.rs index 313ace2f313..1497bd612cf 100644 --- a/tokio/src/net/tcp/socket.rs +++ b/tokio/src/net/tcp/socket.rs @@ -4,16 +4,12 @@ use std::fmt; use std::io; use std::net::SocketAddr; -#[cfg(all(unix, not(tokio_no_as_fd)))] -use std::os::unix::io::{AsFd, BorrowedFd}; #[cfg(unix)] -use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::time::Duration; cfg_windows! { - use crate::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket}; - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsSocket, BorrowedSocket}; + use crate::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket, AsSocket, BorrowedSocket}; } cfg_net! { @@ -788,7 +784,7 @@ impl AsRawFd for TcpSocket { } } -#[cfg(all(unix, not(tokio_no_as_fd)))] +#[cfg(unix)] impl AsFd for TcpSocket { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -829,7 +825,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsSocket for TcpSocket { fn as_socket(&self) -> BorrowedSocket<'_> { unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) } diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index 1c9f1fc56e6..707f73d41d0 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -1378,7 +1378,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for TcpStream { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -1387,9 +1386,7 @@ mod sys { } cfg_windows! { - use crate::os::windows::io::{AsRawSocket, RawSocket}; - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsSocket, BorrowedSocket}; + use crate::os::windows::io::{AsRawSocket, RawSocket, AsSocket, BorrowedSocket}; impl AsRawSocket for TcpStream { fn as_raw_socket(&self) -> RawSocket { @@ -1397,7 +1394,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsSocket for TcpStream { fn as_socket(&self) -> BorrowedSocket<'_> { unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) } @@ -1416,7 +1412,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for TcpStream { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index f1caa2a5c21..547aaaee046 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -2021,7 +2021,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for UdpSocket { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -2031,7 +2030,6 @@ mod sys { cfg_windows! { use crate::os::windows::io::{AsRawSocket, RawSocket}; - #[cfg(not(tokio_no_as_fd))] use crate::os::windows::io::{AsSocket, BorrowedSocket}; impl AsRawSocket for UdpSocket { @@ -2040,7 +2038,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsSocket for UdpSocket { fn as_socket(&self) -> BorrowedSocket<'_> { unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) } diff --git a/tokio/src/net/unix/datagram/socket.rs b/tokio/src/net/unix/datagram/socket.rs index c97d101aae9..caebf8e8b25 100644 --- a/tokio/src/net/unix/datagram/socket.rs +++ b/tokio/src/net/unix/datagram/socket.rs @@ -4,9 +4,7 @@ use crate::net::unix::SocketAddr; use std::fmt; use std::io; use std::net::Shutdown; -#[cfg(not(tokio_no_as_fd))] -use std::os::unix::io::{AsFd, BorrowedFd}; -use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net; use std::path::Path; use std::task::{Context, Poll}; @@ -1578,7 +1576,6 @@ impl AsRawFd for UnixDatagram { } } -#[cfg(not(tokio_no_as_fd))] impl AsFd for UnixDatagram { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } diff --git a/tokio/src/net/unix/listener.rs b/tokio/src/net/unix/listener.rs index 37a5a4ae400..036acd06324 100644 --- a/tokio/src/net/unix/listener.rs +++ b/tokio/src/net/unix/listener.rs @@ -3,9 +3,7 @@ use crate::net::unix::{SocketAddr, UnixStream}; use std::fmt; use std::io; -#[cfg(not(tokio_no_as_fd))] -use std::os::unix::io::{AsFd, BorrowedFd}; -use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net; use std::path::Path; use std::task::{Context, Poll}; @@ -211,7 +209,6 @@ impl AsRawFd for UnixListener { } } -#[cfg(not(tokio_no_as_fd))] impl AsFd for UnixListener { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } diff --git a/tokio/src/net/unix/pipe.rs b/tokio/src/net/unix/pipe.rs index 188ac68b11c..efe9b5ee863 100644 --- a/tokio/src/net/unix/pipe.rs +++ b/tokio/src/net/unix/pipe.rs @@ -7,9 +7,7 @@ use mio::unix::pipe as mio_pipe; use std::fs::File; use std::io::{self, Read, Write}; use std::os::unix::fs::{FileTypeExt, OpenOptionsExt}; -#[cfg(not(tokio_no_as_fd))] -use std::os::unix::io::{AsFd, BorrowedFd}; -use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::path::Path; use std::pin::Pin; use std::task::{Context, Poll}; @@ -664,7 +662,6 @@ impl AsRawFd for Sender { } } -#[cfg(not(tokio_no_as_fd))] impl AsFd for Sender { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -1170,7 +1167,6 @@ impl AsRawFd for Receiver { } } -#[cfg(not(tokio_no_as_fd))] impl AsFd for Receiver { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } diff --git a/tokio/src/net/unix/stream.rs b/tokio/src/net/unix/stream.rs index 201645ba1d8..241bcb2e2e2 100644 --- a/tokio/src/net/unix/stream.rs +++ b/tokio/src/net/unix/stream.rs @@ -8,9 +8,7 @@ use crate::net::unix::SocketAddr; use std::fmt; use std::io::{self, Read, Write}; use std::net::Shutdown; -#[cfg(not(tokio_no_as_fd))] -use std::os::unix::io::{AsFd, BorrowedFd}; -use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net; use std::path::Path; use std::pin::Pin; @@ -1039,7 +1037,6 @@ impl AsRawFd for UnixStream { } } -#[cfg(not(tokio_no_as_fd))] impl AsFd for UnixStream { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } diff --git a/tokio/src/net/windows/named_pipe.rs b/tokio/src/net/windows/named_pipe.rs index 91f016267ca..a03e1d0acd1 100644 --- a/tokio/src/net/windows/named_pipe.rs +++ b/tokio/src/net/windows/named_pipe.rs @@ -10,9 +10,7 @@ use std::ptr; use std::task::{Context, Poll}; use crate::io::{AsyncRead, AsyncWrite, Interest, PollEvented, ReadBuf, Ready}; -#[cfg(not(tokio_no_as_fd))] -use crate::os::windows::io::{AsHandle, BorrowedHandle}; -use crate::os::windows::io::{AsRawHandle, FromRawHandle, RawHandle}; +use crate::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, RawHandle}; cfg_io_util! { use bytes::BufMut; @@ -930,7 +928,6 @@ impl AsRawHandle for NamedPipeServer { } } -#[cfg(not(tokio_no_as_fd))] impl AsHandle for NamedPipeServer { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } @@ -1720,7 +1717,6 @@ impl AsRawHandle for NamedPipeClient { } } -#[cfg(not(tokio_no_as_fd))] impl AsHandle for NamedPipeClient { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 41353c04adf..5ab5647c29b 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -259,9 +259,7 @@ use std::os::unix::process::CommandExt; use std::os::windows::process::CommandExt; cfg_windows! { - use crate::os::windows::io::{AsRawHandle, RawHandle}; - #[cfg(not(tokio_no_as_fd))] - use crate::os::windows::io::{AsHandle, BorrowedHandle}; + use crate::os::windows::io::{AsRawHandle, RawHandle, AsHandle, BorrowedHandle}; } /// This structure mimics the API of [`std::process::Command`] found in the standard library, but @@ -1450,9 +1448,7 @@ impl TryInto for ChildStderr { #[cfg(unix)] mod sys { - #[cfg(not(tokio_no_as_fd))] - use std::os::unix::io::{AsFd, BorrowedFd}; - use std::os::unix::io::{AsRawFd, RawFd}; + use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd}; use super::{ChildStderr, ChildStdin, ChildStdout}; @@ -1462,7 +1458,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for ChildStdin { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -1475,7 +1470,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for ChildStdout { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -1488,7 +1482,6 @@ mod sys { } } - #[cfg(not(tokio_no_as_fd))] impl AsFd for ChildStderr { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -1503,7 +1496,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsHandle for ChildStdin { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } @@ -1516,7 +1508,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsHandle for ChildStdout { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } @@ -1529,7 +1520,6 @@ cfg_windows! { } } - #[cfg(not(tokio_no_as_fd))] impl AsHandle for ChildStderr { fn as_handle(&self) -> BorrowedHandle<'_> { unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) } diff --git a/tokio/src/process/unix/mod.rs b/tokio/src/process/unix/mod.rs index 41857f49c8f..36991bf971f 100644 --- a/tokio/src/process/unix/mod.rs +++ b/tokio/src/process/unix/mod.rs @@ -39,9 +39,7 @@ use std::fmt; use std::fs::File; use std::future::Future; use std::io; -#[cfg(not(tokio_no_as_fd))] -use std::os::unix::io::{AsFd, BorrowedFd}; -use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::pin::Pin; use std::process::{Child as StdChild, ExitStatus, Stdio}; use std::task::Context; @@ -196,7 +194,6 @@ impl AsRawFd for Pipe { } } -#[cfg(not(tokio_no_as_fd))] impl AsFd for Pipe { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } @@ -255,7 +252,6 @@ impl AsRawFd for ChildStdio { } } -#[cfg(not(tokio_no_as_fd))] impl AsFd for ChildStdio { fn as_fd(&self) -> BorrowedFd<'_> { unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) } diff --git a/tokio/src/task/task_local.rs b/tokio/src/task/task_local.rs index eeadfbd3efc..237c4d82e60 100644 --- a/tokio/src/task/task_local.rs +++ b/tokio/src/task/task_local.rs @@ -48,7 +48,6 @@ macro_rules! task_local { } #[doc(hidden)] -#[cfg(not(tokio_no_const_thread_local))] #[macro_export] macro_rules! __task_local_inner { ($(#[$attr:meta])* $vis:vis $name:ident, $t:ty) => { @@ -63,22 +62,6 @@ macro_rules! __task_local_inner { }; } -#[doc(hidden)] -#[cfg(tokio_no_const_thread_local)] -#[macro_export] -macro_rules! __task_local_inner { - ($(#[$attr:meta])* $vis:vis $name:ident, $t:ty) => { - $(#[$attr])* - $vis static $name: $crate::task::LocalKey<$t> = { - std::thread_local! { - static __KEY: std::cell::RefCell> = std::cell::RefCell::new(None); - } - - $crate::task::LocalKey { inner: __KEY } - }; - }; -} - /// A key for task-local data. /// /// This type is generated by the [`task_local!`] macro.