diff --git a/tokio/src/fs/file.rs b/tokio/src/fs/file.rs index 2f1046ce18f..d8a55d29912 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 { @@ -776,7 +776,6 @@ 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}; impl AsRawHandle for File { @@ -785,7 +784,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..ee927325bdc 100644 --- a/tokio/src/io/stderr.rs +++ b/tokio/src/io/stderr.rs @@ -75,7 +75,6 @@ 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}; @@ -87,7 +86,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,7 +94,6 @@ mod sys { } cfg_windows! { - #[cfg(not(tokio_no_as_fd))] use crate::os::windows::io::{AsHandle, BorrowedHandle}; use crate::os::windows::io::{AsRawHandle, RawHandle}; @@ -106,7 +103,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..9e6c6c895e4 100644 --- a/tokio/src/io/stdin.rs +++ b/tokio/src/io/stdin.rs @@ -50,7 +50,6 @@ 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}; @@ -62,7 +61,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,7 +69,6 @@ mod sys { } cfg_windows! { - #[cfg(not(tokio_no_as_fd))] use crate::os::windows::io::{AsHandle, BorrowedHandle}; use crate::os::windows::io::{AsRawHandle, RawHandle}; @@ -81,7 +78,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..e5206c824c9 100644 --- a/tokio/src/io/stdout.rs +++ b/tokio/src/io/stdout.rs @@ -74,7 +74,6 @@ 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}; @@ -86,7 +85,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,7 +93,6 @@ mod sys { } cfg_windows! { - #[cfg(not(tokio_no_as_fd))] use crate::os::windows::io::{AsHandle, BorrowedHandle}; use crate::os::windows::io::{AsRawHandle, RawHandle}; @@ -105,7 +102,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..671aef3f3af 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()) } @@ -438,7 +436,6 @@ cfg_unstable! { 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 TcpListener { @@ -447,7 +444,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 5c7030d821d..146adb9b05e 100644 --- a/tokio/src/net/tcp/socket.rs +++ b/tokio/src/net/tcp/socket.rs @@ -4,7 +4,7 @@ use std::fmt; use std::io; use std::net::SocketAddr; -#[cfg(all(unix, not(tokio_no_as_fd)))] +#[cfg(unix)] use std::os::unix::io::{AsFd, BorrowedFd}; #[cfg(unix)] use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; @@ -12,7 +12,6 @@ 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}; } @@ -788,7 +787,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 +828,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..90e4b276ee7 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()) } @@ -1388,7 +1387,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 TcpStream { @@ -1397,7 +1395,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 +1413,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 cd3d6a85d7e..245f07e6b86 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..594203e7c01 100644 --- a/tokio/src/net/unix/datagram/socket.rs +++ b/tokio/src/net/unix/datagram/socket.rs @@ -4,7 +4,6 @@ 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::net; @@ -1578,7 +1577,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..112e51f4607 100644 --- a/tokio/src/net/unix/listener.rs +++ b/tokio/src/net/unix/listener.rs @@ -3,7 +3,6 @@ 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::net; @@ -211,7 +210,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..2de9554bd64 100644 --- a/tokio/src/net/unix/pipe.rs +++ b/tokio/src/net/unix/pipe.rs @@ -7,7 +7,6 @@ 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::path::Path; @@ -664,7 +663,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 +1168,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..27cba4436a1 100644 --- a/tokio/src/net/unix/stream.rs +++ b/tokio/src/net/unix/stream.rs @@ -8,7 +8,6 @@ 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::net; @@ -1039,7 +1038,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..f0304192945 100644 --- a/tokio/src/net/windows/named_pipe.rs +++ b/tokio/src/net/windows/named_pipe.rs @@ -10,7 +10,6 @@ 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}; @@ -930,7 +929,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 +1718,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..25aaddc6f61 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -260,7 +260,6 @@ 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}; } @@ -1450,7 +1449,6 @@ 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}; @@ -1462,7 +1460,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 +1472,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 +1484,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 +1498,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 +1510,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 +1522,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..163253726ae 100644 --- a/tokio/src/process/unix/mod.rs +++ b/tokio/src/process/unix/mod.rs @@ -39,7 +39,6 @@ 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::pin::Pin; @@ -196,7 +195,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 +253,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.