Skip to content

Commit 852a4ce

Browse files
committed
fix as ref
1 parent a649265 commit 852a4ce

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

library/std/src/os/windows/net/listener.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl UnixListener {
1818
pub fn bind<P: AsRef<Path>>(path: P) -> io::Result<UnixListener> {
1919
unsafe {
2020
let inner = Socket::new_unix()?;
21-
let (addr, len) = sockaddr_un(path)?;
21+
let (addr, len) = sockaddr_un(path.as_ref())?;
2222
cvt(bind(inner.as_raw(), &addr as *const _ as *const _, len))?;
2323
cvt(listen(inner.as_raw(), 128))?;
2424
Ok(UnixListener(inner))

library/std/tests/windows_unix_socket.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ use std::thread;
99
fn smoke_bind_connect() {
1010
let tmp = std::env::temp_dir();
1111
let sock_path = tmp.join("rust-test-uds.sock");
12-
13-
let listener = UnixListener::bind(sock_path.as_path()).expect("bind failed");
14-
12+
let listener = UnixListener::bind(&sock_path).expect("bind failed");
13+
let sock_path_clone = sock_path.clone();
1514
let tx = thread::spawn(move || {
16-
let mut stream = UnixStream::connect(&sock_path).expect("connect failed");
15+
let mut stream = UnixStream::connect(&sock_path_clone).expect("connect failed");
1716
stream.write_all(b"hello").expect("write failed");
1817
});
1918

0 commit comments

Comments
 (0)