diff --git a/tokio/tests/fs_file.rs b/tokio/tests/fs_file.rs index dde099062..94d872a57 100644 --- a/tokio/tests/fs_file.rs +++ b/tokio/tests/fs_file.rs @@ -184,14 +184,13 @@ async fn unix_fd_is_valid() { #[tokio::test] #[cfg(unix)] async fn read_file_from_unix_fd() { - use std::os::unix::io::AsRawFd; - use std::os::unix::io::FromRawFd; + use std::os::unix::io::{FromRawFd, IntoRawFd}; let mut tempfile = tempfile(); tempfile.write_all(HELLO).unwrap(); let file1 = File::open(tempfile.path()).await.unwrap(); - let raw_fd = file1.as_raw_fd(); + let raw_fd = file1.into_std().await.into_raw_fd(); assert!(raw_fd > 0); let mut file2 = unsafe { File::from_raw_fd(raw_fd) };