From 7dd060080e0aebf37ab781661e1b240d0ba92a48 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 11 Jul 2022 20:42:11 -0700 Subject: [PATCH] Require rust >= 1.30 and drop libc_core_cvoid conditional Move the `c_void` re-export to the top-level `lib.rs`. (apply to `main`) (cherry picked from commit e22188720ee261809fccd3b19d15d4e1a404c1dc) --- src/fuchsia/mod.rs | 4 ++-- src/hermit.rs | 4 ++-- src/lib.rs | 2 ++ src/sgx.rs | 2 -- src/solid/mod.rs | 4 ++-- src/switch.rs | 2 -- src/unix/mod.rs | 4 ++-- src/vxworks/mod.rs | 3 +-- src/wasi/mod.rs | 3 +-- src/windows/mod.rs | 4 ++-- src/xous.rs | 2 -- 11 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 9f3c6d94d270c..74234399be918 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3,6 +3,8 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. +use c_void; + // PUB_TYPE pub type c_schar = i8; @@ -4486,5 +4488,3 @@ cfg_if! { // Unknown target_arch } } - -pub use ffi::c_void; diff --git a/src/hermit.rs b/src/hermit.rs index 77df54ae12d8d..8e630c38f6b65 100644 --- a/src/hermit.rs +++ b/src/hermit.rs @@ -1,5 +1,7 @@ //! Hermit C type definitions +use c_void; + cfg_if! { if #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] { pub type c_char = u8; @@ -576,5 +578,3 @@ extern "C" { #[link_name = "sys_poll"] pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: i32) -> i32; } - -pub use ffi::c_void; diff --git a/src/lib.rs b/src/lib.rs index 015b17594545f..488b698556df3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,6 +61,8 @@ use core::num; #[allow(unused_imports)] use core::option::Option; +pub use core::ffi::c_void; + cfg_if! { if #[cfg(windows)] { mod fixed_width_ints; diff --git a/src/sgx.rs b/src/sgx.rs index 09cc33eb73589..e37ccd79c3a55 100644 --- a/src/sgx.rs +++ b/src/sgx.rs @@ -25,5 +25,3 @@ pub type c_ulong = u64; pub const INT_MIN: c_int = -2147483648; pub const INT_MAX: c_int = 2147483647; - -pub use ffi::c_void; diff --git a/src/solid/mod.rs b/src/solid/mod.rs index 4c880796340eb..da1ce150b0330 100644 --- a/src/solid/mod.rs +++ b/src/solid/mod.rs @@ -2,6 +2,8 @@ //! //! [SOLID]: https://solid.kmckk.com/ +use c_void; + pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; @@ -871,8 +873,6 @@ extern "C" { pub fn lseek(arg1: c_int, arg2: __off_t, arg3: c_int) -> __off_t; } -pub use ffi::c_void; - cfg_if! { if #[cfg(target_arch = "aarch64")] { mod aarch64; diff --git a/src/switch.rs b/src/switch.rs index 1e8962823af84..4a8b16e15f568 100644 --- a/src/switch.rs +++ b/src/switch.rs @@ -27,5 +27,3 @@ pub type wchar_t = u32; pub const INT_MIN: c_int = -2147483648; pub const INT_MAX: c_int = 2147483647; - -pub use ffi::c_void; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 6b2df6bcee381..17ee6e591088b 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -3,6 +3,8 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. +use c_void; + pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; @@ -1688,5 +1690,3 @@ cfg_if! { // Unknown target_os } } - -pub use ffi::c_void; diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 3280eeb7e5a2f..2a8e3b0a60d01 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -1,5 +1,6 @@ //! Interface to VxWorks C library +use c_void; use core::mem::size_of; use core::ptr::null_mut; @@ -2013,8 +2014,6 @@ pub unsafe fn posix_memalign( } } -pub use ffi::c_void; - cfg_if! { if #[cfg(target_arch = "aarch64")] { mod aarch64; diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 5caf72a1cf9aa..3200442bb761c 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -2,10 +2,9 @@ // `wasi-libc` project provides multiple libraries including emulated features, but we list only basic features with `libc.a` here. use super::{Send, Sync}; +use c_void; use core::iter::Iterator; -pub use ffi::c_void; - pub type c_char = i8; pub type c_uchar = u8; pub type c_schar = i8; diff --git a/src/windows/mod.rs b/src/windows/mod.rs index 8fcdfbede0866..27ecd08822345 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -1,5 +1,7 @@ //! Windows CRT definitions +use c_void; + pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; @@ -565,8 +567,6 @@ extern "system" { pub fn socket(af: ::c_int, socket_type: ::c_int, protocol: ::c_int) -> SOCKET; } -pub use ffi::c_void; - cfg_if! { if #[cfg(all(target_env = "gnu"))] { mod gnu; diff --git a/src/xous.rs b/src/xous.rs index 6731a94e20df7..4073349306fb9 100644 --- a/src/xous.rs +++ b/src/xous.rs @@ -27,5 +27,3 @@ pub type wchar_t = u32; pub const INT_MIN: c_int = -2147483648; pub const INT_MAX: c_int = 2147483647; - -pub use ffi::c_void;