Remove all uses of mem::uninitialized for Rust 1.38

This commit is contained in:
Mark McCaskey
2019-07-31 13:21:20 +09:00
parent 99ecfaa503
commit 0ab8a0de09
6 changed files with 38 additions and 33 deletions

View File

@ -219,7 +219,7 @@ fn __get_async_io_payload<
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Default, Copy, Clone)]
struct SockaddrIn {
sin_family: u16, // e.g. AF_INET
sin_port: u16, // e.g. htons(3490)
@ -315,7 +315,7 @@ impl Tcp4Listener {
self.fd,
EpollDirection::In,
move |fd| -> Result<Arc<TcpStream>, i32> {
let mut incoming_sa: SockaddrIn = unsafe { ::std::mem::uninitialized() };
let mut incoming_sa: SockaddrIn = SockaddrIn::default();
let mut real_len: usize = ::std::mem::size_of::<SockaddrIn>();
let conn = unsafe { _accept4(fd, &mut incoming_sa, &mut real_len, O_NONBLOCK) };
if conn >= 0 {