diff options
Diffstat (limited to 'tests/expectations/tests/dynamic_loading_with_blocklist.rs')
-rw-r--r-- | tests/expectations/tests/dynamic_loading_with_blocklist.rs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/expectations/tests/dynamic_loading_with_blocklist.rs b/tests/expectations/tests/dynamic_loading_with_blocklist.rs index f2ffe671..af482ad9 100644 --- a/tests/expectations/tests/dynamic_loading_with_blocklist.rs +++ b/tests/expectations/tests/dynamic_loading_with_blocklist.rs @@ -12,6 +12,9 @@ pub struct X { } #[test] fn bindgen_test_layout_X() { + const UNINIT: ::std::mem::MaybeUninit<X> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<X>(), 4usize, @@ -22,18 +25,11 @@ fn bindgen_test_layout_X() { 4usize, concat!("Alignment of ", stringify!(X)) ); - fn test_field__x() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::<X>::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize - }, - 0usize, - concat!("Offset of field: ", stringify!(X), "::", stringify!(_x)) - ); - } - test_field__x(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize }, + 0usize, + concat!("Offset of field: ", stringify!(X), "::", stringify!(_x)) + ); } extern "C" { #[link_name = "\u{1}_ZN1X13some_functionEv"] |