diff options
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/collections/hash/set/tests.rs | 2 | ||||
| -rw-r--r-- | library/std/src/os/unix/net/listener.rs | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/library/std/src/collections/hash/set/tests.rs b/library/std/src/collections/hash/set/tests.rs index 208f61e755c..a1884090043 100644 --- a/library/std/src/collections/hash/set/tests.rs +++ b/library/std/src/collections/hash/set/tests.rs @@ -352,7 +352,7 @@ fn test_replace() { use crate::hash; #[derive(Debug)] - struct Foo(&'static str, i32); + struct Foo(&'static str, #[allow(dead_code)] i32); impl PartialEq for Foo { fn eq(&self, other: &Self) -> bool { diff --git a/library/std/src/os/unix/net/listener.rs b/library/std/src/os/unix/net/listener.rs index 5be8aebc70f..1b70b669c77 100644 --- a/library/std/src/os/unix/net/listener.rs +++ b/library/std/src/os/unix/net/listener.rs @@ -73,8 +73,18 @@ impl UnixListener { unsafe { let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?; let (addr, len) = sockaddr_un(path.as_ref())?; - const backlog: libc::c_int = - if cfg!(any(target_os = "linux", target_os = "freebsd")) { -1 } else { 128 }; + #[cfg(any(target_os = "windows", target_os = "redox"))] + const backlog: libc::c_int = 128; + #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] + const backlog: libc::c_int = -1; + #[cfg(not(any( + target_os = "windows", + target_os = "redox", + target_os = "linux", + target_os = "freebsd", + target_os = "openbsd" + )))] + const backlog: libc::c_int = libc::SOMAXCONN; cvt(libc::bind(inner.as_inner().as_raw_fd(), &addr as *const _ as *const _, len as _))?; cvt(libc::listen(inner.as_inner().as_raw_fd(), backlog))?; |
