use core instead of std for wasm sanity checks

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
This commit is contained in:
Gregory Hill 2021-01-20 14:55:48 +00:00
parent a24e27e94b
commit c86808fac7
No known key found for this signature in database
GPG Key ID: 54841B20DB63C22B
1 changed files with 7 additions and 7 deletions

View File

@ -16,8 +16,10 @@ pub type c_char = i8;
/// We can replace this with `core::ffi::c_void` once we update the rustc version to >=1.30.0. /// We can replace this with `core::ffi::c_void` once we update the rustc version to >=1.30.0.
#[repr(u8)] #[repr(u8)]
pub enum c_void { pub enum c_void {
#[doc(hidden)] __variant1, #[doc(hidden)]
#[doc(hidden)] __variant2, __variant1,
#[doc(hidden)]
__variant2,
} }
impl fmt::Debug for c_void { impl fmt::Debug for c_void {
@ -43,13 +45,12 @@ impl AlignedType {
#[cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))] #[cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))]
pub(crate) const ALIGN_TO: usize = mem::align_of::<AlignedType>(); pub(crate) const ALIGN_TO: usize = mem::align_of::<AlignedType>();
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
extern crate libc; extern crate libc;
use std::os::raw;
use std::mem;
use std::any::TypeId; use std::any::TypeId;
use std::mem;
use std::os::raw;
use {types, AlignedType}; use {types, AlignedType};
#[test] #[test]
@ -63,11 +64,10 @@ mod tests {
} }
} }
#[doc(hidden)] #[doc(hidden)]
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
pub fn sanity_checks_for_wasm() { pub fn sanity_checks_for_wasm() {
use std::mem::{size_of, align_of}; use core::mem::{align_of, size_of};
extern "C" { extern "C" {
pub static WASM32_INT_SIZE: c_uchar; pub static WASM32_INT_SIZE: c_uchar;
pub static WASM32_INT_ALIGN: c_uchar; pub static WASM32_INT_ALIGN: c_uchar;