Skip to content

Commit

Permalink
Exclude test on alignment of AlignedType for wasm
Browse files Browse the repository at this point in the history
`libc v0.2.149` for the `wasm-unknown-unknown` target does not include
the struct `max_align_t`. Feature gate the test that uses it so it
doesn't get built in for WASM builds.
  • Loading branch information
tcharding committed Oct 31, 2023
1 parent d476fc9 commit 94907de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion secp256k1-sys/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ pub(crate) const ALIGN_TO: usize = core::mem::align_of::<AlignedType>();
mod tests {
extern crate libc;
use std::any::TypeId;
#[cfg(not(target_arch = "wasm32"))]
use std::mem;
use std::os::raw;
use crate::{types, AlignedType};
#[cfg(not(target_arch = "wasm32"))]
use crate::AlignedType;
use crate::types;

#[test]
fn verify_types() {
Expand All @@ -48,6 +51,7 @@ mod tests {
assert_eq!(TypeId::of::<types::c_uint>(), TypeId::of::<raw::c_uint>());
assert_eq!(TypeId::of::<types::c_char>(), TypeId::of::<raw::c_char>());

#[cfg(not(target_arch = "wasm32"))]
assert!(mem::align_of::<AlignedType>() >= mem::align_of::<self::libc::max_align_t>());
}
}
Expand Down

0 comments on commit 94907de

Please sign in to comment.