From f7d86b2f4ace416a65e84603082c756b8b5dc43e Mon Sep 17 00:00:00 2001 From: Jakub Wieczorek Date: Fri, 6 Jun 2014 15:51:42 +0200 Subject: Remove the dead code identified by the new lint --- src/libnative/io/mod.rs | 4 ++-- src/libnative/io/net.rs | 5 ++++- src/libnative/io/pipe_unix.rs | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/libnative') diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs index 3b0dbe2d0dc..1ecf7e57023 100644 --- a/src/libnative/io/mod.rs +++ b/src/libnative/io/mod.rs @@ -152,13 +152,13 @@ fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 { /// Implementation of rt::rtio's IoFactory trait to generate handles to the /// native I/O functionality. pub struct IoFactory { - cannot_construct_outside_of_this_module: () + _cannot_construct_outside_of_this_module: () } impl IoFactory { pub fn new() -> IoFactory { net::init(); - IoFactory { cannot_construct_outside_of_this_module: () } + IoFactory { _cannot_construct_outside_of_this_module: () } } } diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index 24956e514ec..e7effbd6bdb 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -254,7 +254,10 @@ pub struct TcpStream { struct Inner { fd: sock_t, - lock: mutex::NativeMutex, + + // Unused on Linux, where this lock is not necessary. + #[allow(dead_code)] + lock: mutex::NativeMutex } pub struct Guard<'a> { diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs index 7a1134fbe59..1458b475ae9 100644 --- a/src/libnative/io/pipe_unix.rs +++ b/src/libnative/io/pipe_unix.rs @@ -58,7 +58,10 @@ fn addr_to_sockaddr_un(addr: &CString) -> IoResult<(libc::sockaddr_storage, uint struct Inner { fd: fd_t, - lock: mutex::NativeMutex, + + // Unused on Linux, where this lock is not necessary. + #[allow(dead_code)] + lock: mutex::NativeMutex } impl Inner { -- cgit 1.4.1-3-g733a5 From 135625df96733dae77544de7abb2eae71f4946fc Mon Sep 17 00:00:00 2001 From: Jakub Wieczorek Date: Sun, 8 Jun 2014 21:55:17 +0200 Subject: Mark relevant structs with repr(C) --- src/libgreen/context.rs | 1 + src/libnative/io/c_win32.rs | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src/libnative') diff --git a/src/libgreen/context.rs b/src/libgreen/context.rs index 5b1a4a8b80e..e377c203e30 100644 --- a/src/libgreen/context.rs +++ b/src/libgreen/context.rs @@ -143,6 +143,7 @@ extern { // stacks are disabled. #[cfg(target_arch = "x86")] +#[repr(C)] struct Registers { eax: u32, ebx: u32, ecx: u32, edx: u32, ebp: u32, esi: u32, edi: u32, esp: u32, diff --git a/src/libnative/io/c_win32.rs b/src/libnative/io/c_win32.rs index 93b3ec7ccef..a783a9b1243 100644 --- a/src/libnative/io/c_win32.rs +++ b/src/libnative/io/c_win32.rs @@ -20,6 +20,7 @@ pub static FIONBIO: libc::c_long = 0x8004667e; static FD_SETSIZE: uint = 64; pub static MSG_DONTWAIT: libc::c_int = 0; +#[repr(C)] pub struct WSADATA { pub wVersion: libc::WORD, pub wHighVersion: libc::WORD, @@ -32,6 +33,7 @@ pub struct WSADATA { pub type LPWSADATA = *mut WSADATA; +#[repr(C)] pub struct fd_set { fd_count: libc::c_uint, fd_array: [libc::SOCKET, ..FD_SETSIZE], -- cgit 1.4.1-3-g733a5