• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/Cargo.toml b/Cargo.toml
2index 6728a901..5291a632 100644
3--- a/Cargo.toml
4+++ b/Cargo.toml
5@@ -208,7 +208,7 @@ optional = true
6 version = "0.2.149"
7
8 [target."cfg(unix)".dev-dependencies.nix]
9-version = "0.27.1"
10+version = "0.28.0"
11 features = [
12     "fs",
13     "socket",
14diff --git a/Cargo.toml.orig b/Cargo.toml.orig
15index 069bb130..91fc4261 100644
16--- a/Cargo.toml.orig
17+++ b/Cargo.toml.orig
18@@ -123,7 +123,7 @@ signal-hook-registry = { version = "1.1.1", optional = true }
19
20 [target.'cfg(unix)'.dev-dependencies]
21 libc = { version = "0.2.149" }
22-nix = { version = "0.27.1", default-features = false, features = ["fs", "socket"] }
23+nix = { version = "0.28.0", default-features = false, features = ["fs", "socket"] }
24
25 [target.'cfg(windows)'.dependencies.windows-sys]
26 version = "0.48"
27diff --git a/tests/io_async_fd.rs b/tests/io_async_fd.rs
28index 49b5a683..aca25462 100644
29--- a/tests/io_async_fd.rs
30+++ b/tests/io_async_fd.rs
31@@ -1,7 +1,7 @@
32 #![warn(rust_2018_idioms)]
33 #![cfg(all(unix, feature = "full"))]
34
35-use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
36+use std::os::unix::io::{AsRawFd, RawFd};
37 use std::sync::{
38     atomic::{AtomicBool, Ordering},
39     Arc,
40@@ -13,7 +13,7 @@ use std::{
41     task::{Context, Waker},
42 };
43
44-use nix::unistd::{close, read, write};
45+use nix::unistd::{read, write};
46
47 use futures::poll;
48
49@@ -57,18 +57,18 @@ impl TestWaker {
50
51 #[derive(Debug)]
52 struct FileDescriptor {
53-    fd: RawFd,
54+    fd: std::os::fd::OwnedFd,
55 }
56
57 impl AsRawFd for FileDescriptor {
58     fn as_raw_fd(&self) -> RawFd {
59-        self.fd
60+        self.fd.as_raw_fd()
61     }
62 }
63
64 impl Read for &FileDescriptor {
65     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
66-        read(self.fd, buf).map_err(io::Error::from)
67+        read(self.fd.as_raw_fd(), buf).map_err(io::Error::from)
68     }
69 }
70
71@@ -80,7 +80,7 @@ impl Read for FileDescriptor {
72
73 impl Write for &FileDescriptor {
74     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
75-        write(self.fd, buf).map_err(io::Error::from)
76+        write(&self.fd, buf).map_err(io::Error::from)
77     }
78
79     fn flush(&mut self) -> io::Result<()> {
80@@ -98,12 +98,6 @@ impl Write for FileDescriptor {
81     }
82 }
83
84-impl Drop for FileDescriptor {
85-    fn drop(&mut self) {
86-        let _ = close(self.fd);
87-    }
88-}
89-
90 fn set_nonblocking(fd: RawFd) {
91     use nix::fcntl::{OFlag, F_GETFL, F_SETFL};
92
93@@ -132,17 +126,10 @@ fn socketpair() -> (FileDescriptor, FileDescriptor) {
94         SockFlag::empty(),
95     )
96     .expect("socketpair");
97-    let fds = (
98-        FileDescriptor {
99-            fd: fd_a.into_raw_fd(),
100-        },
101-        FileDescriptor {
102-            fd: fd_b.into_raw_fd(),
103-        },
104-    );
105+    let fds = (FileDescriptor { fd: fd_a }, FileDescriptor { fd: fd_b });
106
107-    set_nonblocking(fds.0.fd);
108-    set_nonblocking(fds.1.fd);
109+    set_nonblocking(fds.0.fd.as_raw_fd());
110+    set_nonblocking(fds.1.fd.as_raw_fd());
111
112     fds
113 }
114