diff --git a/build.rs b/build.rs deleted file mode 100644 index 8292525..0000000 --- a/build.rs +++ /dev/null @@ -1,16 +0,0 @@ -fn main() { - let cfg = match autocfg::AutoCfg::new() { - Ok(cfg) => cfg, - Err(e) => { - println!( - "cargo:warning=async-io: failed to detect compiler features: {}", - e - ); - return; - } - }; - - if !cfg.probe_rustc_version(1, 63) { - autocfg::emit("async_io_no_io_safety"); - } -} diff --git a/src/lib.rs b/src/lib.rs index fd4ab9c..8ebdd94 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,8 +64,6 @@ use std::sync::Arc; use std::task::{Context, Poll, Waker}; use std::time::{Duration, Instant}; -#[cfg(all(not(async_io_no_io_safety), unix))] -use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd}; #[cfg(unix)] use std::{ os::unix::io::{AsRawFd, RawFd}, @@ -75,12 +73,14 @@ use std::{ #[cfg(windows)] use std::os::windows::io::{AsRawSocket, RawSocket}; -#[cfg(all(not(async_io_no_io_safety), windows))] -use std::os::windows::io::{AsSocket, BorrowedSocket, OwnedSocket}; use futures_io::{AsyncRead, AsyncWrite}; use futures_lite::stream::{self, Stream}; use futures_lite::{future, pin, ready}; +#[cfg(unix)] +use rustix::fd::{AsFd, BorrowedFd, OwnedFd}; +#[cfg(windows)] +use rustix::fd::{AsSocket, BorrowedFd as BorrowedSocket, OwnedFd as OwnedSocket}; use socket2::{Domain, Protocol, SockAddr, Socket, Type}; use crate::reactor::{Reactor, Source}; @@ -691,14 +691,14 @@ impl AsRawFd for Async { } } -#[cfg(all(not(async_io_no_io_safety), unix))] +#[cfg(unix)] impl AsFd for Async { fn as_fd(&self) -> BorrowedFd<'_> { self.get_ref().as_fd() } } -#[cfg(all(not(async_io_no_io_safety), unix))] +#[cfg(unix)] impl> TryFrom for Async { type Error = io::Error; @@ -707,7 +707,7 @@ impl> TryFrom for Async { } } -#[cfg(all(not(async_io_no_io_safety), unix))] +#[cfg(unix)] impl> TryFrom> for OwnedFd { type Error = io::Error; @@ -767,14 +767,14 @@ impl AsRawSocket for Async { } } -#[cfg(all(not(async_io_no_io_safety), windows))] +#[cfg(windows)] impl AsSocket for Async { fn as_socket(&self) -> BorrowedSocket<'_> { self.get_ref().as_socket() } } -#[cfg(all(not(async_io_no_io_safety), windows))] +#[cfg(windows)] impl> TryFrom for Async { type Error = io::Error; @@ -783,7 +783,7 @@ impl> TryFrom for Async { } } -#[cfg(all(not(async_io_no_io_safety), windows))] +#[cfg(windows)] impl> TryFrom> for OwnedSocket { type Error = io::Error;