Merge pull request #275 from gregdhill/master

use core instead of std for wasm sanity checks
This commit is contained in:
Andrew Poelstra 2021-01-25 16:00:35 +00:00 committed by GitHub
commit 8e61874d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;