diff options
author | onalante-msft <89409054+onalante-msft@users.noreply.github.com> | 2022-07-15 21:59:14 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-07-16 14:33:01 +0200 |
commit | e26230597c9ace38ad570131e21a751ddaa6c3ed (patch) | |
tree | 88074404a40bf4c78e7b2b0f1d8a27bab3a54d5e /tests | |
parent | 17b01c72ec985b8604410a82cc91734cb76cfcc2 (diff) |
Extract pointer once for all alignment tests
Diffstat (limited to 'tests')
242 files changed, 1322 insertions, 3464 deletions
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs index e1b6e283..a60a63aa 100644 --- a/tests/expectations/tests/16-byte-alignment.rs +++ b/tests/expectations/tests/16-byte-alignment.rs @@ -29,6 +29,7 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(), 4usize, @@ -46,10 +47,7 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -59,10 +57,7 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -76,6 +71,7 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1>(), 4usize, @@ -88,7 +84,6 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize }, 0usize, @@ -113,6 +108,7 @@ impl Default for rte_ipv4_tuple__bindgen_ty_1 { fn bindgen_test_layout_rte_ipv4_tuple() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv4_tuple>(), 12usize, @@ -125,7 +121,6 @@ fn bindgen_test_layout_rte_ipv4_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize }, 0usize, @@ -138,7 +133,6 @@ fn bindgen_test_layout_rte_ipv4_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize }, 4usize, @@ -183,6 +177,7 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(), 4usize, @@ -200,10 +195,7 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -213,10 +205,7 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -230,6 +219,7 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1>(), 4usize, @@ -242,7 +232,6 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize }, 0usize, @@ -267,6 +256,7 @@ impl Default for rte_ipv6_tuple__bindgen_ty_1 { fn bindgen_test_layout_rte_ipv6_tuple() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv6_tuple>(), 36usize, @@ -279,7 +269,6 @@ fn bindgen_test_layout_rte_ipv6_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize }, 0usize, @@ -292,7 +281,6 @@ fn bindgen_test_layout_rte_ipv6_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize }, 16usize, @@ -324,6 +312,7 @@ pub union rte_thash_tuple { fn bindgen_test_layout_rte_thash_tuple() { const UNINIT: ::std::mem::MaybeUninit<rte_thash_tuple> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_thash_tuple>(), 48usize, @@ -335,10 +324,7 @@ fn bindgen_test_layout_rte_thash_tuple() { concat!("Alignment of ", stringify!(rte_thash_tuple)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -348,10 +334,7 @@ fn bindgen_test_layout_rte_thash_tuple() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs index 6b39efda..369e2c75 100644 --- a/tests/expectations/tests/16-byte-alignment_1_0.rs +++ b/tests/expectations/tests/16-byte-alignment_1_0.rs @@ -74,6 +74,7 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(), 4usize, @@ -91,10 +92,7 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -104,10 +102,7 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -126,6 +121,7 @@ impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1>(), 4usize, @@ -138,7 +134,6 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize }, 0usize, @@ -159,6 +154,7 @@ impl Clone for rte_ipv4_tuple__bindgen_ty_1 { fn bindgen_test_layout_rte_ipv4_tuple() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv4_tuple>(), 12usize, @@ -171,7 +167,6 @@ fn bindgen_test_layout_rte_ipv4_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize }, 0usize, @@ -184,7 +179,6 @@ fn bindgen_test_layout_rte_ipv4_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize }, 4usize, @@ -227,6 +221,7 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(), 4usize, @@ -244,10 +239,7 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -257,10 +249,7 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -279,6 +268,7 @@ impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1>(), 4usize, @@ -291,7 +281,6 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize }, 0usize, @@ -312,6 +301,7 @@ impl Clone for rte_ipv6_tuple__bindgen_ty_1 { fn bindgen_test_layout_rte_ipv6_tuple() { const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ipv6_tuple>(), 36usize, @@ -324,7 +314,6 @@ fn bindgen_test_layout_rte_ipv6_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize }, 0usize, @@ -337,7 +326,6 @@ fn bindgen_test_layout_rte_ipv6_tuple() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize }, 16usize, @@ -365,16 +353,14 @@ pub struct rte_thash_tuple { fn bindgen_test_layout_rte_thash_tuple() { const UNINIT: ::std::mem::MaybeUninit<rte_thash_tuple> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_thash_tuple>(), 48usize, concat!("Size of: ", stringify!(rte_thash_tuple)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -384,10 +370,7 @@ fn bindgen_test_layout_rte_thash_tuple() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs index c38c1d63..05fdaf4c 100644 --- a/tests/expectations/tests/accessors.rs +++ b/tests/expectations/tests/accessors.rs @@ -20,6 +20,7 @@ pub struct SomeAccessors { fn bindgen_test_layout_SomeAccessors() { const UNINIT: ::std::mem::MaybeUninit<SomeAccessors> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<SomeAccessors>(), 16usize, @@ -32,7 +33,6 @@ fn bindgen_test_layout_SomeAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mNoAccessor) as usize - ptr as usize }, 0usize, @@ -45,7 +45,6 @@ fn bindgen_test_layout_SomeAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize }, 4usize, @@ -58,7 +57,6 @@ fn bindgen_test_layout_SomeAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mUnsafeAccessors) as usize - ptr as usize }, @@ -72,7 +70,6 @@ fn bindgen_test_layout_SomeAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mImmutableAccessor) as usize - ptr as usize }, @@ -120,6 +117,7 @@ pub struct AllAccessors { fn bindgen_test_layout_AllAccessors() { const UNINIT: ::std::mem::MaybeUninit<AllAccessors> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllAccessors>(), 8usize, @@ -132,7 +130,6 @@ fn bindgen_test_layout_AllAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize }, 0usize, @@ -145,7 +142,6 @@ fn bindgen_test_layout_AllAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mAlsoBothAccessors) as usize - ptr as usize }, @@ -187,6 +183,7 @@ pub struct AllUnsafeAccessors { fn bindgen_test_layout_AllUnsafeAccessors() { const UNINIT: ::std::mem::MaybeUninit<AllUnsafeAccessors> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllUnsafeAccessors>(), 8usize, @@ -199,7 +196,6 @@ fn bindgen_test_layout_AllUnsafeAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize }, 0usize, @@ -212,7 +208,6 @@ fn bindgen_test_layout_AllUnsafeAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mAlsoBothAccessors) as usize - ptr as usize }, @@ -263,6 +258,7 @@ pub struct ContradictAccessors { fn bindgen_test_layout_ContradictAccessors() { const UNINIT: ::std::mem::MaybeUninit<ContradictAccessors> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContradictAccessors>(), 16usize, @@ -275,7 +271,6 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize }, 0usize, @@ -288,7 +283,6 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mNoAccessors) as usize - ptr as usize }, 4usize, @@ -301,7 +295,6 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mUnsafeAccessors) as usize - ptr as usize }, @@ -315,7 +308,6 @@ fn bindgen_test_layout_ContradictAccessors() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mImmutableAccessor) as usize - ptr as usize }, @@ -362,6 +354,7 @@ pub struct Replaced { fn bindgen_test_layout_Replaced() { const UNINIT: ::std::mem::MaybeUninit<Replaced> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Replaced>(), 4usize, @@ -374,7 +367,6 @@ fn bindgen_test_layout_Replaced() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mAccessor) as usize - ptr as usize }, 0usize, @@ -406,6 +398,7 @@ pub struct Wrapper { fn bindgen_test_layout_Wrapper() { const UNINIT: ::std::mem::MaybeUninit<Wrapper> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Wrapper>(), 4usize, @@ -418,7 +411,6 @@ fn bindgen_test_layout_Wrapper() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mReplaced) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/allowlist-file.rs b/tests/expectations/tests/allowlist-file.rs index 2b6437c0..3b72fb75 100644 --- a/tests/expectations/tests/allowlist-file.rs +++ b/tests/expectations/tests/allowlist-file.rs @@ -60,6 +60,7 @@ pub struct StructWithAllowlistedDefinition { fn bindgen_test_layout_StructWithAllowlistedDefinition() { const UNINIT: ::std::mem::MaybeUninit<StructWithAllowlistedDefinition> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<StructWithAllowlistedDefinition>(), 8usize, @@ -71,10 +72,7 @@ fn bindgen_test_layout_StructWithAllowlistedDefinition() { concat!("Alignment of ", stringify!(StructWithAllowlistedDefinition)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).other) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).other) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -102,6 +100,7 @@ pub struct StructWithAllowlistedFwdDecl { fn bindgen_test_layout_StructWithAllowlistedFwdDecl() { const UNINIT: ::std::mem::MaybeUninit<StructWithAllowlistedFwdDecl> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<StructWithAllowlistedFwdDecl>(), 4usize, @@ -113,10 +112,7 @@ fn bindgen_test_layout_StructWithAllowlistedFwdDecl() { concat!("Alignment of ", stringify!(StructWithAllowlistedFwdDecl)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -135,6 +131,7 @@ pub struct AllowlistMe { fn bindgen_test_layout_AllowlistMe() { const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllowlistMe>(), 4usize, @@ -146,10 +143,7 @@ fn bindgen_test_layout_AllowlistMe() { concat!("Alignment of ", stringify!(AllowlistMe)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/allowlist-namespaces.rs b/tests/expectations/tests/allowlist-namespaces.rs index dd6ca222..ee9fe428 100644 --- a/tests/expectations/tests/allowlist-namespaces.rs +++ b/tests/expectations/tests/allowlist-namespaces.rs @@ -43,6 +43,7 @@ pub mod root { fn bindgen_test_layout_Test() { const UNINIT: ::std::mem::MaybeUninit<Test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test>(), 1usize, @@ -55,7 +56,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).helper) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/allowlisted-item-references-no-hash.rs b/tests/expectations/tests/allowlisted-item-references-no-hash.rs index f78e3cb4..56dc5bce 100644 --- a/tests/expectations/tests/allowlisted-item-references-no-hash.rs +++ b/tests/expectations/tests/allowlisted-item-references-no-hash.rs @@ -32,6 +32,7 @@ pub struct AllowlistMe { fn bindgen_test_layout_AllowlistMe() { const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllowlistMe>(), 1usize, @@ -43,10 +44,7 @@ fn bindgen_test_layout_AllowlistMe() { concat!("Alignment of ", stringify!(AllowlistMe)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs b/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs index e0a2accf..36cdda0e 100644 --- a/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs +++ b/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs @@ -32,6 +32,7 @@ pub struct AllowlistMe { fn bindgen_test_layout_AllowlistMe() { const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllowlistMe>(), 1usize, @@ -43,10 +44,7 @@ fn bindgen_test_layout_AllowlistMe() { concat!("Alignment of ", stringify!(AllowlistMe)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/allowlisted_item_references_no_copy.rs b/tests/expectations/tests/allowlisted_item_references_no_copy.rs index 4a598831..625e0ce6 100644 --- a/tests/expectations/tests/allowlisted_item_references_no_copy.rs +++ b/tests/expectations/tests/allowlisted_item_references_no_copy.rs @@ -32,6 +32,7 @@ pub struct AllowlistMe { fn bindgen_test_layout_AllowlistMe() { const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllowlistMe>(), 1usize, @@ -43,10 +44,7 @@ fn bindgen_test_layout_AllowlistMe() { concat!("Alignment of ", stringify!(AllowlistMe)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs index 3c02bd4d..a90c4261 100644 --- a/tests/expectations/tests/annotation_hide.rs +++ b/tests/expectations/tests/annotation_hide.rs @@ -34,6 +34,7 @@ pub struct NotAnnotated { fn bindgen_test_layout_NotAnnotated() { const UNINIT: ::std::mem::MaybeUninit<NotAnnotated> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NotAnnotated>(), 4usize, @@ -45,10 +46,7 @@ fn bindgen_test_layout_NotAnnotated() { concat!("Alignment of ", stringify!(NotAnnotated)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/anon-fields-prefix.rs b/tests/expectations/tests/anon-fields-prefix.rs index 78e786df..d09cab40 100644 --- a/tests/expectations/tests/anon-fields-prefix.rs +++ b/tests/expectations/tests/anon-fields-prefix.rs @@ -23,6 +23,7 @@ pub struct color__bindgen_ty_1 { fn bindgen_test_layout_color__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<color__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<color__bindgen_ty_1>(), 3usize, @@ -34,10 +35,7 @@ fn bindgen_test_layout_color__bindgen_ty_1() { concat!("Alignment of ", stringify!(color__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -47,10 +45,7 @@ fn bindgen_test_layout_color__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", @@ -60,10 +55,7 @@ fn bindgen_test_layout_color__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -84,6 +76,7 @@ pub struct color__bindgen_ty_2 { fn bindgen_test_layout_color__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<color__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<color__bindgen_ty_2>(), 3usize, @@ -95,10 +88,7 @@ fn bindgen_test_layout_color__bindgen_ty_2() { concat!("Alignment of ", stringify!(color__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -108,10 +98,7 @@ fn bindgen_test_layout_color__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", @@ -121,10 +108,7 @@ fn bindgen_test_layout_color__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -138,6 +122,7 @@ fn bindgen_test_layout_color__bindgen_ty_2() { fn bindgen_test_layout_color() { const UNINIT: ::std::mem::MaybeUninit<color> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<color>(), 3usize, @@ -149,10 +134,7 @@ fn bindgen_test_layout_color() { concat!("Alignment of ", stringify!(color)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).v3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).v3) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(color), "::", stringify!(v3)) ); diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs index bf643e99..429f94ce 100644 --- a/tests/expectations/tests/anon_enum.rs +++ b/tests/expectations/tests/anon_enum.rs @@ -21,6 +21,7 @@ pub enum Test__bindgen_ty_1 { fn bindgen_test_layout_Test() { const UNINIT: ::std::mem::MaybeUninit<Test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test>(), 8usize, @@ -32,18 +33,12 @@ fn bindgen_test_layout_Test() { concat!("Alignment of ", stringify!(Test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs index 15ec9221..f32b057b 100644 --- a/tests/expectations/tests/anon_struct_in_union.rs +++ b/tests/expectations/tests/anon_struct_in_union.rs @@ -24,6 +24,7 @@ pub struct s__bindgen_ty_1_inner { fn bindgen_test_layout_s__bindgen_ty_1_inner() { const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1_inner> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<s__bindgen_ty_1_inner>(), 4usize, @@ -35,10 +36,7 @@ fn bindgen_test_layout_s__bindgen_ty_1_inner() { concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -52,6 +50,7 @@ fn bindgen_test_layout_s__bindgen_ty_1_inner() { fn bindgen_test_layout_s__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<s__bindgen_ty_1>(), 4usize, @@ -63,10 +62,7 @@ fn bindgen_test_layout_s__bindgen_ty_1() { concat!("Alignment of ", stringify!(s__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -89,6 +85,7 @@ impl Default for s__bindgen_ty_1 { fn bindgen_test_layout_s() { const UNINIT: ::std::mem::MaybeUninit<s> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<s>(), 4usize, @@ -100,10 +97,7 @@ fn bindgen_test_layout_s() { concat!("Alignment of ", stringify!(s)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(s), "::", stringify!(u)) ); diff --git a/tests/expectations/tests/anon_struct_in_union_1_0.rs b/tests/expectations/tests/anon_struct_in_union_1_0.rs index 8b04ea03..cbc5ac9b 100644 --- a/tests/expectations/tests/anon_struct_in_union_1_0.rs +++ b/tests/expectations/tests/anon_struct_in_union_1_0.rs @@ -68,6 +68,7 @@ pub struct s__bindgen_ty_1_inner { fn bindgen_test_layout_s__bindgen_ty_1_inner() { const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1_inner> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<s__bindgen_ty_1_inner>(), 4usize, @@ -79,10 +80,7 @@ fn bindgen_test_layout_s__bindgen_ty_1_inner() { concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -101,6 +99,7 @@ impl Clone for s__bindgen_ty_1_inner { fn bindgen_test_layout_s__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<s__bindgen_ty_1>(), 4usize, @@ -112,10 +111,7 @@ fn bindgen_test_layout_s__bindgen_ty_1() { concat!("Alignment of ", stringify!(s__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -134,6 +130,7 @@ impl Clone for s__bindgen_ty_1 { fn bindgen_test_layout_s() { const UNINIT: ::std::mem::MaybeUninit<s> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<s>(), 4usize, @@ -145,10 +142,7 @@ fn bindgen_test_layout_s() { concat!("Alignment of ", stringify!(s)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(s), "::", stringify!(u)) ); diff --git a/tests/expectations/tests/array-of-zero-sized-types.rs b/tests/expectations/tests/array-of-zero-sized-types.rs index aed6386a..ad1f22ed 100644 --- a/tests/expectations/tests/array-of-zero-sized-types.rs +++ b/tests/expectations/tests/array-of-zero-sized-types.rs @@ -35,6 +35,7 @@ pub struct HasArrayOfEmpty { fn bindgen_test_layout_HasArrayOfEmpty() { const UNINIT: ::std::mem::MaybeUninit<HasArrayOfEmpty> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<HasArrayOfEmpty>(), 10usize, @@ -46,10 +47,7 @@ fn bindgen_test_layout_HasArrayOfEmpty() { concat!("Alignment of ", stringify!(HasArrayOfEmpty)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).empties) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).empties) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/bindgen-union-inside-namespace.rs b/tests/expectations/tests/bindgen-union-inside-namespace.rs index fa20e6f7..8a091cb5 100644 --- a/tests/expectations/tests/bindgen-union-inside-namespace.rs +++ b/tests/expectations/tests/bindgen-union-inside-namespace.rs @@ -69,6 +69,7 @@ pub mod root { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -81,7 +82,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, @@ -94,7 +94,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/bitfield-linux-32.rs b/tests/expectations/tests/bitfield-linux-32.rs index b80f2514..44c68626 100644 --- a/tests/expectations/tests/bitfield-linux-32.rs +++ b/tests/expectations/tests/bitfield-linux-32.rs @@ -102,6 +102,7 @@ pub struct Test { fn bindgen_test_layout_Test() { const UNINIT: ::std::mem::MaybeUninit<Test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test>(), 16usize, @@ -113,10 +114,7 @@ fn bindgen_test_layout_Test() { concat!("Alignment of ", stringify!(Test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo)) ); diff --git a/tests/expectations/tests/bitfield_align.rs b/tests/expectations/tests/bitfield_align.rs index 0d67f44e..4baca112 100644 --- a/tests/expectations/tests/bitfield_align.rs +++ b/tests/expectations/tests/bitfield_align.rs @@ -104,6 +104,7 @@ pub struct A { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 4usize, @@ -115,18 +116,12 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(x)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 3usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(y)) ); @@ -397,6 +392,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 8usize, @@ -408,18 +404,12 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(x)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(baz)) ); @@ -702,6 +692,7 @@ pub struct Date3 { fn bindgen_test_layout_Date3() { const UNINIT: ::std::mem::MaybeUninit<Date3> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Date3>(), 4usize, @@ -713,10 +704,7 @@ fn bindgen_test_layout_Date3() { concat!("Alignment of ", stringify!(Date3)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).byte) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).byte) as usize - ptr as usize }, 3usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/blocklist-and-impl-debug.rs b/tests/expectations/tests/blocklist-and-impl-debug.rs index f72c59bb..788cb30c 100644 --- a/tests/expectations/tests/blocklist-and-impl-debug.rs +++ b/tests/expectations/tests/blocklist-and-impl-debug.rs @@ -16,6 +16,7 @@ pub struct ShouldManuallyImplDebug { fn bindgen_test_layout_ShouldManuallyImplDebug() { const UNINIT: ::std::mem::MaybeUninit<ShouldManuallyImplDebug> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldManuallyImplDebug>(), 1usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_ShouldManuallyImplDebug() { concat!("Alignment of ", stringify!(ShouldManuallyImplDebug)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/blocklist-file.rs b/tests/expectations/tests/blocklist-file.rs index d897e593..4d2b6712 100644 --- a/tests/expectations/tests/blocklist-file.rs +++ b/tests/expectations/tests/blocklist-file.rs @@ -16,6 +16,7 @@ pub struct SizedIntegers { fn bindgen_test_layout_SizedIntegers() { const UNINIT: ::std::mem::MaybeUninit<SizedIntegers> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<SizedIntegers>(), 8usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_SizedIntegers() { concat!("Alignment of ", stringify!(SizedIntegers)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -40,10 +38,7 @@ fn bindgen_test_layout_SizedIntegers() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -53,10 +48,7 @@ fn bindgen_test_layout_SizedIntegers() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).z) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).z) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -75,6 +67,7 @@ pub struct StructWithBlocklistedFwdDecl { fn bindgen_test_layout_StructWithBlocklistedFwdDecl() { const UNINIT: ::std::mem::MaybeUninit<StructWithBlocklistedFwdDecl> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<StructWithBlocklistedFwdDecl>(), 1usize, @@ -86,10 +79,7 @@ fn bindgen_test_layout_StructWithBlocklistedFwdDecl() { concat!("Alignment of ", stringify!(StructWithBlocklistedFwdDecl)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/blocks-signature.rs b/tests/expectations/tests/blocks-signature.rs index faf9521c..779d0ecb 100644 --- a/tests/expectations/tests/blocks-signature.rs +++ b/tests/expectations/tests/blocks-signature.rs @@ -39,6 +39,7 @@ pub struct contains_block_pointers { fn bindgen_test_layout_contains_block_pointers() { const UNINIT: ::std::mem::MaybeUninit<contains_block_pointers> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<contains_block_pointers>(), 16usize, @@ -50,10 +51,7 @@ fn bindgen_test_layout_contains_block_pointers() { concat!("Alignment of ", stringify!(contains_block_pointers)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -63,10 +61,7 @@ fn bindgen_test_layout_contains_block_pointers() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/blocks.rs b/tests/expectations/tests/blocks.rs index da4d3e85..dbafaf94 100644 --- a/tests/expectations/tests/blocks.rs +++ b/tests/expectations/tests/blocks.rs @@ -38,6 +38,7 @@ pub struct contains_block_pointers { fn bindgen_test_layout_contains_block_pointers() { const UNINIT: ::std::mem::MaybeUninit<contains_block_pointers> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<contains_block_pointers>(), 16usize, @@ -49,10 +50,7 @@ fn bindgen_test_layout_contains_block_pointers() { concat!("Alignment of ", stringify!(contains_block_pointers)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -62,10 +60,7 @@ fn bindgen_test_layout_contains_block_pointers() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/c_naming.rs b/tests/expectations/tests/c_naming.rs index 6c221fcd..3e56b1d6 100644 --- a/tests/expectations/tests/c_naming.rs +++ b/tests/expectations/tests/c_naming.rs @@ -14,6 +14,7 @@ pub struct struct_a { fn bindgen_test_layout_struct_a() { const UNINIT: ::std::mem::MaybeUninit<struct_a> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<struct_a>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_struct_a() { concat!("Alignment of ", stringify!(struct_a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -49,6 +47,7 @@ pub union union_b { fn bindgen_test_layout_union_b() { const UNINIT: ::std::mem::MaybeUninit<union_b> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<union_b>(), 4usize, @@ -60,10 +59,7 @@ fn bindgen_test_layout_union_b() { concat!("Alignment of ", stringify!(union_b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -73,10 +69,7 @@ fn bindgen_test_layout_union_b() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/canonical-types.rs b/tests/expectations/tests/canonical-types.rs index b1b88f8c..a68e1424 100644 --- a/tests/expectations/tests/canonical-types.rs +++ b/tests/expectations/tests/canonical-types.rs @@ -168,6 +168,7 @@ pub struct ClassAInner { fn bindgen_test_layout_ClassAInner() { const UNINIT: ::std::mem::MaybeUninit<ClassAInner> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ClassAInner>(), 8usize, @@ -179,10 +180,7 @@ fn bindgen_test_layout_ClassAInner() { concat!("Alignment of ", stringify!(ClassAInner)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -210,6 +208,7 @@ pub struct ClassCInnerA { fn bindgen_test_layout_ClassCInnerA() { const UNINIT: ::std::mem::MaybeUninit<ClassCInnerA> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ClassCInnerA>(), 8usize, @@ -221,10 +220,7 @@ fn bindgen_test_layout_ClassCInnerA() { concat!("Alignment of ", stringify!(ClassCInnerA)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -252,6 +248,7 @@ pub struct ClassCInnerB { fn bindgen_test_layout_ClassCInnerB() { const UNINIT: ::std::mem::MaybeUninit<ClassCInnerB> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ClassCInnerB>(), 8usize, @@ -263,10 +260,7 @@ fn bindgen_test_layout_ClassCInnerB() { concat!("Alignment of ", stringify!(ClassCInnerB)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cache) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cache) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs index 99dbbc85..960a681f 100644 --- a/tests/expectations/tests/char.rs +++ b/tests/expectations/tests/char.rs @@ -28,6 +28,7 @@ pub struct Test { fn bindgen_test_layout_Test() { const UNINIT: ::std::mem::MaybeUninit<Test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test>(), 12usize, @@ -39,82 +40,52 @@ fn bindgen_test_layout_Test() { concat!("Alignment of ", stringify!(Test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 1usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(u)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 2usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize }, 3usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize }, 5usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize }, 6usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize }, 7usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize }, 9usize, concat!( "Offset of field: ", @@ -124,18 +95,12 @@ fn bindgen_test_layout_Test() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize }, 10usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize }, 11usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd)) ); diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs index f26c77b7..8542135b 100644 --- a/tests/expectations/tests/class.rs +++ b/tests/expectations/tests/class.rs @@ -45,6 +45,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 40usize, @@ -56,16 +57,12 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -96,6 +93,7 @@ pub struct C_with_zero_length_array { fn bindgen_test_layout_C_with_zero_length_array() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array>(), 40usize, @@ -107,10 +105,7 @@ fn bindgen_test_layout_C_with_zero_length_array() { concat!("Alignment of ", stringify!(C_with_zero_length_array)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -121,7 +116,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -134,7 +128,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -166,6 +159,7 @@ pub struct C_with_zero_length_array_2 { fn bindgen_test_layout_C_with_zero_length_array_2() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_2>(), 4usize, @@ -177,10 +171,7 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -191,7 +182,6 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -323,6 +313,7 @@ pub struct WithDtor { fn bindgen_test_layout_WithDtor() { const UNINIT: ::std::mem::MaybeUninit<WithDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithDtor>(), 4usize, @@ -334,10 +325,7 @@ fn bindgen_test_layout_WithDtor() { concat!("Alignment of ", stringify!(WithDtor)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -384,6 +372,7 @@ pub union Union { fn bindgen_test_layout_Union() { const UNINIT: ::std::mem::MaybeUninit<Union> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Union>(), 4usize, @@ -395,18 +384,12 @@ fn bindgen_test_layout_Union() { concat!("Alignment of ", stringify!(Union)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(i)) ); @@ -429,6 +412,7 @@ pub struct WithUnion { fn bindgen_test_layout_WithUnion() { const UNINIT: ::std::mem::MaybeUninit<WithUnion> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithUnion>(), 4usize, @@ -440,10 +424,7 @@ fn bindgen_test_layout_WithUnion() { concat!("Alignment of ", stringify!(WithUnion)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_1_0.rs b/tests/expectations/tests/class_1_0.rs index c17e48d4..f6c3021e 100644 --- a/tests/expectations/tests/class_1_0.rs +++ b/tests/expectations/tests/class_1_0.rs @@ -88,6 +88,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 40usize, @@ -99,16 +100,12 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -149,6 +146,7 @@ pub struct C_with_zero_length_array { fn bindgen_test_layout_C_with_zero_length_array() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array>(), 40usize, @@ -160,10 +158,7 @@ fn bindgen_test_layout_C_with_zero_length_array() { concat!("Alignment of ", stringify!(C_with_zero_length_array)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -174,7 +169,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -187,7 +181,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -219,6 +212,7 @@ pub struct C_with_zero_length_array_2 { fn bindgen_test_layout_C_with_zero_length_array_2() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_2>(), 4usize, @@ -230,10 +224,7 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -244,7 +235,6 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -376,6 +366,7 @@ pub struct WithDtor { fn bindgen_test_layout_WithDtor() { const UNINIT: ::std::mem::MaybeUninit<WithDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithDtor>(), 4usize, @@ -387,10 +378,7 @@ fn bindgen_test_layout_WithDtor() { concat!("Alignment of ", stringify!(WithDtor)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -438,6 +426,7 @@ pub struct Union { fn bindgen_test_layout_Union() { const UNINIT: ::std::mem::MaybeUninit<Union> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Union>(), 4usize, @@ -449,18 +438,12 @@ fn bindgen_test_layout_Union() { concat!("Alignment of ", stringify!(Union)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(i)) ); @@ -479,6 +462,7 @@ pub struct WithUnion { fn bindgen_test_layout_WithUnion() { const UNINIT: ::std::mem::MaybeUninit<WithUnion> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithUnion>(), 4usize, @@ -490,10 +474,7 @@ fn bindgen_test_layout_WithUnion() { concat!("Alignment of ", stringify!(WithUnion)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index 6e5b3f70..f2cc8326 100644 --- a/tests/expectations/tests/class_nested.rs +++ b/tests/expectations/tests/class_nested.rs @@ -19,6 +19,7 @@ pub struct A_B { fn bindgen_test_layout_A_B() { const UNINIT: ::std::mem::MaybeUninit<A_B> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A_B>(), 4usize, @@ -31,7 +32,6 @@ fn bindgen_test_layout_A_B() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).member_b) as usize - ptr as usize }, 0usize, @@ -62,6 +62,7 @@ impl<T> Default for A_D<T> { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 4usize, @@ -74,7 +75,6 @@ fn bindgen_test_layout_A() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).member_a) as usize - ptr as usize }, 0usize, @@ -95,6 +95,7 @@ pub struct A_C { fn bindgen_test_layout_A_C() { const UNINIT: ::std::mem::MaybeUninit<A_C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A_C>(), 4usize, @@ -106,10 +107,7 @@ fn bindgen_test_layout_A_C() { concat!("Alignment of ", stringify!(A_C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A_C), "::", stringify!(baz)) ); @@ -148,6 +146,7 @@ pub struct D { fn bindgen_test_layout_D() { const UNINIT: ::std::mem::MaybeUninit<D> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<D>(), 4usize, @@ -159,10 +158,7 @@ fn bindgen_test_layout_D() { concat!("Alignment of ", stringify!(D)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(D), "::", stringify!(member)) ); diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs index 95148745..676590c8 100644 --- a/tests/expectations/tests/class_no_members.rs +++ b/tests/expectations/tests/class_no_members.rs @@ -50,6 +50,7 @@ pub struct whatever_child_with_member { fn bindgen_test_layout_whatever_child_with_member() { const UNINIT: ::std::mem::MaybeUninit<whatever_child_with_member> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<whatever_child_with_member>(), 4usize, @@ -62,7 +63,6 @@ fn bindgen_test_layout_whatever_child_with_member() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs index d73a7f1c..ef130c16 100644 --- a/tests/expectations/tests/class_use_as.rs +++ b/tests/expectations/tests/class_use_as.rs @@ -15,6 +15,7 @@ pub struct whatever { fn bindgen_test_layout_whatever() { const UNINIT: ::std::mem::MaybeUninit<whatever> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<whatever>(), 4usize, @@ -27,7 +28,6 @@ fn bindgen_test_layout_whatever() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).replacement) as usize - ptr as usize }, 0usize, @@ -48,6 +48,7 @@ pub struct container { fn bindgen_test_layout_container() { const UNINIT: ::std::mem::MaybeUninit<container> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<container>(), 4usize, @@ -59,10 +60,7 @@ fn bindgen_test_layout_container() { concat!("Alignment of ", stringify!(container)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs index 78dd37d4..86d2a576 100644 --- a/tests/expectations/tests/class_with_dtor.rs +++ b/tests/expectations/tests/class_with_dtor.rs @@ -30,6 +30,7 @@ pub struct WithoutDtor { fn bindgen_test_layout_WithoutDtor() { const UNINIT: ::std::mem::MaybeUninit<WithoutDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithoutDtor>(), 8usize, @@ -42,7 +43,6 @@ fn bindgen_test_layout_WithoutDtor() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).shouldBeWithDtor) as usize - ptr as usize }, diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs index c8b36e9d..eab9d598 100644 --- a/tests/expectations/tests/class_with_inner_struct.rs +++ b/tests/expectations/tests/class_with_inner_struct.rs @@ -22,6 +22,7 @@ pub struct A_Segment { fn bindgen_test_layout_A_Segment() { const UNINIT: ::std::mem::MaybeUninit<A_Segment> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A_Segment>(), 8usize, @@ -33,10 +34,7 @@ fn bindgen_test_layout_A_Segment() { concat!("Alignment of ", stringify!(A_Segment)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -46,10 +44,7 @@ fn bindgen_test_layout_A_Segment() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -68,6 +63,7 @@ pub union A__bindgen_ty_1 { fn bindgen_test_layout_A__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<A__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A__bindgen_ty_1>(), 4usize, @@ -79,10 +75,7 @@ fn bindgen_test_layout_A__bindgen_ty_1() { concat!("Alignment of ", stringify!(A__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -110,6 +103,7 @@ pub union A__bindgen_ty_2 { fn bindgen_test_layout_A__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<A__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A__bindgen_ty_2>(), 4usize, @@ -121,10 +115,7 @@ fn bindgen_test_layout_A__bindgen_ty_2() { concat!("Alignment of ", stringify!(A__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -147,6 +138,7 @@ impl Default for A__bindgen_ty_2 { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 12usize, @@ -158,16 +150,12 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(c)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).named_union) as usize - ptr as usize }, 4usize, @@ -203,6 +191,7 @@ pub struct B_Segment { fn bindgen_test_layout_B_Segment() { const UNINIT: ::std::mem::MaybeUninit<B_Segment> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<B_Segment>(), 8usize, @@ -214,10 +203,7 @@ fn bindgen_test_layout_B_Segment() { concat!("Alignment of ", stringify!(B_Segment)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -227,10 +213,7 @@ fn bindgen_test_layout_B_Segment() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -244,6 +227,7 @@ fn bindgen_test_layout_B_Segment() { fn bindgen_test_layout_B() { const UNINIT: ::std::mem::MaybeUninit<B> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<B>(), 4usize, @@ -255,10 +239,7 @@ fn bindgen_test_layout_B() { concat!("Alignment of ", stringify!(B)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(B), "::", stringify!(d)) ); @@ -295,6 +276,7 @@ pub struct C__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<C__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_1>(), 16usize, @@ -306,10 +288,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mX1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mX1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -319,10 +298,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mY1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mY1) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -332,10 +308,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mX2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mX2) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -345,10 +318,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mY2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mY2) as usize - ptr as usize }, 12usize, concat!( "Offset of field: ", @@ -368,6 +338,7 @@ pub struct C__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<C__bindgen_ty_1__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_2>(), 8usize, @@ -380,7 +351,6 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mStepSyntax) as usize - ptr as usize }, 0usize, @@ -392,10 +362,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSteps) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mSteps) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -418,6 +385,7 @@ impl Default for C__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_C__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<C__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C__bindgen_ty_1>(), 16usize, @@ -429,10 +397,7 @@ fn bindgen_test_layout_C__bindgen_ty_1() { concat!("Alignment of ", stringify!(C__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFunc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFunc) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -461,6 +426,7 @@ pub struct C_Segment { fn bindgen_test_layout_C_Segment() { const UNINIT: ::std::mem::MaybeUninit<C_Segment> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_Segment>(), 8usize, @@ -472,10 +438,7 @@ fn bindgen_test_layout_C_Segment() { concat!("Alignment of ", stringify!(C_Segment)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -485,10 +448,7 @@ fn bindgen_test_layout_C_Segment() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -502,6 +462,7 @@ fn bindgen_test_layout_C_Segment() { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 20usize, @@ -513,10 +474,7 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(d)) ); diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs index 5a3116fd..42656079 100644 --- a/tests/expectations/tests/class_with_inner_struct_1_0.rs +++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs @@ -65,6 +65,7 @@ pub struct A_Segment { fn bindgen_test_layout_A_Segment() { const UNINIT: ::std::mem::MaybeUninit<A_Segment> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A_Segment>(), 8usize, @@ -76,10 +77,7 @@ fn bindgen_test_layout_A_Segment() { concat!("Alignment of ", stringify!(A_Segment)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -89,10 +87,7 @@ fn bindgen_test_layout_A_Segment() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -117,6 +112,7 @@ pub struct A__bindgen_ty_1 { fn bindgen_test_layout_A__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<A__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A__bindgen_ty_1>(), 4usize, @@ -128,10 +124,7 @@ fn bindgen_test_layout_A__bindgen_ty_1() { concat!("Alignment of ", stringify!(A__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -156,6 +149,7 @@ pub struct A__bindgen_ty_2 { fn bindgen_test_layout_A__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<A__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A__bindgen_ty_2>(), 4usize, @@ -167,10 +161,7 @@ fn bindgen_test_layout_A__bindgen_ty_2() { concat!("Alignment of ", stringify!(A__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -189,6 +180,7 @@ impl Clone for A__bindgen_ty_2 { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 12usize, @@ -200,16 +192,12 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(c)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).named_union) as usize - ptr as usize }, 4usize, @@ -241,6 +229,7 @@ pub struct B_Segment { fn bindgen_test_layout_B_Segment() { const UNINIT: ::std::mem::MaybeUninit<B_Segment> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<B_Segment>(), 8usize, @@ -252,10 +241,7 @@ fn bindgen_test_layout_B_Segment() { concat!("Alignment of ", stringify!(B_Segment)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -265,10 +251,7 @@ fn bindgen_test_layout_B_Segment() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -287,6 +270,7 @@ impl Clone for B_Segment { fn bindgen_test_layout_B() { const UNINIT: ::std::mem::MaybeUninit<B> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<B>(), 4usize, @@ -298,10 +282,7 @@ fn bindgen_test_layout_B() { concat!("Alignment of ", stringify!(B)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(B), "::", stringify!(d)) ); @@ -344,6 +325,7 @@ pub struct C__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<C__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_1>(), 16usize, @@ -355,10 +337,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mX1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mX1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -368,10 +347,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mY1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mY1) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -381,10 +357,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mX2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mX2) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -394,10 +367,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mY2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mY2) as usize - ptr as usize }, 12usize, concat!( "Offset of field: ", @@ -422,6 +392,7 @@ pub struct C__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<C__bindgen_ty_1__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_2>(), 8usize, @@ -434,7 +405,6 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mStepSyntax) as usize - ptr as usize }, 0usize, @@ -446,10 +416,7 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSteps) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mSteps) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -477,6 +444,7 @@ impl Default for C__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_C__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<C__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C__bindgen_ty_1>(), 16usize, @@ -488,10 +456,7 @@ fn bindgen_test_layout_C__bindgen_ty_1() { concat!("Alignment of ", stringify!(C__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFunc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFunc) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -516,6 +481,7 @@ pub struct C_Segment { fn bindgen_test_layout_C_Segment() { const UNINIT: ::std::mem::MaybeUninit<C_Segment> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_Segment>(), 8usize, @@ -527,10 +493,7 @@ fn bindgen_test_layout_C_Segment() { concat!("Alignment of ", stringify!(C_Segment)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).begin) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -540,10 +503,7 @@ fn bindgen_test_layout_C_Segment() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -562,6 +522,7 @@ impl Clone for C_Segment { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 20usize, @@ -573,10 +534,7 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(d)) ); diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs index 74b938e6..65e86b27 100644 --- a/tests/expectations/tests/class_with_typedef.rs +++ b/tests/expectations/tests/class_with_typedef.rs @@ -21,6 +21,7 @@ pub type C_Lookup = *const ::std::os::raw::c_char; fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 72usize, @@ -32,40 +33,27 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(c)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(ptr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize }, 16usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(arr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 56usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(d)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).other_ptr) as usize - ptr as usize }, 64usize, @@ -130,6 +118,7 @@ pub struct D { fn bindgen_test_layout_D() { const UNINIT: ::std::mem::MaybeUninit<D> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<D>(), 80usize, @@ -141,10 +130,7 @@ fn bindgen_test_layout_D() { concat!("Alignment of ", stringify!(D)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, 72usize, concat!("Offset of field: ", stringify!(D), "::", stringify!(ptr)) ); diff --git a/tests/expectations/tests/comment-indent.rs b/tests/expectations/tests/comment-indent.rs index e02bfee0..3ad221aa 100644 --- a/tests/expectations/tests/comment-indent.rs +++ b/tests/expectations/tests/comment-indent.rs @@ -72,6 +72,7 @@ pub mod root { fn bindgen_test_layout_Baz() { const UNINIT: ::std::mem::MaybeUninit<Baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Baz>(), 4usize, @@ -84,7 +85,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs index c5633a6c..e9c4be9d 100644 --- a/tests/expectations/tests/complex.rs +++ b/tests/expectations/tests/complex.rs @@ -20,6 +20,7 @@ pub struct TestDouble { fn bindgen_test_layout_TestDouble() { const UNINIT: ::std::mem::MaybeUninit<TestDouble> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<TestDouble>(), 16usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_TestDouble() { concat!("Alignment of ", stringify!(TestDouble)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -53,6 +51,7 @@ pub struct TestDoublePtr { fn bindgen_test_layout_TestDoublePtr() { const UNINIT: ::std::mem::MaybeUninit<TestDoublePtr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<TestDoublePtr>(), 8usize, @@ -64,10 +63,7 @@ fn bindgen_test_layout_TestDoublePtr() { concat!("Alignment of ", stringify!(TestDoublePtr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -95,6 +91,7 @@ pub struct TestFloat { fn bindgen_test_layout_TestFloat() { const UNINIT: ::std::mem::MaybeUninit<TestFloat> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<TestFloat>(), 8usize, @@ -106,10 +103,7 @@ fn bindgen_test_layout_TestFloat() { concat!("Alignment of ", stringify!(TestFloat)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -128,6 +122,7 @@ pub struct TestFloatPtr { fn bindgen_test_layout_TestFloatPtr() { const UNINIT: ::std::mem::MaybeUninit<TestFloatPtr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<TestFloatPtr>(), 8usize, @@ -139,10 +134,7 @@ fn bindgen_test_layout_TestFloatPtr() { concat!("Alignment of ", stringify!(TestFloatPtr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/const-const-mut-ptr.rs b/tests/expectations/tests/const-const-mut-ptr.rs index 5e0c7800..e8f13dff 100644 --- a/tests/expectations/tests/const-const-mut-ptr.rs +++ b/tests/expectations/tests/const-const-mut-ptr.rs @@ -14,6 +14,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/constified-enum-module-overflow.rs b/tests/expectations/tests/constified-enum-module-overflow.rs index ab81b173..d47338f1 100644 --- a/tests/expectations/tests/constified-enum-module-overflow.rs +++ b/tests/expectations/tests/constified-enum-module-overflow.rs @@ -25,6 +25,7 @@ pub struct A { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 1usize, @@ -36,10 +37,7 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(u)) ); diff --git a/tests/expectations/tests/constify-all-enums.rs b/tests/expectations/tests/constify-all-enums.rs index bfa255d6..e3c82156 100644 --- a/tests/expectations/tests/constify-all-enums.rs +++ b/tests/expectations/tests/constify-all-enums.rs @@ -18,6 +18,7 @@ pub struct bar { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 4usize, @@ -30,7 +31,6 @@ fn bindgen_test_layout_bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).this_should_work) as usize - ptr as usize }, diff --git a/tests/expectations/tests/constify-module-enums-basic.rs b/tests/expectations/tests/constify-module-enums-basic.rs index e74eb443..c5c32983 100644 --- a/tests/expectations/tests/constify-module-enums-basic.rs +++ b/tests/expectations/tests/constify-module-enums-basic.rs @@ -22,6 +22,7 @@ pub struct bar { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 4usize, @@ -34,7 +35,6 @@ fn bindgen_test_layout_bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).this_should_work) as usize - ptr as usize }, diff --git a/tests/expectations/tests/constify-module-enums-namespace.rs b/tests/expectations/tests/constify-module-enums-namespace.rs index 30955dfe..0b8eec1e 100644 --- a/tests/expectations/tests/constify-module-enums-namespace.rs +++ b/tests/expectations/tests/constify-module-enums-namespace.rs @@ -34,6 +34,7 @@ pub mod root { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 4usize, @@ -46,7 +47,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).this_should_work) as usize - ptr as usize }, diff --git a/tests/expectations/tests/constify-module-enums-shadow-name.rs b/tests/expectations/tests/constify-module-enums-shadow-name.rs index 21283c1c..44643d0f 100644 --- a/tests/expectations/tests/constify-module-enums-shadow-name.rs +++ b/tests/expectations/tests/constify-module-enums-shadow-name.rs @@ -21,6 +21,7 @@ pub struct bar { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 4usize, @@ -32,10 +33,7 @@ fn bindgen_test_layout_bar() { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/constify-module-enums-simple-alias.rs b/tests/expectations/tests/constify-module-enums-simple-alias.rs index 736a8880..0262b128 100644 --- a/tests/expectations/tests/constify-module-enums-simple-alias.rs +++ b/tests/expectations/tests/constify-module-enums-simple-alias.rs @@ -30,6 +30,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 48usize, @@ -41,40 +42,27 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz1) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz2) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz3) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz3)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz4) as usize - ptr as usize }, 12usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz4)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).baz_ptr1) as usize - ptr as usize }, 16usize, @@ -87,7 +75,6 @@ fn bindgen_test_layout_Bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).baz_ptr2) as usize - ptr as usize }, 24usize, @@ -100,7 +87,6 @@ fn bindgen_test_layout_Bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).baz_ptr3) as usize - ptr as usize }, 32usize, @@ -113,7 +99,6 @@ fn bindgen_test_layout_Bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).baz_ptr4) as usize - ptr as usize }, 40usize, diff --git a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs index 71dc1d70..75ebf48a 100644 --- a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs +++ b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs @@ -20,6 +20,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 16usize, @@ -31,18 +32,12 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz1) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz2) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz2)) ); diff --git a/tests/expectations/tests/constify-module-enums-types.rs b/tests/expectations/tests/constify-module-enums-types.rs index d22e2065..c3c6d3ca 100644 --- a/tests/expectations/tests/constify-module-enums-types.rs +++ b/tests/expectations/tests/constify-module-enums-types.rs @@ -55,6 +55,7 @@ pub struct bar { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 48usize, @@ -66,10 +67,7 @@ fn bindgen_test_layout_bar() { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -79,10 +77,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member2) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -92,10 +87,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member3) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -105,10 +97,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member4) as usize - ptr as usize }, 12usize, concat!( "Offset of field: ", @@ -118,10 +107,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member5) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member5) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -131,10 +117,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member6) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member6) as usize - ptr as usize }, 24usize, concat!( "Offset of field: ", @@ -144,10 +127,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member7) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member7) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -157,10 +137,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member8) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member8) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -170,10 +147,7 @@ fn bindgen_test_layout_bar() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member9) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member9) as usize - ptr as usize }, 40usize, concat!( "Offset of field: ", @@ -184,7 +158,6 @@ fn bindgen_test_layout_bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).member10) as usize - ptr as usize }, 44usize, @@ -214,6 +187,7 @@ pub struct Baz { fn bindgen_test_layout_Baz() { const UNINIT: ::std::mem::MaybeUninit<Baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Baz>(), 4usize, @@ -225,10 +199,7 @@ fn bindgen_test_layout_Baz() { concat!("Alignment of ", stringify!(Baz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -261,6 +232,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -272,10 +244,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs index 3a0f5586..62fc3749 100644 --- a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs +++ b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs @@ -35,6 +35,7 @@ pub struct Inherits { fn bindgen_test_layout_Inherits() { const UNINIT: ::std::mem::MaybeUninit<Inherits> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Inherits>(), 1usize, @@ -46,10 +47,7 @@ fn bindgen_test_layout_Inherits() { concat!("Alignment of ", stringify!(Inherits)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -71,6 +69,7 @@ pub struct Contains { fn bindgen_test_layout_Contains() { const UNINIT: ::std::mem::MaybeUninit<Contains> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Contains>(), 2usize, @@ -82,10 +81,7 @@ fn bindgen_test_layout_Contains() { concat!("Alignment of ", stringify!(Contains)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).empty) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).empty) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -95,10 +91,7 @@ fn bindgen_test_layout_Contains() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/convert-floats.rs b/tests/expectations/tests/convert-floats.rs index bd9ed3c8..e710a442 100644 --- a/tests/expectations/tests/convert-floats.rs +++ b/tests/expectations/tests/convert-floats.rs @@ -25,6 +25,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 48usize, @@ -36,34 +37,22 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(baz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bazz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bazz) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bazz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bazzz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bazzz) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -74,7 +63,6 @@ fn bindgen_test_layout_foo() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).complexFloat) as usize - ptr as usize }, 24usize, @@ -87,7 +75,6 @@ fn bindgen_test_layout_foo() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).complexDouble) as usize - ptr as usize }, 32usize, diff --git a/tests/expectations/tests/ctypes-prefix-path.rs b/tests/expectations/tests/ctypes-prefix-path.rs index 203f0759..5b3d186a 100644 --- a/tests/expectations/tests/ctypes-prefix-path.rs +++ b/tests/expectations/tests/ctypes-prefix-path.rs @@ -23,6 +23,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::core::mem::MaybeUninit<foo> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<foo>(), 16usize, @@ -34,26 +35,17 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs index 6b84111b..ea6621dd 100644 --- a/tests/expectations/tests/derive-bitfield-method-same-name.rs +++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs @@ -106,6 +106,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 136usize, @@ -117,10 +118,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-clone.rs b/tests/expectations/tests/derive-clone.rs index 6bdf35df..19c28b69 100644 --- a/tests/expectations/tests/derive-clone.rs +++ b/tests/expectations/tests/derive-clone.rs @@ -15,6 +15,7 @@ pub struct ShouldDeriveClone { fn bindgen_test_layout_ShouldDeriveClone() { const UNINIT: ::std::mem::MaybeUninit<ShouldDeriveClone> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldDeriveClone>(), 132usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_ShouldDeriveClone() { concat!("Alignment of ", stringify!(ShouldDeriveClone)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-clone_1_0.rs b/tests/expectations/tests/derive-clone_1_0.rs index 590e6637..3d72db2f 100644 --- a/tests/expectations/tests/derive-clone_1_0.rs +++ b/tests/expectations/tests/derive-clone_1_0.rs @@ -16,6 +16,7 @@ pub struct ShouldImplClone { fn bindgen_test_layout_ShouldImplClone() { const UNINIT: ::std::mem::MaybeUninit<ShouldImplClone> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldImplClone>(), 132usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_ShouldImplClone() { concat!("Alignment of ", stringify!(ShouldImplClone)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-debug-bitfield-core.rs b/tests/expectations/tests/derive-debug-bitfield-core.rs index b3cacd10..2a78e930 100644 --- a/tests/expectations/tests/derive-debug-bitfield-core.rs +++ b/tests/expectations/tests/derive-debug-bitfield-core.rs @@ -104,6 +104,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::core::mem::MaybeUninit<C> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<C>(), 204usize, @@ -116,7 +117,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::core::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize }, 4usize, diff --git a/tests/expectations/tests/derive-debug-bitfield.rs b/tests/expectations/tests/derive-debug-bitfield.rs index 1805335a..0ae8f329 100644 --- a/tests/expectations/tests/derive-debug-bitfield.rs +++ b/tests/expectations/tests/derive-debug-bitfield.rs @@ -102,6 +102,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 204usize, @@ -114,7 +115,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize }, 4usize, diff --git a/tests/expectations/tests/derive-debug-function-pointer.rs b/tests/expectations/tests/derive-debug-function-pointer.rs index 9b0df650..16b127bf 100644 --- a/tests/expectations/tests/derive-debug-function-pointer.rs +++ b/tests/expectations/tests/derive-debug-function-pointer.rs @@ -17,6 +17,7 @@ pub type Nice_Function = fn bindgen_test_layout_Nice() { const UNINIT: ::std::mem::MaybeUninit<Nice> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Nice>(), 144usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_Nice() { concat!("Alignment of ", stringify!(Nice)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pointer) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pointer) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -42,7 +40,6 @@ fn bindgen_test_layout_Nice() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize }, 8usize, diff --git a/tests/expectations/tests/derive-debug-mangle-name.rs b/tests/expectations/tests/derive-debug-mangle-name.rs index 30c7f816..a757d679 100644 --- a/tests/expectations/tests/derive-debug-mangle-name.rs +++ b/tests/expectations/tests/derive-debug-mangle-name.rs @@ -22,6 +22,7 @@ pub union perf_event_attr__bindgen_ty_1 { fn bindgen_test_layout_perf_event_attr__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<perf_event_attr__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<perf_event_attr__bindgen_ty_1>(), 4usize, @@ -33,10 +34,7 @@ fn bindgen_test_layout_perf_event_attr__bindgen_ty_1() { concat!("Alignment of ", stringify!(perf_event_attr__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -46,10 +44,7 @@ fn bindgen_test_layout_perf_event_attr__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -77,6 +72,7 @@ impl ::std::fmt::Debug for perf_event_attr__bindgen_ty_1 { fn bindgen_test_layout_perf_event_attr() { const UNINIT: ::std::mem::MaybeUninit<perf_event_attr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<perf_event_attr>(), 12usize, @@ -88,10 +84,7 @@ fn bindgen_test_layout_perf_event_attr() { concat!("Alignment of ", stringify!(perf_event_attr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -101,10 +94,7 @@ fn bindgen_test_layout_perf_event_attr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs index 1242df83..a0cc87ff 100644 --- a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs +++ b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs @@ -13,6 +13,7 @@ pub struct Instance { fn bindgen_test_layout_Instance() { const UNINIT: ::std::mem::MaybeUninit<Instance> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Instance>(), 200usize, @@ -24,10 +25,7 @@ fn bindgen_test_layout_Instance() { concat!("Alignment of ", stringify!(Instance)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-debug-opaque.rs b/tests/expectations/tests/derive-debug-opaque.rs index 0fe6b73c..5cebc9b8 100644 --- a/tests/expectations/tests/derive-debug-opaque.rs +++ b/tests/expectations/tests/derive-debug-opaque.rs @@ -45,6 +45,7 @@ pub struct OpaqueUser { fn bindgen_test_layout_OpaqueUser() { const UNINIT: ::std::mem::MaybeUninit<OpaqueUser> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<OpaqueUser>(), 164usize, @@ -56,10 +57,7 @@ fn bindgen_test_layout_OpaqueUser() { concat!("Alignment of ", stringify!(OpaqueUser)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-default-and-blocklist.rs b/tests/expectations/tests/derive-default-and-blocklist.rs index c50e2df2..fe3790c2 100644 --- a/tests/expectations/tests/derive-default-and-blocklist.rs +++ b/tests/expectations/tests/derive-default-and-blocklist.rs @@ -17,6 +17,7 @@ pub struct ShouldNotDeriveDefault { fn bindgen_test_layout_ShouldNotDeriveDefault() { const UNINIT: ::std::mem::MaybeUninit<ShouldNotDeriveDefault> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldNotDeriveDefault>(), 1usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_ShouldNotDeriveDefault() { concat!("Alignment of ", stringify!(ShouldNotDeriveDefault)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-fn-ptr.rs b/tests/expectations/tests/derive-fn-ptr.rs index 4ce06e04..9da0a40a 100644 --- a/tests/expectations/tests/derive-fn-ptr.rs +++ b/tests/expectations/tests/derive-fn-ptr.rs @@ -34,6 +34,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 8usize, @@ -46,7 +47,6 @@ fn bindgen_test_layout_Foo() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, 0usize, @@ -83,6 +83,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -95,7 +96,6 @@ fn bindgen_test_layout_Bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).callback) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/derive-hash-and-blocklist.rs b/tests/expectations/tests/derive-hash-and-blocklist.rs index 27cb8312..c677b15e 100644 --- a/tests/expectations/tests/derive-hash-and-blocklist.rs +++ b/tests/expectations/tests/derive-hash-and-blocklist.rs @@ -16,6 +16,7 @@ pub struct ShouldNotDeriveHash { fn bindgen_test_layout_ShouldNotDeriveHash() { const UNINIT: ::std::mem::MaybeUninit<ShouldNotDeriveHash> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldNotDeriveHash>(), 1usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_ShouldNotDeriveHash() { concat!("Alignment of ", stringify!(ShouldNotDeriveHash)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-blocklisting.rs b/tests/expectations/tests/derive-hash-blocklisting.rs index b00da661..868bf9f2 100644 --- a/tests/expectations/tests/derive-hash-blocklisting.rs +++ b/tests/expectations/tests/derive-hash-blocklisting.rs @@ -22,6 +22,7 @@ pub struct AllowlistedOne { fn bindgen_test_layout_AllowlistedOne() { const UNINIT: ::std::mem::MaybeUninit<AllowlistedOne> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllowlistedOne>(), 4usize, @@ -33,10 +34,7 @@ fn bindgen_test_layout_AllowlistedOne() { concat!("Alignment of ", stringify!(AllowlistedOne)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -64,6 +62,7 @@ pub struct AllowlistedTwo { fn bindgen_test_layout_AllowlistedTwo() { const UNINIT: ::std::mem::MaybeUninit<AllowlistedTwo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AllowlistedTwo>(), 4usize, @@ -75,10 +74,7 @@ fn bindgen_test_layout_AllowlistedTwo() { concat!("Alignment of ", stringify!(AllowlistedTwo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs index d0860e58..78c8449b 100644 --- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs +++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs @@ -21,6 +21,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -32,10 +33,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -45,10 +43,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -62,6 +57,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -73,10 +69,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/derive-hash-struct-with-float-array.rs b/tests/expectations/tests/derive-hash-struct-with-float-array.rs index 2a7168dd..a3f6013b 100644 --- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs +++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs @@ -15,6 +15,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 12usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs b/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs index 48fc7ed1..06c8da1b 100644 --- a/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs +++ b/tests/expectations/tests/derive-hash-struct-with-incomplete-array.rs @@ -45,6 +45,7 @@ pub struct test { fn bindgen_test_layout_test() { const UNINIT: ::std::mem::MaybeUninit<test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<test>(), 4usize, @@ -56,16 +57,12 @@ fn bindgen_test_layout_test() { concat!("Alignment of ", stringify!(test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(test), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs index 7bda695b..3efd55c9 100644 --- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs +++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs @@ -15,6 +15,7 @@ pub struct ConstPtrMutObj { fn bindgen_test_layout_ConstPtrMutObj() { const UNINIT: ::std::mem::MaybeUninit<ConstPtrMutObj> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ConstPtrMutObj>(), 8usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_ConstPtrMutObj() { concat!("Alignment of ", stringify!(ConstPtrMutObj)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -57,6 +55,7 @@ pub struct MutPtrMutObj { fn bindgen_test_layout_MutPtrMutObj() { const UNINIT: ::std::mem::MaybeUninit<MutPtrMutObj> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<MutPtrMutObj>(), 8usize, @@ -68,10 +67,7 @@ fn bindgen_test_layout_MutPtrMutObj() { concat!("Alignment of ", stringify!(MutPtrMutObj)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -99,6 +95,7 @@ pub struct MutPtrConstObj { fn bindgen_test_layout_MutPtrConstObj() { const UNINIT: ::std::mem::MaybeUninit<MutPtrConstObj> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<MutPtrConstObj>(), 8usize, @@ -110,10 +107,7 @@ fn bindgen_test_layout_MutPtrConstObj() { concat!("Alignment of ", stringify!(MutPtrConstObj)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -141,6 +135,7 @@ pub struct ConstPtrConstObj { fn bindgen_test_layout_ConstPtrConstObj() { const UNINIT: ::std::mem::MaybeUninit<ConstPtrConstObj> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ConstPtrConstObj>(), 8usize, @@ -152,10 +147,7 @@ fn bindgen_test_layout_ConstPtrConstObj() { concat!("Alignment of ", stringify!(ConstPtrConstObj)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs index 02b127e4..b2e2d8d0 100644 --- a/tests/expectations/tests/derive-hash-template-inst-float.rs +++ b/tests/expectations/tests/derive-hash-template-inst-float.rs @@ -31,6 +31,7 @@ pub struct IntStr { fn bindgen_test_layout_IntStr() { const UNINIT: ::std::mem::MaybeUninit<IntStr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<IntStr>(), 4usize, @@ -42,10 +43,7 @@ fn bindgen_test_layout_IntStr() { concat!("Alignment of ", stringify!(IntStr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(IntStr), "::", stringify!(a)) ); @@ -69,6 +67,7 @@ pub struct FloatStr { fn bindgen_test_layout_FloatStr() { const UNINIT: ::std::mem::MaybeUninit<FloatStr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<FloatStr>(), 4usize, @@ -80,10 +79,7 @@ fn bindgen_test_layout_FloatStr() { concat!("Alignment of ", stringify!(FloatStr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-and-blocklist.rs b/tests/expectations/tests/derive-partialeq-and-blocklist.rs index ff1a33dc..c772c0b9 100644 --- a/tests/expectations/tests/derive-partialeq-and-blocklist.rs +++ b/tests/expectations/tests/derive-partialeq-and-blocklist.rs @@ -17,6 +17,7 @@ pub struct ShouldNotDerivePartialEq { fn bindgen_test_layout_ShouldNotDerivePartialEq() { const UNINIT: ::std::mem::MaybeUninit<ShouldNotDerivePartialEq> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldNotDerivePartialEq>(), 1usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_ShouldNotDerivePartialEq() { concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-base.rs b/tests/expectations/tests/derive-partialeq-base.rs index 74b9d68b..840720f2 100644 --- a/tests/expectations/tests/derive-partialeq-base.rs +++ b/tests/expectations/tests/derive-partialeq-base.rs @@ -14,6 +14,7 @@ pub struct Base { fn bindgen_test_layout_Base() { const UNINIT: ::std::mem::MaybeUninit<Base> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Base>(), 132usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Base() { concat!("Alignment of ", stringify!(Base)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).large) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-bitfield.rs b/tests/expectations/tests/derive-partialeq-bitfield.rs index a6484e63..cb9781de 100644 --- a/tests/expectations/tests/derive-partialeq-bitfield.rs +++ b/tests/expectations/tests/derive-partialeq-bitfield.rs @@ -102,6 +102,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 204usize, @@ -114,7 +115,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize }, 4usize, diff --git a/tests/expectations/tests/derive-partialeq-core.rs b/tests/expectations/tests/derive-partialeq-core.rs index 1a4ae223..620b40fa 100644 --- a/tests/expectations/tests/derive-partialeq-core.rs +++ b/tests/expectations/tests/derive-partialeq-core.rs @@ -16,6 +16,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::core::mem::MaybeUninit<C> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<C>(), 1680usize, @@ -28,7 +29,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::core::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/derive-partialeq-pointer.rs b/tests/expectations/tests/derive-partialeq-pointer.rs index 89c9091f..e0d3c062 100644 --- a/tests/expectations/tests/derive-partialeq-pointer.rs +++ b/tests/expectations/tests/derive-partialeq-pointer.rs @@ -14,6 +14,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(b)) ); @@ -105,6 +103,7 @@ pub struct a { fn bindgen_test_layout_a() { const UNINIT: ::std::mem::MaybeUninit<a> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<a>(), 1usize, @@ -116,10 +115,7 @@ fn bindgen_test_layout_a() { concat!("Alignment of ", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(d)) ); diff --git a/tests/expectations/tests/derive-partialeq-union.rs b/tests/expectations/tests/derive-partialeq-union.rs index a0c501cc..5ffd0bcd 100644 --- a/tests/expectations/tests/derive-partialeq-union.rs +++ b/tests/expectations/tests/derive-partialeq-union.rs @@ -16,6 +16,7 @@ pub union ShouldNotDerivePartialEq { fn bindgen_test_layout_ShouldNotDerivePartialEq() { const UNINIT: ::std::mem::MaybeUninit<ShouldNotDerivePartialEq> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldNotDerivePartialEq>(), 4usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_ShouldNotDerivePartialEq() { concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -40,10 +38,7 @@ fn bindgen_test_layout_ShouldNotDerivePartialEq() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/derive-partialeq-union_1_0.rs b/tests/expectations/tests/derive-partialeq-union_1_0.rs index bf5061bf..a53b9ba8 100644 --- a/tests/expectations/tests/derive-partialeq-union_1_0.rs +++ b/tests/expectations/tests/derive-partialeq-union_1_0.rs @@ -60,6 +60,7 @@ pub struct ShouldDerivePartialEq { fn bindgen_test_layout_ShouldDerivePartialEq() { const UNINIT: ::std::mem::MaybeUninit<ShouldDerivePartialEq> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldDerivePartialEq>(), 152usize, @@ -71,10 +72,7 @@ fn bindgen_test_layout_ShouldDerivePartialEq() { concat!("Alignment of ", stringify!(ShouldDerivePartialEq)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -84,10 +82,7 @@ fn bindgen_test_layout_ShouldDerivePartialEq() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/disable-nested-struct-naming.rs b/tests/expectations/tests/disable-nested-struct-naming.rs index ccb6e1b0..ce8a01ad 100644 --- a/tests/expectations/tests/disable-nested-struct-naming.rs +++ b/tests/expectations/tests/disable-nested-struct-naming.rs @@ -37,6 +37,7 @@ pub struct bar4 { fn bindgen_test_layout_bar4() { const UNINIT: ::std::mem::MaybeUninit<bar4> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar4>(), 4usize, @@ -48,10 +49,7 @@ fn bindgen_test_layout_bar4() { concat!("Alignment of ", stringify!(bar4)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x4) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(bar4), "::", stringify!(x4)) ); @@ -60,6 +58,7 @@ fn bindgen_test_layout_bar4() { fn bindgen_test_layout_bar1__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<bar1__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar1__bindgen_ty_1__bindgen_ty_1>(), 8usize, @@ -74,10 +73,7 @@ fn bindgen_test_layout_bar1__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x3) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -87,10 +83,7 @@ fn bindgen_test_layout_bar1__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b4) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -104,6 +97,7 @@ fn bindgen_test_layout_bar1__bindgen_ty_1__bindgen_ty_1() { fn bindgen_test_layout_bar1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<bar1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar1__bindgen_ty_1>(), 12usize, @@ -115,10 +109,7 @@ fn bindgen_test_layout_bar1__bindgen_ty_1() { concat!("Alignment of ", stringify!(bar1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x2) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -128,10 +119,7 @@ fn bindgen_test_layout_bar1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b3) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -145,6 +133,7 @@ fn bindgen_test_layout_bar1__bindgen_ty_1() { fn bindgen_test_layout_bar1() { const UNINIT: ::std::mem::MaybeUninit<bar1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar1>(), 16usize, @@ -156,18 +145,12 @@ fn bindgen_test_layout_bar1() { concat!("Alignment of ", stringify!(bar1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x1) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(bar1), "::", stringify!(x1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(bar1), "::", stringify!(b2)) ); @@ -176,6 +159,7 @@ fn bindgen_test_layout_bar1() { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 16usize, @@ -187,10 +171,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(b1)) ); @@ -214,6 +195,7 @@ pub struct baz { fn bindgen_test_layout_baz() { const UNINIT: ::std::mem::MaybeUninit<baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<baz>(), 4usize, @@ -225,10 +207,7 @@ fn bindgen_test_layout_baz() { concat!("Alignment of ", stringify!(baz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(baz), "::", stringify!(x)) ); @@ -237,6 +216,7 @@ fn bindgen_test_layout_baz() { fn bindgen_test_layout__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<_bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_bindgen_ty_1__bindgen_ty_1>(), 4usize, @@ -248,10 +228,7 @@ fn bindgen_test_layout__bindgen_ty_1__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -265,6 +242,7 @@ fn bindgen_test_layout__bindgen_ty_1__bindgen_ty_1() { fn bindgen_test_layout__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<_bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_bindgen_ty_1>(), 4usize, @@ -276,10 +254,7 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).anon2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).anon2) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/disable-untagged-union.rs b/tests/expectations/tests/disable-untagged-union.rs index 0251c8df..515f496b 100644 --- a/tests/expectations/tests/disable-untagged-union.rs +++ b/tests/expectations/tests/disable-untagged-union.rs @@ -59,6 +59,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 4usize, @@ -70,18 +71,12 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/do-not-derive-copy.rs b/tests/expectations/tests/do-not-derive-copy.rs index 4d55df55..4f9081ad 100644 --- a/tests/expectations/tests/do-not-derive-copy.rs +++ b/tests/expectations/tests/do-not-derive-copy.rs @@ -14,6 +14,7 @@ pub struct WouldBeCopyButWeAreNotDerivingCopy { fn bindgen_test_layout_WouldBeCopyButWeAreNotDerivingCopy() { const UNINIT: ::std::mem::MaybeUninit<WouldBeCopyButWeAreNotDerivingCopy> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WouldBeCopyButWeAreNotDerivingCopy>(), 4usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_WouldBeCopyButWeAreNotDerivingCopy() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/doggo-or-null.rs b/tests/expectations/tests/doggo-or-null.rs index ff1e5363..90287159 100644 --- a/tests/expectations/tests/doggo-or-null.rs +++ b/tests/expectations/tests/doggo-or-null.rs @@ -14,6 +14,7 @@ pub struct Doggo { fn bindgen_test_layout_Doggo() { const UNINIT: ::std::mem::MaybeUninit<Doggo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Doggo>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Doggo() { concat!("Alignment of ", stringify!(Doggo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Doggo), "::", stringify!(x)) ); diff --git a/tests/expectations/tests/duplicated-namespaces-definitions.rs b/tests/expectations/tests/duplicated-namespaces-definitions.rs index 407e6f12..8e7c895b 100644 --- a/tests/expectations/tests/duplicated-namespaces-definitions.rs +++ b/tests/expectations/tests/duplicated-namespaces-definitions.rs @@ -22,6 +22,7 @@ pub mod root { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -34,7 +35,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, @@ -47,7 +47,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 4usize, @@ -72,6 +71,7 @@ pub mod root { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 8usize, @@ -84,7 +84,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/dynamic_loading_with_blocklist.rs b/tests/expectations/tests/dynamic_loading_with_blocklist.rs index 703d1f7f..af482ad9 100644 --- a/tests/expectations/tests/dynamic_loading_with_blocklist.rs +++ b/tests/expectations/tests/dynamic_loading_with_blocklist.rs @@ -14,6 +14,7 @@ pub struct X { 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, @@ -25,10 +26,7 @@ fn bindgen_test_layout_X() { concat!("Alignment of ", stringify!(X)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(X), "::", stringify!(_x)) ); diff --git a/tests/expectations/tests/dynamic_loading_with_class.rs b/tests/expectations/tests/dynamic_loading_with_class.rs index 6bcb1eef..514cff73 100644 --- a/tests/expectations/tests/dynamic_loading_with_class.rs +++ b/tests/expectations/tests/dynamic_loading_with_class.rs @@ -14,6 +14,7 @@ pub struct A { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._x) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(_x)) ); diff --git a/tests/expectations/tests/enum-default-bitfield.rs b/tests/expectations/tests/enum-default-bitfield.rs index 90d442f5..4c075766 100644 --- a/tests/expectations/tests/enum-default-bitfield.rs +++ b/tests/expectations/tests/enum-default-bitfield.rs @@ -45,6 +45,7 @@ pub struct foo__bindgen_ty_1(pub ::std::os::raw::c_uint); fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -56,10 +57,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/enum-default-consts.rs b/tests/expectations/tests/enum-default-consts.rs index c40b9034..ddce26c2 100644 --- a/tests/expectations/tests/enum-default-consts.rs +++ b/tests/expectations/tests/enum-default-consts.rs @@ -17,6 +17,7 @@ pub type foo__bindgen_ty_1 = ::std::os::raw::c_uint; fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/enum-default-module.rs b/tests/expectations/tests/enum-default-module.rs index 2990d8fc..ae026d8b 100644 --- a/tests/expectations/tests/enum-default-module.rs +++ b/tests/expectations/tests/enum-default-module.rs @@ -19,6 +19,7 @@ pub mod foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -30,10 +31,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/enum-default-rust.rs b/tests/expectations/tests/enum-default-rust.rs index fd799aee..c3b728f8 100644 --- a/tests/expectations/tests/enum-default-rust.rs +++ b/tests/expectations/tests/enum-default-rust.rs @@ -22,6 +22,7 @@ pub enum foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -33,10 +34,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/enum-no-debug-rust.rs b/tests/expectations/tests/enum-no-debug-rust.rs index d433d4cc..33c7b5c7 100644 --- a/tests/expectations/tests/enum-no-debug-rust.rs +++ b/tests/expectations/tests/enum-no-debug-rust.rs @@ -22,6 +22,7 @@ pub enum foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -33,10 +34,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/enum.rs b/tests/expectations/tests/enum.rs index 3c8e0814..65b734a3 100644 --- a/tests/expectations/tests/enum.rs +++ b/tests/expectations/tests/enum.rs @@ -17,6 +17,7 @@ pub type foo__bindgen_ty_1 = ::std::os::raw::c_uint; fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs index ca982c33..f414812b 100644 --- a/tests/expectations/tests/enum_and_vtable_mangling.rs +++ b/tests/expectations/tests/enum_and_vtable_mangling.rs @@ -27,6 +27,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 16usize, @@ -38,10 +39,7 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(i)) ); diff --git a/tests/expectations/tests/explicit-padding.rs b/tests/expectations/tests/explicit-padding.rs index 73d2b694..a6ea7671 100644 --- a/tests/expectations/tests/explicit-padding.rs +++ b/tests/expectations/tests/explicit-padding.rs @@ -18,6 +18,7 @@ pub struct pad_me { fn bindgen_test_layout_pad_me() { const UNINIT: ::std::mem::MaybeUninit<pad_me> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<pad_me>(), 12usize, @@ -29,10 +30,7 @@ fn bindgen_test_layout_pad_me() { concat!("Alignment of ", stringify!(pad_me)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).first) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).first) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -42,10 +40,7 @@ fn bindgen_test_layout_pad_me() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).second) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).second) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -55,10 +50,7 @@ fn bindgen_test_layout_pad_me() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).third) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).third) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -79,6 +71,7 @@ pub union dont_pad_me { fn bindgen_test_layout_dont_pad_me() { const UNINIT: ::std::mem::MaybeUninit<dont_pad_me> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<dont_pad_me>(), 4usize, @@ -90,10 +83,7 @@ fn bindgen_test_layout_dont_pad_me() { concat!("Alignment of ", stringify!(dont_pad_me)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).first) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).first) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -103,10 +93,7 @@ fn bindgen_test_layout_dont_pad_me() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).second) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).second) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -116,10 +103,7 @@ fn bindgen_test_layout_dont_pad_me() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).third) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).third) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/extern-const-struct.rs b/tests/expectations/tests/extern-const-struct.rs index e1af23c8..8060316a 100644 --- a/tests/expectations/tests/extern-const-struct.rs +++ b/tests/expectations/tests/extern-const-struct.rs @@ -14,6 +14,7 @@ pub struct nsFoo { fn bindgen_test_layout_nsFoo() { const UNINIT: ::std::mem::MaybeUninit<nsFoo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsFoo>(), 1600usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_nsFoo() { concat!("Alignment of ", stringify!(nsFoo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).details) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).details) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/forward-declaration-autoptr.rs b/tests/expectations/tests/forward-declaration-autoptr.rs index fc4203f5..9f4fdca0 100644 --- a/tests/expectations/tests/forward-declaration-autoptr.rs +++ b/tests/expectations/tests/forward-declaration-autoptr.rs @@ -34,6 +34,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -46,7 +47,6 @@ fn bindgen_test_layout_Bar() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs index f8f25bd6..c1b1f23d 100644 --- a/tests/expectations/tests/forward_declared_complex_types.rs +++ b/tests/expectations/tests/forward_declared_complex_types.rs @@ -37,6 +37,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -48,10 +49,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f)) ); diff --git a/tests/expectations/tests/forward_declared_complex_types_1_0.rs b/tests/expectations/tests/forward_declared_complex_types_1_0.rs index 5c749f82..ecdbe49d 100644 --- a/tests/expectations/tests/forward_declared_complex_types_1_0.rs +++ b/tests/expectations/tests/forward_declared_complex_types_1_0.rs @@ -47,6 +47,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -58,10 +59,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f)) ); diff --git a/tests/expectations/tests/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs index e65e0351..f877666a 100644 --- a/tests/expectations/tests/forward_declared_struct.rs +++ b/tests/expectations/tests/forward_declared_struct.rs @@ -14,6 +14,7 @@ pub struct a { fn bindgen_test_layout_a() { const UNINIT: ::std::mem::MaybeUninit<a> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<a>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_a() { concat!("Alignment of ", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(b)) ); @@ -42,6 +40,7 @@ pub struct c { fn bindgen_test_layout_c() { const UNINIT: ::std::mem::MaybeUninit<c> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<c>(), 4usize, @@ -53,10 +52,7 @@ fn bindgen_test_layout_c() { concat!("Alignment of ", stringify!(c)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(c), "::", stringify!(d)) ); diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs index 6e7357f7..745720d9 100644 --- a/tests/expectations/tests/func_ptr_in_struct.rs +++ b/tests/expectations/tests/func_ptr_in_struct.rs @@ -24,6 +24,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 8usize, @@ -35,10 +36,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/gen-destructors-neg.rs b/tests/expectations/tests/gen-destructors-neg.rs index 3b5193ae..b87eb1d4 100644 --- a/tests/expectations/tests/gen-destructors-neg.rs +++ b/tests/expectations/tests/gen-destructors-neg.rs @@ -14,6 +14,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/gen-destructors.rs b/tests/expectations/tests/gen-destructors.rs index dbd02151..1711f76d 100644 --- a/tests/expectations/tests/gen-destructors.rs +++ b/tests/expectations/tests/gen-destructors.rs @@ -14,6 +14,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/i128.rs b/tests/expectations/tests/i128.rs index addc227d..dee57a6d 100644 --- a/tests/expectations/tests/i128.rs +++ b/tests/expectations/tests/i128.rs @@ -16,6 +16,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 32usize, @@ -28,7 +29,6 @@ fn bindgen_test_layout_foo() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).my_signed) as usize - ptr as usize }, 0usize, @@ -41,7 +41,6 @@ fn bindgen_test_layout_foo() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).my_unsigned) as usize - ptr as usize }, 16usize, diff --git a/tests/expectations/tests/inline_namespace.rs b/tests/expectations/tests/inline_namespace.rs index 81446a96..c569bba6 100644 --- a/tests/expectations/tests/inline_namespace.rs +++ b/tests/expectations/tests/inline_namespace.rs @@ -23,6 +23,7 @@ pub mod root { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -34,10 +35,7 @@ pub mod root { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/inline_namespace_conservative.rs b/tests/expectations/tests/inline_namespace_conservative.rs index bbee2dee..4ffafd46 100644 --- a/tests/expectations/tests/inline_namespace_conservative.rs +++ b/tests/expectations/tests/inline_namespace_conservative.rs @@ -28,6 +28,7 @@ pub mod root { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -39,10 +40,7 @@ pub mod root { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs index 84dfdc37..69a7c39a 100644 --- a/tests/expectations/tests/inner_const.rs +++ b/tests/expectations/tests/inner_const.rs @@ -22,6 +22,7 @@ extern "C" { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 4usize, @@ -33,10 +34,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs index eed9885d..13d9ac14 100644 --- a/tests/expectations/tests/inner_template_self.rs +++ b/tests/expectations/tests/inner_template_self.rs @@ -29,6 +29,7 @@ pub struct InstantiateIt { fn bindgen_test_layout_InstantiateIt() { const UNINIT: ::std::mem::MaybeUninit<InstantiateIt> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<InstantiateIt>(), 16usize, @@ -40,10 +41,7 @@ fn bindgen_test_layout_InstantiateIt() { concat!("Alignment of ", stringify!(InstantiateIt)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m_list) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m_list) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1118-using-forward-decl.rs b/tests/expectations/tests/issue-1118-using-forward-decl.rs index 2596a6ba..e881c8c4 100644 --- a/tests/expectations/tests/issue-1118-using-forward-decl.rs +++ b/tests/expectations/tests/issue-1118-using-forward-decl.rs @@ -15,6 +15,7 @@ pub struct nsTArray_base { fn bindgen_test_layout_nsTArray_base() { const UNINIT: ::std::mem::MaybeUninit<nsTArray_base> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsTArray_base>(), 8usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_nsTArray_base() { concat!("Alignment of ", stringify!(nsTArray_base)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -71,6 +69,7 @@ pub struct nsIContent { fn bindgen_test_layout_nsIContent() { const UNINIT: ::std::mem::MaybeUninit<nsIContent> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsIContent>(), 8usize, @@ -82,10 +81,7 @@ fn bindgen_test_layout_nsIContent() { concat!("Alignment of ", stringify!(nsIContent)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1216-variadic-member.rs b/tests/expectations/tests/issue-1216-variadic-member.rs index c7ffa3b6..bb57c856 100644 --- a/tests/expectations/tests/issue-1216-variadic-member.rs +++ b/tests/expectations/tests/issue-1216-variadic-member.rs @@ -24,6 +24,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 8usize, @@ -35,10 +36,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f)) ); diff --git a/tests/expectations/tests/issue-1281.rs b/tests/expectations/tests/issue-1281.rs index ff3eb88a..db99cbce 100644 --- a/tests/expectations/tests/issue-1281.rs +++ b/tests/expectations/tests/issue-1281.rs @@ -19,6 +19,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -30,10 +31,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(foo)) ); @@ -42,6 +40,7 @@ fn bindgen_test_layout_foo() { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 4usize, @@ -53,10 +52,7 @@ fn bindgen_test_layout_bar() { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(bar), "::", stringify!(u)) ); @@ -71,6 +67,7 @@ pub struct baz { fn bindgen_test_layout_baz() { const UNINIT: ::std::mem::MaybeUninit<baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<baz>(), 4usize, @@ -82,10 +79,7 @@ fn bindgen_test_layout_baz() { concat!("Alignment of ", stringify!(baz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(baz), "::", stringify!(f)) ); diff --git a/tests/expectations/tests/issue-1285.rs b/tests/expectations/tests/issue-1285.rs index f97c5236..08aab0a9 100644 --- a/tests/expectations/tests/issue-1285.rs +++ b/tests/expectations/tests/issue-1285.rs @@ -20,6 +20,7 @@ pub union foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -70,6 +65,7 @@ impl Default for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -81,10 +77,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/issue-1291.rs b/tests/expectations/tests/issue-1291.rs index e7914e48..25f4f105 100644 --- a/tests/expectations/tests/issue-1291.rs +++ b/tests/expectations/tests/issue-1291.rs @@ -29,6 +29,7 @@ pub struct RTCRay { fn bindgen_test_layout_RTCRay() { const UNINIT: ::std::mem::MaybeUninit<RTCRay> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<RTCRay>(), 96usize, @@ -40,10 +41,7 @@ fn bindgen_test_layout_RTCRay() { concat!("Alignment of ", stringify!(RTCRay)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).org) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).org) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -53,10 +51,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).align0) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).align0) as usize - ptr as usize }, 12usize, concat!( "Offset of field: ", @@ -66,10 +61,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dir) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dir) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -79,10 +71,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).align1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).align1) as usize - ptr as usize }, 28usize, concat!( "Offset of field: ", @@ -92,10 +81,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tnear) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tnear) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -105,10 +91,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tfar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tfar) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -118,10 +101,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).time) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).time) as usize - ptr as usize }, 40usize, concat!( "Offset of field: ", @@ -131,10 +111,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize }, 44usize, concat!( "Offset of field: ", @@ -144,10 +121,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ng) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ng) as usize - ptr as usize }, 48usize, concat!( "Offset of field: ", @@ -157,10 +131,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).align2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).align2) as usize - ptr as usize }, 60usize, concat!( "Offset of field: ", @@ -170,26 +141,17 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 64usize, concat!("Offset of field: ", stringify!(RTCRay), "::", stringify!(u)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize }, 68usize, concat!("Offset of field: ", stringify!(RTCRay), "::", stringify!(v)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).geomID) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).geomID) as usize - ptr as usize }, 72usize, concat!( "Offset of field: ", @@ -199,10 +161,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).primID) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).primID) as usize - ptr as usize }, 76usize, concat!( "Offset of field: ", @@ -212,10 +171,7 @@ fn bindgen_test_layout_RTCRay() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).instID) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).instID) as usize - ptr as usize }, 80usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1382-rust-primitive-types.rs b/tests/expectations/tests/issue-1382-rust-primitive-types.rs index 08914934..b767d5e4 100644 --- a/tests/expectations/tests/issue-1382-rust-primitive-types.rs +++ b/tests/expectations/tests/issue-1382-rust-primitive-types.rs @@ -35,6 +35,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 56usize, @@ -46,74 +47,47 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i8_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i8_) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i8_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u8_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u8_) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u8_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i16_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i16_) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i16_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u16_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u16_) as usize - ptr as usize }, 12usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u16_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize }, 16usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i32_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize }, 20usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u32_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i64_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i64_) as usize - ptr as usize }, 24usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i64_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u64_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u64_) as usize - ptr as usize }, 28usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u64_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i128_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i128_) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -123,10 +97,7 @@ fn bindgen_test_layout_Foo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u128_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u128_) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -136,10 +107,7 @@ fn bindgen_test_layout_Foo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).isize_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).isize_) as usize - ptr as usize }, 40usize, concat!( "Offset of field: ", @@ -149,10 +117,7 @@ fn bindgen_test_layout_Foo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).usize_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).usize_) as usize - ptr as usize }, 44usize, concat!( "Offset of field: ", @@ -162,18 +127,12 @@ fn bindgen_test_layout_Foo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f32_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f32_) as usize - ptr as usize }, 48usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f32_)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f64_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f64_) as usize - ptr as usize }, 52usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f64_)) ); diff --git a/tests/expectations/tests/issue-1443.rs b/tests/expectations/tests/issue-1443.rs index 3267ab01..48cae79f 100644 --- a/tests/expectations/tests/issue-1443.rs +++ b/tests/expectations/tests/issue-1443.rs @@ -20,6 +20,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 16usize, @@ -31,18 +32,12 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(m)) ); @@ -66,6 +61,7 @@ pub struct Baz { fn bindgen_test_layout_Baz() { const UNINIT: ::std::mem::MaybeUninit<Baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Baz>(), 16usize, @@ -77,18 +73,12 @@ fn bindgen_test_layout_Baz() { concat!("Alignment of ", stringify!(Baz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Baz), "::", stringify!(f)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Baz), "::", stringify!(m)) ); @@ -112,6 +102,7 @@ pub struct Tar { fn bindgen_test_layout_Tar() { const UNINIT: ::std::mem::MaybeUninit<Tar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Tar>(), 16usize, @@ -123,18 +114,12 @@ fn bindgen_test_layout_Tar() { concat!("Alignment of ", stringify!(Tar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Tar), "::", stringify!(f)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Tar), "::", stringify!(m)) ); @@ -158,6 +143,7 @@ pub struct Taz { fn bindgen_test_layout_Taz() { const UNINIT: ::std::mem::MaybeUninit<Taz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Taz>(), 16usize, @@ -169,18 +155,12 @@ fn bindgen_test_layout_Taz() { concat!("Alignment of ", stringify!(Taz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Taz), "::", stringify!(f)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Taz), "::", stringify!(m)) ); diff --git a/tests/expectations/tests/issue-1454.rs b/tests/expectations/tests/issue-1454.rs index 2ba6c493..8da43cb0 100644 --- a/tests/expectations/tests/issue-1454.rs +++ b/tests/expectations/tests/issue-1454.rs @@ -18,6 +18,7 @@ pub struct local_type { fn bindgen_test_layout_local_type() { const UNINIT: ::std::mem::MaybeUninit<local_type> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<local_type>(), 0usize, @@ -29,10 +30,7 @@ fn bindgen_test_layout_local_type() { concat!("Alignment of ", stringify!(local_type)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).inner) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).inner) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1498.rs b/tests/expectations/tests/issue-1498.rs index 56fc922a..08ba9ef4 100644 --- a/tests/expectations/tests/issue-1498.rs +++ b/tests/expectations/tests/issue-1498.rs @@ -35,6 +35,7 @@ pub union rte_memseg__bindgen_ty_1 { fn bindgen_test_layout_rte_memseg__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_memseg__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_memseg__bindgen_ty_1>(), 8usize, @@ -46,10 +47,7 @@ fn bindgen_test_layout_rte_memseg__bindgen_ty_1() { concat!("Alignment of ", stringify!(rte_memseg__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -59,10 +57,7 @@ fn bindgen_test_layout_rte_memseg__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).addr_64) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).addr_64) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -85,6 +80,7 @@ impl Default for rte_memseg__bindgen_ty_1 { fn bindgen_test_layout_rte_memseg() { const UNINIT: ::std::mem::MaybeUninit<rte_memseg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_memseg>(), 44usize, @@ -97,7 +93,6 @@ fn bindgen_test_layout_rte_memseg() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).phys_addr) as usize - ptr as usize }, 0usize, @@ -109,10 +104,7 @@ fn bindgen_test_layout_rte_memseg() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -123,7 +115,6 @@ fn bindgen_test_layout_rte_memseg() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).hugepage_sz) as usize - ptr as usize }, 24usize, @@ -136,7 +127,6 @@ fn bindgen_test_layout_rte_memseg() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).socket_id) as usize - ptr as usize }, 32usize, @@ -149,7 +139,6 @@ fn bindgen_test_layout_rte_memseg() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nchannel) as usize - ptr as usize }, 36usize, @@ -161,10 +150,7 @@ fn bindgen_test_layout_rte_memseg() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nrank) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nrank) as usize - ptr as usize }, 40usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1947.rs b/tests/expectations/tests/issue-1947.rs index f390a588..e133ed85 100644 --- a/tests/expectations/tests/issue-1947.rs +++ b/tests/expectations/tests/issue-1947.rs @@ -109,6 +109,7 @@ pub struct V56AMDY { fn bindgen_test_layout_V56AMDY() { const UNINIT: ::std::mem::MaybeUninit<V56AMDY> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<V56AMDY>(), 8usize, @@ -120,10 +121,7 @@ fn bindgen_test_layout_V56AMDY() { concat!("Alignment of ", stringify!(V56AMDY)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).MADK) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).MADK) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -133,10 +131,7 @@ fn bindgen_test_layout_V56AMDY() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).MABR) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).MABR) as usize - ptr as usize }, 3usize, concat!( "Offset of field: ", @@ -146,10 +141,7 @@ fn bindgen_test_layout_V56AMDY() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr)._rB_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr)._rB_) as usize - ptr as usize }, 7usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-1977-larger-arrays.rs b/tests/expectations/tests/issue-1977-larger-arrays.rs index 917cf522..6375ea7e 100644 --- a/tests/expectations/tests/issue-1977-larger-arrays.rs +++ b/tests/expectations/tests/issue-1977-larger-arrays.rs @@ -14,6 +14,7 @@ pub struct S { fn bindgen_test_layout_S() { const UNINIT: ::std::mem::MaybeUninit<S> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<S>(), 33usize, @@ -26,7 +27,6 @@ fn bindgen_test_layout_S() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/issue-1995.rs b/tests/expectations/tests/issue-1995.rs index 1cb803a7..890479b5 100644 --- a/tests/expectations/tests/issue-1995.rs +++ b/tests/expectations/tests/issue-1995.rs @@ -21,6 +21,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -32,10 +33,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/issue-2019.rs b/tests/expectations/tests/issue-2019.rs index 37134534..294e9f0e 100644 --- a/tests/expectations/tests/issue-2019.rs +++ b/tests/expectations/tests/issue-2019.rs @@ -14,6 +14,7 @@ pub struct A { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(a)) ); @@ -52,6 +50,7 @@ pub struct B { fn bindgen_test_layout_B() { const UNINIT: ::std::mem::MaybeUninit<B> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<B>(), 4usize, @@ -63,10 +62,7 @@ fn bindgen_test_layout_B() { concat!("Alignment of ", stringify!(B)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(B), "::", stringify!(b)) ); diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs index b6fe4cf0..e87fb4d1 100644 --- a/tests/expectations/tests/issue-372.rs +++ b/tests/expectations/tests/issue-372.rs @@ -20,6 +20,7 @@ pub mod root { fn bindgen_test_layout_i() { const UNINIT: ::std::mem::MaybeUninit<i> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<i>(), 24usize, @@ -31,26 +32,17 @@ pub mod root { concat!("Alignment of ", stringify!(i)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).j) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).j) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(i), "::", stringify!(j)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).k) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).k) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(i), "::", stringify!(k)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).l) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).l) as usize - ptr as usize }, 16usize, concat!("Offset of field: ", stringify!(i), "::", stringify!(l)) ); @@ -73,6 +65,7 @@ pub mod root { fn bindgen_test_layout_d() { const UNINIT: ::std::mem::MaybeUninit<d> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<d>(), 24usize, @@ -84,10 +77,7 @@ pub mod root { concat!("Alignment of ", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(d), "::", stringify!(m)) ); @@ -125,6 +115,7 @@ pub mod root { fn bindgen_test_layout_F() { const UNINIT: ::std::mem::MaybeUninit<F> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<F>(), 264usize, @@ -136,10 +127,7 @@ pub mod root { concat!("Alignment of ", stringify!(F)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).w) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).w) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(F), "::", stringify!(w)) ); diff --git a/tests/expectations/tests/issue-537-repr-packed-n.rs b/tests/expectations/tests/issue-537-repr-packed-n.rs index ab19685b..b1e42ca7 100644 --- a/tests/expectations/tests/issue-537-repr-packed-n.rs +++ b/tests/expectations/tests/issue-537-repr-packed-n.rs @@ -17,6 +17,7 @@ pub struct AlignedToOne { fn bindgen_test_layout_AlignedToOne() { const UNINIT: ::std::mem::MaybeUninit<AlignedToOne> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AlignedToOne>(), 4usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_AlignedToOne() { concat!("Alignment of ", stringify!(AlignedToOne)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -51,6 +49,7 @@ pub struct AlignedToTwo { fn bindgen_test_layout_AlignedToTwo() { const UNINIT: ::std::mem::MaybeUninit<AlignedToTwo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AlignedToTwo>(), 4usize, @@ -62,10 +61,7 @@ fn bindgen_test_layout_AlignedToTwo() { concat!("Alignment of ", stringify!(AlignedToTwo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -88,6 +84,7 @@ pub struct PackedToOne { fn bindgen_test_layout_PackedToOne() { const UNINIT: ::std::mem::MaybeUninit<PackedToOne> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<PackedToOne>(), 8usize, @@ -99,10 +96,7 @@ fn bindgen_test_layout_PackedToOne() { concat!("Alignment of ", stringify!(PackedToOne)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -112,10 +106,7 @@ fn bindgen_test_layout_PackedToOne() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -136,6 +127,7 @@ pub struct PackedToTwo { fn bindgen_test_layout_PackedToTwo() { const UNINIT: ::std::mem::MaybeUninit<PackedToTwo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<PackedToTwo>(), 8usize, @@ -147,10 +139,7 @@ fn bindgen_test_layout_PackedToTwo() { concat!("Alignment of ", stringify!(PackedToTwo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -160,10 +149,7 @@ fn bindgen_test_layout_PackedToTwo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-537.rs b/tests/expectations/tests/issue-537.rs index e2e1bce0..e2be9d63 100644 --- a/tests/expectations/tests/issue-537.rs +++ b/tests/expectations/tests/issue-537.rs @@ -16,6 +16,7 @@ pub struct AlignedToOne { fn bindgen_test_layout_AlignedToOne() { const UNINIT: ::std::mem::MaybeUninit<AlignedToOne> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AlignedToOne>(), 4usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_AlignedToOne() { concat!("Alignment of ", stringify!(AlignedToOne)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -51,6 +49,7 @@ pub struct AlignedToTwo { fn bindgen_test_layout_AlignedToTwo() { const UNINIT: ::std::mem::MaybeUninit<AlignedToTwo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AlignedToTwo>(), 4usize, @@ -62,10 +61,7 @@ fn bindgen_test_layout_AlignedToTwo() { concat!("Alignment of ", stringify!(AlignedToTwo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -88,6 +84,7 @@ pub struct PackedToOne { fn bindgen_test_layout_PackedToOne() { const UNINIT: ::std::mem::MaybeUninit<PackedToOne> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<PackedToOne>(), 8usize, @@ -99,10 +96,7 @@ fn bindgen_test_layout_PackedToOne() { concat!("Alignment of ", stringify!(PackedToOne)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -112,10 +106,7 @@ fn bindgen_test_layout_PackedToOne() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -138,6 +129,7 @@ pub struct PackedToTwo { fn bindgen_test_layout_PackedToTwo() { const UNINIT: ::std::mem::MaybeUninit<PackedToTwo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<PackedToTwo>(), 8usize, @@ -149,10 +141,7 @@ fn bindgen_test_layout_PackedToTwo() { concat!("Alignment of ", stringify!(PackedToTwo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -162,10 +151,7 @@ fn bindgen_test_layout_PackedToTwo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-573-layout-test-failures.rs b/tests/expectations/tests/issue-573-layout-test-failures.rs index 3c16b872..fbff1362 100644 --- a/tests/expectations/tests/issue-573-layout-test-failures.rs +++ b/tests/expectations/tests/issue-573-layout-test-failures.rs @@ -19,6 +19,7 @@ pub struct AutoIdVector { fn bindgen_test_layout_AutoIdVector() { const UNINIT: ::std::mem::MaybeUninit<AutoIdVector> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<AutoIdVector>(), 1usize, @@ -30,10 +31,7 @@ fn bindgen_test_layout_AutoIdVector() { concat!("Alignment of ", stringify!(AutoIdVector)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs index 36a7f4f5..22aa9d16 100644 --- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs +++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs @@ -19,6 +19,7 @@ pub struct _bindgen_ty_1 { fn bindgen_test_layout__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<_bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_bindgen_ty_1>(), 1usize, @@ -30,10 +31,7 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs index 0d9a14e6..3765315c 100644 --- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs +++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs @@ -53,6 +53,7 @@ pub struct g { fn bindgen_test_layout_g() { const UNINIT: ::std::mem::MaybeUninit<g> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<g>(), 1usize, @@ -64,10 +65,7 @@ fn bindgen_test_layout_g() { concat!("Alignment of ", stringify!(g)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).h) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).h) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(g), "::", stringify!(h)) ); diff --git a/tests/expectations/tests/issue-639-typedef-anon-field.rs b/tests/expectations/tests/issue-639-typedef-anon-field.rs index 40fb6829..bac8a04c 100644 --- a/tests/expectations/tests/issue-639-typedef-anon-field.rs +++ b/tests/expectations/tests/issue-639-typedef-anon-field.rs @@ -19,6 +19,7 @@ pub struct Foo_Bar { fn bindgen_test_layout_Foo_Bar() { const UNINIT: ::std::mem::MaybeUninit<Foo_Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo_Bar>(), 4usize, @@ -30,10 +31,7 @@ fn bindgen_test_layout_Foo_Bar() { concat!("Alignment of ", stringify!(Foo_Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).abc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).abc) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -47,6 +45,7 @@ fn bindgen_test_layout_Foo_Bar() { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 4usize, @@ -58,10 +57,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar)) ); @@ -80,6 +76,7 @@ pub struct Baz_Bar { fn bindgen_test_layout_Baz_Bar() { const UNINIT: ::std::mem::MaybeUninit<Baz_Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Baz_Bar>(), 4usize, @@ -91,10 +88,7 @@ fn bindgen_test_layout_Baz_Bar() { concat!("Alignment of ", stringify!(Baz_Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).abc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).abc) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-643-inner-struct.rs b/tests/expectations/tests/issue-643-inner-struct.rs index ae1890c2..b69aa16e 100644 --- a/tests/expectations/tests/issue-643-inner-struct.rs +++ b/tests/expectations/tests/issue-643-inner-struct.rs @@ -52,6 +52,7 @@ pub struct rte_ring_prod { fn bindgen_test_layout_rte_ring_prod() { const UNINIT: ::std::mem::MaybeUninit<rte_ring_prod> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ring_prod>(), 4usize, @@ -64,7 +65,6 @@ fn bindgen_test_layout_rte_ring_prod() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).watermark) as usize - ptr as usize }, 0usize, @@ -85,6 +85,7 @@ pub struct rte_ring_cons { fn bindgen_test_layout_rte_ring_cons() { const UNINIT: ::std::mem::MaybeUninit<rte_ring_cons> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ring_cons>(), 4usize, @@ -97,7 +98,6 @@ fn bindgen_test_layout_rte_ring_cons() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).sc_dequeue) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs index 1eed229d..13cdf0c9 100644 --- a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs +++ b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs @@ -17,6 +17,7 @@ pub struct NoDebug { fn bindgen_test_layout_NoDebug() { const UNINIT: ::std::mem::MaybeUninit<NoDebug> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NoDebug>(), 64usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_NoDebug() { concat!("Alignment of ", stringify!(NoDebug)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -70,6 +68,7 @@ pub struct ShouldDeriveDebugButDoesNot { fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() { const UNINIT: ::std::mem::MaybeUninit<ShouldDeriveDebugButDoesNot> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldDeriveDebugButDoesNot>(), 64usize, @@ -81,10 +80,7 @@ fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() { concat!("Alignment of ", stringify!(ShouldDeriveDebugButDoesNot)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -94,10 +90,7 @@ fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-674-1.rs b/tests/expectations/tests/issue-674-1.rs index a28b78ec..b37d7a27 100644 --- a/tests/expectations/tests/issue-674-1.rs +++ b/tests/expectations/tests/issue-674-1.rs @@ -28,6 +28,7 @@ pub mod root { fn bindgen_test_layout_CapturingContentInfo() { const UNINIT: ::std::mem::MaybeUninit<CapturingContentInfo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<CapturingContentInfo>(), 1usize, @@ -39,10 +40,7 @@ pub mod root { concat!("Alignment of ", stringify!(CapturingContentInfo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-674-2.rs b/tests/expectations/tests/issue-674-2.rs index 07ca59e8..12b2aa20 100644 --- a/tests/expectations/tests/issue-674-2.rs +++ b/tests/expectations/tests/issue-674-2.rs @@ -28,6 +28,7 @@ pub mod root { fn bindgen_test_layout_c() { const UNINIT: ::std::mem::MaybeUninit<c> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<c>(), 1usize, @@ -39,10 +40,7 @@ pub mod root { concat!("Alignment of ", stringify!(c)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(c), "::", stringify!(b)) ); @@ -56,6 +54,7 @@ pub mod root { fn bindgen_test_layout_B() { const UNINIT: ::std::mem::MaybeUninit<B> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<B>(), 1usize, @@ -67,10 +66,7 @@ pub mod root { concat!("Alignment of ", stringify!(B)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(B), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/issue-674-3.rs b/tests/expectations/tests/issue-674-3.rs index cd8421be..e7af6b8d 100644 --- a/tests/expectations/tests/issue-674-3.rs +++ b/tests/expectations/tests/issue-674-3.rs @@ -24,6 +24,7 @@ pub mod root { fn bindgen_test_layout_a() { const UNINIT: ::std::mem::MaybeUninit<a> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<a>(), 1usize, @@ -35,10 +36,7 @@ pub mod root { concat!("Alignment of ", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(b)) ); @@ -52,6 +50,7 @@ pub mod root { fn bindgen_test_layout_nsCSSValue() { const UNINIT: ::std::mem::MaybeUninit<nsCSSValue> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsCSSValue>(), 1usize, @@ -63,10 +62,7 @@ pub mod root { concat!("Alignment of ", stringify!(nsCSSValue)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs index 9252bab9..b3192b72 100644 --- a/tests/expectations/tests/issue-801-opaque-sloppiness.rs +++ b/tests/expectations/tests/issue-801-opaque-sloppiness.rs @@ -42,6 +42,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 1usize, @@ -53,10 +54,7 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(b)) ); diff --git a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs index 6d66e610..f8869528 100644 --- a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs +++ b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs @@ -111,6 +111,7 @@ pub struct Allowlisted { fn bindgen_test_layout_Allowlisted() { const UNINIT: ::std::mem::MaybeUninit<Allowlisted> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Allowlisted>(), 1usize, @@ -123,7 +124,6 @@ fn bindgen_test_layout_Allowlisted() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).some_member) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs b/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs index 5bc59777..d9c365d8 100644 --- a/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs +++ b/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs @@ -16,6 +16,7 @@ pub struct ShouldNotBeCopy { fn bindgen_test_layout_ShouldNotBeCopy() { const UNINIT: ::std::mem::MaybeUninit<ShouldNotBeCopy> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ShouldNotBeCopy>(), 1usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_ShouldNotBeCopy() { concat!("Alignment of ", stringify!(ShouldNotBeCopy)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs index 3340c9b2..2873f6a2 100644 --- a/tests/expectations/tests/jsval_layout_opaque.rs +++ b/tests/expectations/tests/jsval_layout_opaque.rs @@ -280,6 +280,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< jsval_layout__bindgen_ty_2__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<jsval_layout__bindgen_ty_2__bindgen_ty_1>(), 4usize, @@ -297,10 +298,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -310,10 +308,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -323,10 +318,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).why) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).why) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -349,6 +341,7 @@ impl Default for jsval_layout__bindgen_ty_2__bindgen_ty_1 { fn bindgen_test_layout_jsval_layout__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<jsval_layout__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<jsval_layout__bindgen_ty_2>(), 4usize, @@ -360,10 +353,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2() { concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).payload) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).payload) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -386,6 +376,7 @@ impl Default for jsval_layout__bindgen_ty_2 { fn bindgen_test_layout_jsval_layout() { const UNINIT: ::std::mem::MaybeUninit<jsval_layout> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<jsval_layout>(), 8usize, @@ -397,10 +388,7 @@ fn bindgen_test_layout_jsval_layout() { concat!("Alignment of ", stringify!(jsval_layout)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).asBits) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).asBits) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -411,7 +399,6 @@ fn bindgen_test_layout_jsval_layout() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).debugView) as usize - ptr as usize }, 0usize, @@ -423,10 +410,7 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -437,7 +421,6 @@ fn bindgen_test_layout_jsval_layout() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).asDouble) as usize - ptr as usize }, 0usize, @@ -449,10 +432,7 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).asPtr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).asPtr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -462,10 +442,7 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).asWord) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).asWord) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -476,7 +453,6 @@ fn bindgen_test_layout_jsval_layout() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).asUIntPtr) as usize - ptr as usize }, 0usize, @@ -506,6 +482,7 @@ pub struct Value { fn bindgen_test_layout_Value() { const UNINIT: ::std::mem::MaybeUninit<Value> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Value>(), 8usize, @@ -517,10 +494,7 @@ fn bindgen_test_layout_Value() { concat!("Alignment of ", stringify!(Value)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs index 055d273a..33594c0e 100644 --- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs +++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs @@ -330,6 +330,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< jsval_layout__bindgen_ty_2__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<jsval_layout__bindgen_ty_2__bindgen_ty_1>(), 4usize, @@ -347,10 +348,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i32_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -360,10 +358,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u32_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -373,10 +368,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).why) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).why) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -395,6 +387,7 @@ impl Clone for jsval_layout__bindgen_ty_2__bindgen_ty_1 { fn bindgen_test_layout_jsval_layout__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<jsval_layout__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<jsval_layout__bindgen_ty_2>(), 4usize, @@ -406,10 +399,7 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2() { concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).payload) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).payload) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -428,6 +418,7 @@ impl Clone for jsval_layout__bindgen_ty_2 { fn bindgen_test_layout_jsval_layout() { const UNINIT: ::std::mem::MaybeUninit<jsval_layout> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<jsval_layout>(), 8usize, @@ -439,10 +430,7 @@ fn bindgen_test_layout_jsval_layout() { concat!("Alignment of ", stringify!(jsval_layout)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).asBits) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).asBits) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -453,7 +441,6 @@ fn bindgen_test_layout_jsval_layout() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).debugView) as usize - ptr as usize }, 0usize, @@ -465,10 +452,7 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -479,7 +463,6 @@ fn bindgen_test_layout_jsval_layout() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).asDouble) as usize - ptr as usize }, 0usize, @@ -491,10 +474,7 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).asPtr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).asPtr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -504,10 +484,7 @@ fn bindgen_test_layout_jsval_layout() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).asWord) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).asWord) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -518,7 +495,6 @@ fn bindgen_test_layout_jsval_layout() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).asUIntPtr) as usize - ptr as usize }, 0usize, @@ -544,6 +520,7 @@ pub struct Value { fn bindgen_test_layout_Value() { const UNINIT: ::std::mem::MaybeUninit<Value> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Value>(), 8usize, @@ -555,10 +532,7 @@ fn bindgen_test_layout_Value() { concat!("Alignment of ", stringify!(Value)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_align.rs b/tests/expectations/tests/layout_align.rs index a6d18d14..466e7686 100644 --- a/tests/expectations/tests/layout_align.rs +++ b/tests/expectations/tests/layout_align.rs @@ -171,6 +171,7 @@ pub struct rte_eth_link { fn bindgen_test_layout_rte_eth_link() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_link> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_link>(), 8usize, @@ -183,7 +184,6 @@ fn bindgen_test_layout_rte_eth_link() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).link_speed) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/layout_arp.rs b/tests/expectations/tests/layout_arp.rs index f0277dd8..6852c236 100644 --- a/tests/expectations/tests/layout_arp.rs +++ b/tests/expectations/tests/layout_arp.rs @@ -32,6 +32,7 @@ pub struct ether_addr { fn bindgen_test_layout_ether_addr() { const UNINIT: ::std::mem::MaybeUninit<ether_addr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ether_addr>(), 6usize, @@ -44,7 +45,6 @@ fn bindgen_test_layout_ether_addr() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).addr_bytes) as usize - ptr as usize }, 0usize, @@ -73,6 +73,7 @@ pub struct arp_ipv4 { fn bindgen_test_layout_arp_ipv4() { const UNINIT: ::std::mem::MaybeUninit<arp_ipv4> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<arp_ipv4>(), 20usize, @@ -84,10 +85,7 @@ fn bindgen_test_layout_arp_ipv4() { concat!("Alignment of ", stringify!(arp_ipv4)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_sha) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_sha) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -97,10 +95,7 @@ fn bindgen_test_layout_arp_ipv4() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_sip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_sip) as usize - ptr as usize }, 6usize, concat!( "Offset of field: ", @@ -110,10 +105,7 @@ fn bindgen_test_layout_arp_ipv4() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_tha) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_tha) as usize - ptr as usize }, 10usize, concat!( "Offset of field: ", @@ -123,10 +115,7 @@ fn bindgen_test_layout_arp_ipv4() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_tip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_tip) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -151,6 +140,7 @@ pub struct arp_hdr { fn bindgen_test_layout_arp_hdr() { const UNINIT: ::std::mem::MaybeUninit<arp_hdr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<arp_hdr>(), 28usize, @@ -162,10 +152,7 @@ fn bindgen_test_layout_arp_hdr() { concat!("Alignment of ", stringify!(arp_hdr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_hrd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_hrd) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -175,10 +162,7 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_pro) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_pro) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -188,10 +172,7 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_hln) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_hln) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -201,10 +182,7 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_pln) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_pln) as usize - ptr as usize }, 5usize, concat!( "Offset of field: ", @@ -214,10 +192,7 @@ fn bindgen_test_layout_arp_hdr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arp_op) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arp_op) as usize - ptr as usize }, 6usize, concat!( "Offset of field: ", @@ -228,7 +203,6 @@ fn bindgen_test_layout_arp_hdr() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).arp_data) as usize - ptr as usize }, 8usize, diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs index 83fb15b8..f3bbf51e 100644 --- a/tests/expectations/tests/layout_array.rs +++ b/tests/expectations/tests/layout_array.rs @@ -71,6 +71,7 @@ pub struct rte_mempool_ops { fn bindgen_test_layout_rte_mempool_ops() { const UNINIT: ::std::mem::MaybeUninit<rte_mempool_ops> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mempool_ops>(), 128usize, @@ -82,10 +83,7 @@ fn bindgen_test_layout_rte_mempool_ops() { concat!("Alignment of ", stringify!(rte_mempool_ops)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -95,10 +93,7 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).alloc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).alloc) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -108,10 +103,7 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).free) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).free) as usize - ptr as usize }, 40usize, concat!( "Offset of field: ", @@ -121,10 +113,7 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).enqueue) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).enqueue) as usize - ptr as usize }, 48usize, concat!( "Offset of field: ", @@ -134,10 +123,7 @@ fn bindgen_test_layout_rte_mempool_ops() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dequeue) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dequeue) as usize - ptr as usize }, 56usize, concat!( "Offset of field: ", @@ -148,7 +134,6 @@ fn bindgen_test_layout_rte_mempool_ops() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).get_count) as usize - ptr as usize }, 64usize, @@ -190,6 +175,7 @@ pub struct rte_spinlock_t { fn bindgen_test_layout_rte_spinlock_t() { const UNINIT: ::std::mem::MaybeUninit<rte_spinlock_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_spinlock_t>(), 4usize, @@ -201,10 +187,7 @@ fn bindgen_test_layout_rte_spinlock_t() { concat!("Alignment of ", stringify!(rte_spinlock_t)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).locked) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).locked) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -237,6 +220,7 @@ pub struct rte_mempool_ops_table { fn bindgen_test_layout_rte_mempool_ops_table() { const UNINIT: ::std::mem::MaybeUninit<rte_mempool_ops_table> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mempool_ops_table>(), 2112usize, @@ -248,10 +232,7 @@ fn bindgen_test_layout_rte_mempool_ops_table() { concat!("Alignment of ", stringify!(rte_mempool_ops_table)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).sl) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sl) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -261,10 +242,7 @@ fn bindgen_test_layout_rte_mempool_ops_table() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).num_ops) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).num_ops) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -274,10 +252,7 @@ fn bindgen_test_layout_rte_mempool_ops_table() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ops) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ops) as usize - ptr as usize }, 64usize, concat!( "Offset of field: ", @@ -315,6 +290,7 @@ pub struct malloc_heap__bindgen_ty_1 { fn bindgen_test_layout_malloc_heap__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<malloc_heap__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<malloc_heap__bindgen_ty_1>(), 8usize, @@ -327,7 +303,6 @@ fn bindgen_test_layout_malloc_heap__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).lh_first) as usize - ptr as usize }, 0usize, @@ -352,6 +327,7 @@ impl Default for malloc_heap__bindgen_ty_1 { fn bindgen_test_layout_malloc_heap() { const UNINIT: ::std::mem::MaybeUninit<malloc_heap> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<malloc_heap>(), 128usize, @@ -363,10 +339,7 @@ fn bindgen_test_layout_malloc_heap() { concat!("Alignment of ", stringify!(malloc_heap)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lock) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lock) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -377,7 +350,6 @@ fn bindgen_test_layout_malloc_heap() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).free_head) as usize - ptr as usize }, 8usize, @@ -390,7 +362,6 @@ fn bindgen_test_layout_malloc_heap() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).alloc_count) as usize - ptr as usize }, 112usize, @@ -403,7 +374,6 @@ fn bindgen_test_layout_malloc_heap() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).total_size) as usize - ptr as usize }, 120usize, diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs index c1575a02..56b3c021 100644 --- a/tests/expectations/tests/layout_array_too_long.rs +++ b/tests/expectations/tests/layout_array_too_long.rs @@ -37,6 +37,7 @@ pub struct ip_frag { fn bindgen_test_layout_ip_frag() { const UNINIT: ::std::mem::MaybeUninit<ip_frag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag>(), 16usize, @@ -48,10 +49,7 @@ fn bindgen_test_layout_ip_frag() { concat!("Alignment of ", stringify!(ip_frag)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ofs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ofs) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -61,10 +59,7 @@ fn bindgen_test_layout_ip_frag() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -74,10 +69,7 @@ fn bindgen_test_layout_ip_frag() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mb) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mb) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -111,6 +103,7 @@ pub struct ip_frag_key { fn bindgen_test_layout_ip_frag_key() { const UNINIT: ::std::mem::MaybeUninit<ip_frag_key> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag_key>(), 40usize, @@ -122,10 +115,7 @@ fn bindgen_test_layout_ip_frag_key() { concat!("Alignment of ", stringify!(ip_frag_key)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).src_dst) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).src_dst) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -135,10 +125,7 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -148,10 +135,7 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).key_len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).key_len) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -192,6 +176,7 @@ pub struct ip_frag_pkt__bindgen_ty_1 { fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<ip_frag_pkt__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag_pkt__bindgen_ty_1>(), 16usize, @@ -204,7 +189,6 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tqe_next) as usize - ptr as usize }, 0usize, @@ -217,7 +201,6 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tqe_prev) as usize - ptr as usize }, 8usize, @@ -242,6 +225,7 @@ impl Default for ip_frag_pkt__bindgen_ty_1 { fn bindgen_test_layout_ip_frag_pkt() { const UNINIT: ::std::mem::MaybeUninit<ip_frag_pkt> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag_pkt>(), 192usize, @@ -253,10 +237,7 @@ fn bindgen_test_layout_ip_frag_pkt() { concat!("Alignment of ", stringify!(ip_frag_pkt)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -266,10 +247,7 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -279,10 +257,7 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, 56usize, concat!( "Offset of field: ", @@ -293,7 +268,6 @@ fn bindgen_test_layout_ip_frag_pkt() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).total_size) as usize - ptr as usize }, 64usize, @@ -306,7 +280,6 @@ fn bindgen_test_layout_ip_frag_pkt() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).frag_size) as usize - ptr as usize }, 68usize, @@ -319,7 +292,6 @@ fn bindgen_test_layout_ip_frag_pkt() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).last_idx) as usize - ptr as usize }, 72usize, @@ -331,10 +303,7 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).frags) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).frags) as usize - ptr as usize }, 80usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs index 0f6e0ca4..899703bd 100644 --- a/tests/expectations/tests/layout_cmdline_token.rs +++ b/tests/expectations/tests/layout_cmdline_token.rs @@ -17,6 +17,7 @@ pub struct cmdline_token_hdr { fn bindgen_test_layout_cmdline_token_hdr() { const UNINIT: ::std::mem::MaybeUninit<cmdline_token_hdr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<cmdline_token_hdr>(), 16usize, @@ -28,10 +29,7 @@ fn bindgen_test_layout_cmdline_token_hdr() { concat!("Alignment of ", stringify!(cmdline_token_hdr)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ops) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ops) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -41,10 +39,7 @@ fn bindgen_test_layout_cmdline_token_hdr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -123,6 +118,7 @@ pub struct cmdline_token_ops { fn bindgen_test_layout_cmdline_token_ops() { const UNINIT: ::std::mem::MaybeUninit<cmdline_token_ops> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<cmdline_token_ops>(), 32usize, @@ -134,10 +130,7 @@ fn bindgen_test_layout_cmdline_token_ops() { concat!("Alignment of ", stringify!(cmdline_token_ops)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).parse) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).parse) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -148,7 +141,6 @@ fn bindgen_test_layout_cmdline_token_ops() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).complete_get_nb) as usize - ptr as usize }, 8usize, @@ -161,7 +153,6 @@ fn bindgen_test_layout_cmdline_token_ops() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).complete_get_elt) as usize - ptr as usize }, @@ -175,7 +166,6 @@ fn bindgen_test_layout_cmdline_token_ops() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).get_help) as usize - ptr as usize }, 24usize, @@ -208,6 +198,7 @@ pub struct cmdline_token_num_data { fn bindgen_test_layout_cmdline_token_num_data() { const UNINIT: ::std::mem::MaybeUninit<cmdline_token_num_data> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<cmdline_token_num_data>(), 4usize, @@ -219,10 +210,7 @@ fn bindgen_test_layout_cmdline_token_num_data() { concat!("Alignment of ", stringify!(cmdline_token_num_data)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -251,6 +239,7 @@ pub struct cmdline_token_num { fn bindgen_test_layout_cmdline_token_num() { const UNINIT: ::std::mem::MaybeUninit<cmdline_token_num> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<cmdline_token_num>(), 24usize, @@ -262,10 +251,7 @@ fn bindgen_test_layout_cmdline_token_num() { concat!("Alignment of ", stringify!(cmdline_token_num)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).hdr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).hdr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -276,7 +262,6 @@ fn bindgen_test_layout_cmdline_token_num() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).num_data) as usize - ptr as usize }, 16usize, diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs index 839a4ac6..62b99e90 100644 --- a/tests/expectations/tests/layout_eth_conf.rs +++ b/tests/expectations/tests/layout_eth_conf.rs @@ -162,6 +162,7 @@ pub struct rte_eth_rxmode { fn bindgen_test_layout_rte_eth_rxmode() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_rxmode> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_rxmode>(), 12usize, @@ -173,10 +174,7 @@ fn bindgen_test_layout_rte_eth_rxmode() { concat!("Alignment of ", stringify!(rte_eth_rxmode)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -187,7 +185,6 @@ fn bindgen_test_layout_rte_eth_rxmode() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).max_rx_pkt_len) as usize - ptr as usize }, 4usize, @@ -200,7 +197,6 @@ fn bindgen_test_layout_rte_eth_rxmode() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).split_hdr_size) as usize - ptr as usize }, 8usize, @@ -429,6 +425,7 @@ pub struct rte_eth_txmode { fn bindgen_test_layout_rte_eth_txmode() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_txmode> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_txmode>(), 8usize, @@ -440,10 +437,7 @@ fn bindgen_test_layout_rte_eth_txmode() { concat!("Alignment of ", stringify!(rte_eth_txmode)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -453,10 +447,7 @@ fn bindgen_test_layout_rte_eth_txmode() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pvid) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pvid) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -570,6 +561,7 @@ pub struct rte_eth_rss_conf { fn bindgen_test_layout_rte_eth_rss_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_rss_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_rss_conf>(), 24usize, @@ -581,10 +573,7 @@ fn bindgen_test_layout_rte_eth_rss_conf() { concat!("Alignment of ", stringify!(rte_eth_rss_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rss_key) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rss_key) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -595,7 +584,6 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rss_key_len) as usize - ptr as usize }, 8usize, @@ -607,10 +595,7 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rss_hf) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rss_hf) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -689,6 +674,7 @@ pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_dcb_conf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>(), 16usize, @@ -703,10 +689,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -716,10 +699,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -733,6 +713,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_dcb_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_dcb_conf>(), 1040usize, @@ -745,7 +726,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -758,7 +738,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize - ptr as usize }, @@ -772,7 +751,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).default_pool) as usize - ptr as usize }, 5usize, @@ -785,7 +763,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize - ptr as usize }, 6usize, @@ -798,7 +775,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize }, 8usize, @@ -810,10 +786,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 1032usize, concat!( "Offset of field: ", @@ -844,6 +817,7 @@ pub struct rte_eth_dcb_rx_conf { fn bindgen_test_layout_rte_eth_dcb_rx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_dcb_rx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_dcb_rx_conf>(), 12usize, @@ -855,10 +829,7 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -868,10 +839,7 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -902,6 +870,7 @@ pub struct rte_eth_vmdq_dcb_tx_conf { fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_dcb_tx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_dcb_tx_conf>(), 12usize, @@ -914,7 +883,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -926,10 +894,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -960,6 +925,7 @@ pub struct rte_eth_dcb_tx_conf { fn bindgen_test_layout_rte_eth_dcb_tx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_dcb_tx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_dcb_tx_conf>(), 12usize, @@ -971,10 +937,7 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -984,10 +947,7 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -1016,6 +976,7 @@ pub struct rte_eth_vmdq_tx_conf { fn bindgen_test_layout_rte_eth_vmdq_tx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_tx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_tx_conf>(), 4usize, @@ -1028,7 +989,6 @@ fn bindgen_test_layout_rte_eth_vmdq_tx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -1079,6 +1039,7 @@ pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_rx_conf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_rx_conf__bindgen_ty_1>(), 16usize, @@ -1093,10 +1054,7 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1106,10 +1064,7 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -1123,6 +1078,7 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_rx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_rx_conf>(), 1040usize, @@ -1135,7 +1091,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -1148,7 +1103,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize - ptr as usize }, @@ -1162,7 +1116,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).default_pool) as usize - ptr as usize }, 5usize, @@ -1175,7 +1128,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).enable_loop_back) as usize - ptr as usize }, @@ -1189,7 +1141,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize - ptr as usize }, 7usize, @@ -1201,10 +1152,7 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rx_mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rx_mode) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -1215,7 +1163,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize }, 16usize, @@ -1293,6 +1240,7 @@ pub struct rte_eth_ipv4_flow { fn bindgen_test_layout_rte_eth_ipv4_flow() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_ipv4_flow> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_ipv4_flow>(), 12usize, @@ -1304,10 +1252,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv4_flow)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1317,10 +1262,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -1330,10 +1272,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tos) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tos) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -1343,10 +1282,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ttl) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ttl) as usize - ptr as usize }, 9usize, concat!( "Offset of field: ", @@ -1356,10 +1292,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize }, 10usize, concat!( "Offset of field: ", @@ -1388,6 +1321,7 @@ pub struct rte_eth_ipv6_flow { fn bindgen_test_layout_rte_eth_ipv6_flow() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_ipv6_flow> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_ipv6_flow>(), 36usize, @@ -1399,10 +1333,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv6_flow)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1412,10 +1343,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -1425,10 +1353,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tc) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -1438,10 +1363,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize }, 33usize, concat!( "Offset of field: ", @@ -1452,7 +1374,6 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).hop_limits) as usize - ptr as usize }, 34usize, @@ -1492,6 +1413,7 @@ pub struct rte_eth_fdir_masks { fn bindgen_test_layout_rte_eth_fdir_masks() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_fdir_masks> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_fdir_masks>(), 68usize, @@ -1504,7 +1426,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vlan_tci_mask) as usize - ptr as usize }, 0usize, @@ -1517,7 +1438,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ipv4_mask) as usize - ptr as usize }, 4usize, @@ -1530,7 +1450,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ipv6_mask) as usize - ptr as usize }, 16usize, @@ -1543,7 +1462,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_port_mask) as usize - ptr as usize }, 52usize, @@ -1556,7 +1474,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dst_port_mask) as usize - ptr as usize }, 54usize, @@ -1569,7 +1486,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mac_addr_byte_mask) as usize - ptr as usize }, @@ -1583,7 +1499,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tunnel_id_mask) as usize - ptr as usize }, 60usize, @@ -1596,7 +1511,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tunnel_type_mask) as usize - ptr as usize }, @@ -1633,6 +1547,7 @@ pub struct rte_eth_flex_payload_cfg { fn bindgen_test_layout_rte_eth_flex_payload_cfg() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_flex_payload_cfg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_flex_payload_cfg>(), 36usize, @@ -1644,10 +1559,7 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1658,7 +1570,6 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_offset) as usize - ptr as usize }, 4usize, @@ -1691,6 +1602,7 @@ pub struct rte_eth_fdir_flex_mask { fn bindgen_test_layout_rte_eth_fdir_flex_mask() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_fdir_flex_mask> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_fdir_flex_mask>(), 18usize, @@ -1703,7 +1615,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flow_type) as usize - ptr as usize }, 0usize, @@ -1715,10 +1626,7 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -1744,6 +1652,7 @@ pub struct rte_eth_fdir_flex_conf { fn bindgen_test_layout_rte_eth_fdir_flex_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_fdir_flex_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_fdir_flex_conf>(), 688usize, @@ -1756,7 +1665,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_payloads) as usize - ptr as usize }, 0usize, @@ -1769,7 +1677,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_flexmasks) as usize - ptr as usize }, 2usize, @@ -1782,7 +1689,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flex_set) as usize - ptr as usize }, 4usize, @@ -1795,7 +1701,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flex_mask) as usize - ptr as usize }, 292usize, @@ -1838,6 +1743,7 @@ pub struct rte_fdir_conf { fn bindgen_test_layout_rte_fdir_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_fdir_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_fdir_conf>(), 772usize, @@ -1849,10 +1755,7 @@ fn bindgen_test_layout_rte_fdir_conf() { concat!("Alignment of ", stringify!(rte_fdir_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mode) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1862,10 +1765,7 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pballoc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pballoc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -1875,10 +1775,7 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -1889,7 +1786,6 @@ fn bindgen_test_layout_rte_fdir_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).drop_queue) as usize - ptr as usize }, 12usize, @@ -1901,10 +1797,7 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -1915,7 +1808,6 @@ fn bindgen_test_layout_rte_fdir_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flex_conf) as usize - ptr as usize }, 84usize, @@ -1949,6 +1841,7 @@ pub struct rte_intr_conf { fn bindgen_test_layout_rte_intr_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_intr_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_intr_conf>(), 4usize, @@ -1960,10 +1853,7 @@ fn bindgen_test_layout_rte_intr_conf() { concat!("Alignment of ", stringify!(rte_intr_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lsc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lsc) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1973,10 +1863,7 @@ fn bindgen_test_layout_rte_intr_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rxq) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rxq) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -2035,6 +1922,7 @@ pub struct rte_eth_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_conf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_conf__bindgen_ty_1>(), 2120usize, @@ -2047,7 +1935,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rss_conf) as usize - ptr as usize }, 0usize, @@ -2060,7 +1947,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_dcb_conf) as usize - ptr as usize }, 24usize, @@ -2073,7 +1959,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dcb_rx_conf) as usize - ptr as usize }, 1064usize, @@ -2086,7 +1971,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_rx_conf) as usize - ptr as usize }, 1080usize, @@ -2118,6 +2002,7 @@ pub union rte_eth_conf__bindgen_ty_2 { fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_conf__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_conf__bindgen_ty_2>(), 12usize, @@ -2130,7 +2015,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_dcb_tx_conf) as usize - ptr as usize }, @@ -2144,7 +2028,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dcb_tx_conf) as usize - ptr as usize }, 0usize, @@ -2157,7 +2040,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_tx_conf) as usize - ptr as usize }, 0usize, @@ -2182,6 +2064,7 @@ impl Default for rte_eth_conf__bindgen_ty_2 { fn bindgen_test_layout_rte_eth_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_conf>(), 2944usize, @@ -2194,7 +2077,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).link_speeds) as usize - ptr as usize }, 0usize, @@ -2206,10 +2088,7 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rxmode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rxmode) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -2219,10 +2098,7 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).txmode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).txmode) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -2233,7 +2109,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).lpbk_mode) as usize - ptr as usize }, 24usize, @@ -2246,7 +2121,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rx_adv_conf) as usize - ptr as usize }, 32usize, @@ -2259,7 +2133,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tx_adv_conf) as usize - ptr as usize }, 2152usize, @@ -2272,7 +2145,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dcb_capability_en) as usize - ptr as usize }, @@ -2286,7 +2158,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).fdir_conf) as usize - ptr as usize }, 2168usize, @@ -2299,7 +2170,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).intr_conf) as usize - ptr as usize }, 2940usize, diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs index fcec665f..d7fa0a63 100644 --- a/tests/expectations/tests/layout_eth_conf_1_0.rs +++ b/tests/expectations/tests/layout_eth_conf_1_0.rs @@ -205,6 +205,7 @@ pub struct rte_eth_rxmode { fn bindgen_test_layout_rte_eth_rxmode() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_rxmode> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_rxmode>(), 12usize, @@ -216,10 +217,7 @@ fn bindgen_test_layout_rte_eth_rxmode() { concat!("Alignment of ", stringify!(rte_eth_rxmode)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -230,7 +228,6 @@ fn bindgen_test_layout_rte_eth_rxmode() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).max_rx_pkt_len) as usize - ptr as usize }, 4usize, @@ -243,7 +240,6 @@ fn bindgen_test_layout_rte_eth_rxmode() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).split_hdr_size) as usize - ptr as usize }, 8usize, @@ -477,6 +473,7 @@ pub struct rte_eth_txmode { fn bindgen_test_layout_rte_eth_txmode() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_txmode> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_txmode>(), 8usize, @@ -488,10 +485,7 @@ fn bindgen_test_layout_rte_eth_txmode() { concat!("Alignment of ", stringify!(rte_eth_txmode)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mq_mode) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -501,10 +495,7 @@ fn bindgen_test_layout_rte_eth_txmode() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pvid) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pvid) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -623,6 +614,7 @@ pub struct rte_eth_rss_conf { fn bindgen_test_layout_rte_eth_rss_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_rss_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_rss_conf>(), 24usize, @@ -634,10 +626,7 @@ fn bindgen_test_layout_rte_eth_rss_conf() { concat!("Alignment of ", stringify!(rte_eth_rss_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rss_key) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rss_key) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -648,7 +637,6 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rss_key_len) as usize - ptr as usize }, 8usize, @@ -660,10 +648,7 @@ fn bindgen_test_layout_rte_eth_rss_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rss_hf) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rss_hf) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -747,6 +732,7 @@ pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_dcb_conf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>(), 16usize, @@ -761,10 +747,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -774,10 +757,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -796,6 +776,7 @@ impl Clone for rte_eth_vmdq_dcb_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_dcb_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_dcb_conf>(), 1040usize, @@ -808,7 +789,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -821,7 +801,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize - ptr as usize }, @@ -835,7 +814,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).default_pool) as usize - ptr as usize }, 5usize, @@ -848,7 +826,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize - ptr as usize }, 6usize, @@ -861,7 +838,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize }, 8usize, @@ -873,10 +849,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 1032usize, concat!( "Offset of field: ", @@ -912,6 +885,7 @@ pub struct rte_eth_dcb_rx_conf { fn bindgen_test_layout_rte_eth_dcb_rx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_dcb_rx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_dcb_rx_conf>(), 12usize, @@ -923,10 +897,7 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -936,10 +907,7 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -975,6 +943,7 @@ pub struct rte_eth_vmdq_dcb_tx_conf { fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_dcb_tx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_dcb_tx_conf>(), 12usize, @@ -987,7 +956,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -999,10 +967,7 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -1038,6 +1003,7 @@ pub struct rte_eth_dcb_tx_conf { fn bindgen_test_layout_rte_eth_dcb_tx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_dcb_tx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_dcb_tx_conf>(), 12usize, @@ -1049,10 +1015,7 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nb_tcs) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1062,10 +1025,7 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dcb_tc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -1099,6 +1059,7 @@ pub struct rte_eth_vmdq_tx_conf { fn bindgen_test_layout_rte_eth_vmdq_tx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_tx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_tx_conf>(), 4usize, @@ -1111,7 +1072,6 @@ fn bindgen_test_layout_rte_eth_vmdq_tx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -1167,6 +1127,7 @@ pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_rx_conf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_rx_conf__bindgen_ty_1>(), 16usize, @@ -1181,10 +1142,7 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).vlan_id) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1194,10 +1152,7 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pools) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -1216,6 +1171,7 @@ impl Clone for rte_eth_vmdq_rx_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_vmdq_rx_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_vmdq_rx_conf>(), 1040usize, @@ -1228,7 +1184,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_queue_pools) as usize - ptr as usize }, 0usize, @@ -1241,7 +1196,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).enable_default_pool) as usize - ptr as usize }, @@ -1255,7 +1209,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).default_pool) as usize - ptr as usize }, 5usize, @@ -1268,7 +1221,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).enable_loop_back) as usize - ptr as usize }, @@ -1282,7 +1234,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_pool_maps) as usize - ptr as usize }, 7usize, @@ -1294,10 +1245,7 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rx_mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rx_mode) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -1308,7 +1256,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).pool_map) as usize - ptr as usize }, 16usize, @@ -1391,6 +1338,7 @@ pub struct rte_eth_ipv4_flow { fn bindgen_test_layout_rte_eth_ipv4_flow() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_ipv4_flow> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_ipv4_flow>(), 12usize, @@ -1402,10 +1350,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv4_flow)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1415,10 +1360,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -1428,10 +1370,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tos) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tos) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -1441,10 +1380,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ttl) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ttl) as usize - ptr as usize }, 9usize, concat!( "Offset of field: ", @@ -1454,10 +1390,7 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize }, 10usize, concat!( "Offset of field: ", @@ -1491,6 +1424,7 @@ pub struct rte_eth_ipv6_flow { fn bindgen_test_layout_rte_eth_ipv6_flow() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_ipv6_flow> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_ipv6_flow>(), 36usize, @@ -1502,10 +1436,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { concat!("Alignment of ", stringify!(rte_eth_ipv6_flow)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1515,10 +1446,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -1528,10 +1456,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tc) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -1541,10 +1466,7 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize }, 33usize, concat!( "Offset of field: ", @@ -1555,7 +1477,6 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).hop_limits) as usize - ptr as usize }, 34usize, @@ -1600,6 +1521,7 @@ pub struct rte_eth_fdir_masks { fn bindgen_test_layout_rte_eth_fdir_masks() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_fdir_masks> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_fdir_masks>(), 68usize, @@ -1612,7 +1534,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vlan_tci_mask) as usize - ptr as usize }, 0usize, @@ -1625,7 +1546,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ipv4_mask) as usize - ptr as usize }, 4usize, @@ -1638,7 +1558,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ipv6_mask) as usize - ptr as usize }, 16usize, @@ -1651,7 +1570,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_port_mask) as usize - ptr as usize }, 52usize, @@ -1664,7 +1582,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dst_port_mask) as usize - ptr as usize }, 54usize, @@ -1677,7 +1594,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mac_addr_byte_mask) as usize - ptr as usize }, @@ -1691,7 +1607,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tunnel_id_mask) as usize - ptr as usize }, 60usize, @@ -1704,7 +1619,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tunnel_type_mask) as usize - ptr as usize }, @@ -1746,6 +1660,7 @@ pub struct rte_eth_flex_payload_cfg { fn bindgen_test_layout_rte_eth_flex_payload_cfg() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_flex_payload_cfg> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_flex_payload_cfg>(), 36usize, @@ -1757,10 +1672,7 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1771,7 +1683,6 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).src_offset) as usize - ptr as usize }, 4usize, @@ -1809,6 +1720,7 @@ pub struct rte_eth_fdir_flex_mask { fn bindgen_test_layout_rte_eth_fdir_flex_mask() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_fdir_flex_mask> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_fdir_flex_mask>(), 18usize, @@ -1821,7 +1733,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flow_type) as usize - ptr as usize }, 0usize, @@ -1833,10 +1744,7 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -1867,6 +1775,7 @@ pub struct rte_eth_fdir_flex_conf { fn bindgen_test_layout_rte_eth_fdir_flex_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_fdir_flex_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_fdir_flex_conf>(), 688usize, @@ -1879,7 +1788,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_payloads) as usize - ptr as usize }, 0usize, @@ -1892,7 +1800,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_flexmasks) as usize - ptr as usize }, 2usize, @@ -1905,7 +1812,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flex_set) as usize - ptr as usize }, 4usize, @@ -1918,7 +1824,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flex_mask) as usize - ptr as usize }, 292usize, @@ -1966,6 +1871,7 @@ pub struct rte_fdir_conf { fn bindgen_test_layout_rte_fdir_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_fdir_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_fdir_conf>(), 772usize, @@ -1977,10 +1883,7 @@ fn bindgen_test_layout_rte_fdir_conf() { concat!("Alignment of ", stringify!(rte_fdir_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mode) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -1990,10 +1893,7 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pballoc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pballoc) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -2003,10 +1903,7 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).status) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -2017,7 +1914,6 @@ fn bindgen_test_layout_rte_fdir_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).drop_queue) as usize - ptr as usize }, 12usize, @@ -2029,10 +1925,7 @@ fn bindgen_test_layout_rte_fdir_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -2043,7 +1936,6 @@ fn bindgen_test_layout_rte_fdir_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).flex_conf) as usize - ptr as usize }, 84usize, @@ -2082,6 +1974,7 @@ pub struct rte_intr_conf { fn bindgen_test_layout_rte_intr_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_intr_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_intr_conf>(), 4usize, @@ -2093,10 +1986,7 @@ fn bindgen_test_layout_rte_intr_conf() { concat!("Alignment of ", stringify!(rte_intr_conf)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lsc) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lsc) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -2106,10 +1996,7 @@ fn bindgen_test_layout_rte_intr_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rxq) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rxq) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -2173,6 +2060,7 @@ pub struct rte_eth_conf__bindgen_ty_1 { fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_conf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_conf__bindgen_ty_1>(), 2120usize, @@ -2185,7 +2073,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rss_conf) as usize - ptr as usize }, 0usize, @@ -2198,7 +2085,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_dcb_conf) as usize - ptr as usize }, 24usize, @@ -2211,7 +2097,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dcb_rx_conf) as usize - ptr as usize }, 1064usize, @@ -2224,7 +2109,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_rx_conf) as usize - ptr as usize }, 1080usize, @@ -2262,6 +2146,7 @@ pub struct rte_eth_conf__bindgen_ty_2 { fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_conf__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_conf__bindgen_ty_2>(), 12usize, @@ -2274,7 +2159,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_dcb_tx_conf) as usize - ptr as usize }, @@ -2288,7 +2172,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dcb_tx_conf) as usize - ptr as usize }, 0usize, @@ -2301,7 +2184,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vmdq_tx_conf) as usize - ptr as usize }, 0usize, @@ -2322,6 +2204,7 @@ impl Clone for rte_eth_conf__bindgen_ty_2 { fn bindgen_test_layout_rte_eth_conf() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_conf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_conf>(), 2944usize, @@ -2334,7 +2217,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).link_speeds) as usize - ptr as usize }, 0usize, @@ -2346,10 +2228,7 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rxmode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rxmode) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -2359,10 +2238,7 @@ fn bindgen_test_layout_rte_eth_conf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).txmode) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).txmode) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -2373,7 +2249,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).lpbk_mode) as usize - ptr as usize }, 24usize, @@ -2386,7 +2261,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rx_adv_conf) as usize - ptr as usize }, 32usize, @@ -2399,7 +2273,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tx_adv_conf) as usize - ptr as usize }, 2152usize, @@ -2412,7 +2285,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).dcb_capability_en) as usize - ptr as usize }, @@ -2426,7 +2298,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).fdir_conf) as usize - ptr as usize }, 2168usize, @@ -2439,7 +2310,6 @@ fn bindgen_test_layout_rte_eth_conf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).intr_conf) as usize - ptr as usize }, 2940usize, diff --git a/tests/expectations/tests/layout_kni_mbuf.rs b/tests/expectations/tests/layout_kni_mbuf.rs index eb17fa63..be88d20f 100644 --- a/tests/expectations/tests/layout_kni_mbuf.rs +++ b/tests/expectations/tests/layout_kni_mbuf.rs @@ -36,6 +36,7 @@ pub struct rte_kni_mbuf { fn bindgen_test_layout_rte_kni_mbuf() { const UNINIT: ::std::mem::MaybeUninit<rte_kni_mbuf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_kni_mbuf>(), 128usize, @@ -48,7 +49,6 @@ fn bindgen_test_layout_rte_kni_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).buf_addr) as usize - ptr as usize }, 0usize, @@ -61,7 +61,6 @@ fn bindgen_test_layout_rte_kni_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).buf_physaddr) as usize - ptr as usize }, 8usize, @@ -73,10 +72,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pad0) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pad0) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -87,7 +83,6 @@ fn bindgen_test_layout_rte_kni_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).data_off) as usize - ptr as usize }, 18usize, @@ -99,10 +94,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pad1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pad1) as usize - ptr as usize }, 20usize, concat!( "Offset of field: ", @@ -112,10 +104,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize }, 22usize, concat!( "Offset of field: ", @@ -125,10 +114,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pad4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pad4) as usize - ptr as usize }, 23usize, concat!( "Offset of field: ", @@ -139,7 +125,6 @@ fn bindgen_test_layout_rte_kni_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ol_flags) as usize - ptr as usize }, 24usize, @@ -151,10 +136,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pad2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pad2) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -164,10 +146,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -178,7 +157,6 @@ fn bindgen_test_layout_rte_kni_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).data_len) as usize - ptr as usize }, 40usize, @@ -190,10 +168,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pad3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pad3) as usize - ptr as usize }, 64usize, concat!( "Offset of field: ", @@ -203,10 +178,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize }, 72usize, concat!( "Offset of field: ", @@ -216,10 +188,7 @@ fn bindgen_test_layout_rte_kni_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize }, 80usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_large_align_field.rs b/tests/expectations/tests/layout_large_align_field.rs index 3f050269..075ef46a 100644 --- a/tests/expectations/tests/layout_large_align_field.rs +++ b/tests/expectations/tests/layout_large_align_field.rs @@ -67,6 +67,7 @@ pub struct ip_frag { fn bindgen_test_layout_ip_frag() { const UNINIT: ::std::mem::MaybeUninit<ip_frag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag>(), 16usize, @@ -78,10 +79,7 @@ fn bindgen_test_layout_ip_frag() { concat!("Alignment of ", stringify!(ip_frag)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ofs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ofs) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -91,10 +89,7 @@ fn bindgen_test_layout_ip_frag() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -104,10 +99,7 @@ fn bindgen_test_layout_ip_frag() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mb) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mb) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -141,6 +133,7 @@ pub struct ip_frag_key { fn bindgen_test_layout_ip_frag_key() { const UNINIT: ::std::mem::MaybeUninit<ip_frag_key> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag_key>(), 40usize, @@ -152,10 +145,7 @@ fn bindgen_test_layout_ip_frag_key() { concat!("Alignment of ", stringify!(ip_frag_key)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).src_dst) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).src_dst) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -165,10 +155,7 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -178,10 +165,7 @@ fn bindgen_test_layout_ip_frag_key() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).key_len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).key_len) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -222,6 +206,7 @@ pub struct ip_frag_pkt__bindgen_ty_1 { fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<ip_frag_pkt__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag_pkt__bindgen_ty_1>(), 16usize, @@ -234,7 +219,6 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tqe_next) as usize - ptr as usize }, 0usize, @@ -247,7 +231,6 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tqe_prev) as usize - ptr as usize }, 8usize, @@ -272,6 +255,7 @@ impl Default for ip_frag_pkt__bindgen_ty_1 { fn bindgen_test_layout_ip_frag_pkt() { const UNINIT: ::std::mem::MaybeUninit<ip_frag_pkt> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag_pkt>(), 192usize, @@ -283,10 +267,7 @@ fn bindgen_test_layout_ip_frag_pkt() { concat!("Alignment of ", stringify!(ip_frag_pkt)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -296,10 +277,7 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -309,10 +287,7 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize }, 56usize, concat!( "Offset of field: ", @@ -323,7 +298,6 @@ fn bindgen_test_layout_ip_frag_pkt() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).total_size) as usize - ptr as usize }, 64usize, @@ -336,7 +310,6 @@ fn bindgen_test_layout_ip_frag_pkt() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).frag_size) as usize - ptr as usize }, 68usize, @@ -349,7 +322,6 @@ fn bindgen_test_layout_ip_frag_pkt() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).last_idx) as usize - ptr as usize }, 72usize, @@ -361,10 +333,7 @@ fn bindgen_test_layout_ip_frag_pkt() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).frags) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).frags) as usize - ptr as usize }, 80usize, concat!( "Offset of field: ", @@ -393,6 +362,7 @@ pub struct ip_pkt_list { fn bindgen_test_layout_ip_pkt_list() { const UNINIT: ::std::mem::MaybeUninit<ip_pkt_list> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_pkt_list>(), 16usize, @@ -405,7 +375,6 @@ fn bindgen_test_layout_ip_pkt_list() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tqh_first) as usize - ptr as usize }, 0usize, @@ -418,7 +387,6 @@ fn bindgen_test_layout_ip_pkt_list() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tqh_last) as usize - ptr as usize }, 8usize, @@ -461,6 +429,7 @@ pub struct ip_frag_tbl_stat { fn bindgen_test_layout_ip_frag_tbl_stat() { const UNINIT: ::std::mem::MaybeUninit<ip_frag_tbl_stat> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ip_frag_tbl_stat>(), 64usize, @@ -473,7 +442,6 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).find_num) as usize - ptr as usize }, 0usize, @@ -485,10 +453,7 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).add_num) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).add_num) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -498,10 +463,7 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).del_num) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).del_num) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -512,7 +474,6 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).reuse_num) as usize - ptr as usize }, 24usize, @@ -525,7 +486,6 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).fail_total) as usize - ptr as usize }, 32usize, @@ -538,7 +498,6 @@ fn bindgen_test_layout_ip_frag_tbl_stat() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).fail_nospace) as usize - ptr as usize }, 40usize, @@ -591,6 +550,7 @@ pub struct rte_ip_frag_tbl { fn bindgen_test_layout_rte_ip_frag_tbl() { const UNINIT: ::std::mem::MaybeUninit<rte_ip_frag_tbl> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ip_frag_tbl>(), 128usize, @@ -603,7 +563,6 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).max_cycles) as usize - ptr as usize }, 0usize, @@ -616,7 +575,6 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).entry_mask) as usize - ptr as usize }, 8usize, @@ -629,7 +587,6 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).max_entries) as usize - ptr as usize }, 12usize, @@ -642,7 +599,6 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).use_entries) as usize - ptr as usize }, 16usize, @@ -655,7 +611,6 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).bucket_entries) as usize - ptr as usize }, 20usize, @@ -668,7 +623,6 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_entries) as usize - ptr as usize }, 24usize, @@ -681,7 +635,6 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).nb_buckets) as usize - ptr as usize }, 28usize, @@ -693,10 +646,7 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).last) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).last) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -706,10 +656,7 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize }, 40usize, concat!( "Offset of field: ", @@ -719,10 +666,7 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).stat) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).stat) as usize - ptr as usize }, 64usize, concat!( "Offset of field: ", @@ -732,10 +676,7 @@ fn bindgen_test_layout_rte_ip_frag_tbl() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pkt) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pkt) as usize - ptr as usize }, 128usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs index 5a7d77b7..800a303b 100644 --- a/tests/expectations/tests/layout_mbuf.rs +++ b/tests/expectations/tests/layout_mbuf.rs @@ -108,6 +108,7 @@ pub struct rte_atomic16_t { fn bindgen_test_layout_rte_atomic16_t() { const UNINIT: ::std::mem::MaybeUninit<rte_atomic16_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_atomic16_t>(), 2usize, @@ -119,10 +120,7 @@ fn bindgen_test_layout_rte_atomic16_t() { concat!("Alignment of ", stringify!(rte_atomic16_t)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cnt) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cnt) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -197,6 +195,7 @@ pub union rte_mbuf__bindgen_ty_1 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_1>(), 2usize, @@ -209,7 +208,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).refcnt_atomic) as usize - ptr as usize }, 0usize, @@ -221,10 +219,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).refcnt) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).refcnt) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -418,6 +413,7 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_2>(), 4usize, @@ -430,7 +426,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).packet_type) as usize - ptr as usize }, 0usize, @@ -488,16 +483,18 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindg const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq ! (:: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 4usize , concat ! ("Size of: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1))); assert_eq ! (:: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 2usize , concat ! ("Alignment of " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1))); - assert_eq ! (unsafe { let ptr = UNINIT . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . hash) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash))); - assert_eq ! (unsafe { let ptr = UNINIT . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . id) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id))); + assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hash) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash))); + assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . id) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id))); } #[test] fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1>( ), @@ -518,10 +515,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -545,6 +539,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>(), 8usize, @@ -562,10 +557,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -595,6 +587,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_2, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>(), 8usize, @@ -612,10 +605,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -625,10 +615,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -642,6 +629,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_3> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3>(), 8usize, @@ -653,10 +641,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rss) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rss) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -666,10 +651,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).fdir) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).fdir) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -679,10 +661,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).sched) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sched) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -692,10 +671,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).usr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).usr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -726,6 +702,7 @@ pub union rte_mbuf__bindgen_ty_4 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_4> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_4>(), 8usize, @@ -738,7 +715,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).userdata) as usize - ptr as usize }, 0usize, @@ -750,10 +726,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).udata64) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).udata64) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -928,6 +901,7 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_5> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_5>(), 8usize, @@ -940,7 +914,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tx_offload) as usize - ptr as usize }, 0usize, @@ -965,6 +938,7 @@ impl Default for rte_mbuf__bindgen_ty_5 { fn bindgen_test_layout_rte_mbuf() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf>(), 128usize, @@ -977,7 +951,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).cacheline0) as usize - ptr as usize }, 0usize, @@ -990,7 +963,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).buf_addr) as usize - ptr as usize }, 0usize, @@ -1003,7 +975,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).buf_physaddr) as usize - ptr as usize }, 8usize, @@ -1015,10 +986,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).buf_len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).buf_len) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -1029,7 +997,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rearm_data) as usize - ptr as usize }, 18usize, @@ -1042,7 +1009,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).data_off) as usize - ptr as usize }, 18usize, @@ -1054,10 +1020,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize }, 22usize, concat!( "Offset of field: ", @@ -1067,10 +1030,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize }, 23usize, concat!( "Offset of field: ", @@ -1081,7 +1041,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ol_flags) as usize - ptr as usize }, 24usize, @@ -1094,7 +1053,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rx_descriptor_fields1) as usize - ptr as usize }, @@ -1107,10 +1065,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -1121,7 +1076,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).data_len) as usize - ptr as usize }, 40usize, @@ -1134,7 +1088,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vlan_tci) as usize - ptr as usize }, 42usize, @@ -1146,10 +1099,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize }, 44usize, concat!( "Offset of field: ", @@ -1159,10 +1109,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).seqn) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).seqn) as usize - ptr as usize }, 52usize, concat!( "Offset of field: ", @@ -1173,7 +1120,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vlan_tci_outer) as usize - ptr as usize }, 56usize, @@ -1186,7 +1132,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).cacheline1) as usize - ptr as usize }, 64usize, @@ -1198,10 +1143,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize }, 72usize, concat!( "Offset of field: ", @@ -1211,10 +1153,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize }, 80usize, concat!( "Offset of field: ", @@ -1225,7 +1164,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).priv_size) as usize - ptr as usize }, 96usize, @@ -1238,7 +1176,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).timesync) as usize - ptr as usize }, 98usize, diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs index 353a5766..90f7ed09 100644 --- a/tests/expectations/tests/layout_mbuf_1_0.rs +++ b/tests/expectations/tests/layout_mbuf_1_0.rs @@ -151,6 +151,7 @@ pub struct rte_atomic16_t { fn bindgen_test_layout_rte_atomic16_t() { const UNINIT: ::std::mem::MaybeUninit<rte_atomic16_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_atomic16_t>(), 2usize, @@ -162,10 +163,7 @@ fn bindgen_test_layout_rte_atomic16_t() { concat!("Alignment of ", stringify!(rte_atomic16_t)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cnt) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cnt) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -246,6 +244,7 @@ pub struct rte_mbuf__bindgen_ty_1 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_1>(), 2usize, @@ -258,7 +257,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).refcnt_atomic) as usize - ptr as usize }, 0usize, @@ -270,10 +268,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).refcnt) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).refcnt) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -470,6 +465,7 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_2>(), 4usize, @@ -482,7 +478,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).packet_type) as usize - ptr as usize }, 0usize, @@ -539,10 +534,11 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindg const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq ! (:: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 4usize , concat ! ("Size of: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1))); assert_eq ! (:: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 2usize , concat ! ("Alignment of " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1))); - assert_eq ! (unsafe { let ptr = UNINIT . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . hash) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash))); - assert_eq ! (unsafe { let ptr = UNINIT . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . id) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id))); + assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hash) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash))); + assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . id) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id))); } impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 @@ -556,6 +552,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1>( ), @@ -576,10 +573,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -599,6 +593,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_1, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>(), 8usize, @@ -616,10 +611,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -645,6 +637,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit< rte_mbuf__bindgen_ty_3__bindgen_ty_2, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>(), 8usize, @@ -662,10 +655,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).lo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -675,10 +665,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).hi) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -697,6 +684,7 @@ impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_2 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_3> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_3>(), 8usize, @@ -708,10 +696,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rss) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rss) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -721,10 +706,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).fdir) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).fdir) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -734,10 +716,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).sched) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).sched) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -747,10 +726,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).usr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).usr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -778,6 +754,7 @@ pub struct rte_mbuf__bindgen_ty_4 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_4> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_4>(), 8usize, @@ -790,7 +767,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).userdata) as usize - ptr as usize }, 0usize, @@ -802,10 +778,7 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).udata64) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).udata64) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -983,6 +956,7 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 { fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf__bindgen_ty_5> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf__bindgen_ty_5>(), 8usize, @@ -995,7 +969,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).tx_offload) as usize - ptr as usize }, 0usize, @@ -1016,6 +989,7 @@ impl Clone for rte_mbuf__bindgen_ty_5 { fn bindgen_test_layout_rte_mbuf() { const UNINIT: ::std::mem::MaybeUninit<rte_mbuf> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_mbuf>(), 128usize, @@ -1023,7 +997,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).cacheline0) as usize - ptr as usize }, 0usize, @@ -1036,7 +1009,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).buf_addr) as usize - ptr as usize }, 0usize, @@ -1049,7 +1021,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).buf_physaddr) as usize - ptr as usize }, 8usize, @@ -1061,10 +1032,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).buf_len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).buf_len) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -1075,7 +1043,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rearm_data) as usize - ptr as usize }, 18usize, @@ -1088,7 +1055,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).data_off) as usize - ptr as usize }, 18usize, @@ -1100,10 +1066,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).nb_segs) as usize - ptr as usize }, 22usize, concat!( "Offset of field: ", @@ -1113,10 +1076,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize }, 23usize, concat!( "Offset of field: ", @@ -1127,7 +1087,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).ol_flags) as usize - ptr as usize }, 24usize, @@ -1140,7 +1099,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).rx_descriptor_fields1) as usize - ptr as usize }, @@ -1153,10 +1111,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pkt_len) as usize - ptr as usize }, 36usize, concat!( "Offset of field: ", @@ -1167,7 +1122,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).data_len) as usize - ptr as usize }, 40usize, @@ -1180,7 +1134,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vlan_tci) as usize - ptr as usize }, 42usize, @@ -1192,10 +1145,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize }, 44usize, concat!( "Offset of field: ", @@ -1205,10 +1155,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).seqn) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).seqn) as usize - ptr as usize }, 52usize, concat!( "Offset of field: ", @@ -1219,7 +1166,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).vlan_tci_outer) as usize - ptr as usize }, 56usize, @@ -1232,7 +1178,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).cacheline1) as usize - ptr as usize }, 64usize, @@ -1244,10 +1189,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize }, 72usize, concat!( "Offset of field: ", @@ -1257,10 +1199,7 @@ fn bindgen_test_layout_rte_mbuf() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize }, 80usize, concat!( "Offset of field: ", @@ -1271,7 +1210,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).priv_size) as usize - ptr as usize }, 96usize, @@ -1284,7 +1222,6 @@ fn bindgen_test_layout_rte_mbuf() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).timesync) as usize - ptr as usize }, 98usize, diff --git a/tests/expectations/tests/libclang-5/call-conv-field.rs b/tests/expectations/tests/libclang-5/call-conv-field.rs index eb86ec2f..62b5ace2 100644 --- a/tests/expectations/tests/libclang-5/call-conv-field.rs +++ b/tests/expectations/tests/libclang-5/call-conv-field.rs @@ -20,6 +20,7 @@ pub struct JNINativeInterface_ { fn bindgen_test_layout_JNINativeInterface_() { const UNINIT: ::std::mem::MaybeUninit<JNINativeInterface_> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<JNINativeInterface_>(), 16usize, @@ -32,7 +33,6 @@ fn bindgen_test_layout_JNINativeInterface_() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).GetVersion) as usize - ptr as usize }, 0usize, @@ -44,10 +44,7 @@ fn bindgen_test_layout_JNINativeInterface_() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).__hack) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__hack) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs index 3e655093..19f8881d 100644 --- a/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs +++ b/tests/expectations/tests/libclang-5/type_alias_template_specialized.rs @@ -14,6 +14,7 @@ pub struct Rooted { fn bindgen_test_layout_Rooted() { const UNINIT: ::std::mem::MaybeUninit<Rooted> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Rooted>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Rooted() { concat!("Alignment of ", stringify!(Rooted)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang-9/call-conv-field.rs b/tests/expectations/tests/libclang-9/call-conv-field.rs index eb86ec2f..62b5ace2 100644 --- a/tests/expectations/tests/libclang-9/call-conv-field.rs +++ b/tests/expectations/tests/libclang-9/call-conv-field.rs @@ -20,6 +20,7 @@ pub struct JNINativeInterface_ { fn bindgen_test_layout_JNINativeInterface_() { const UNINIT: ::std::mem::MaybeUninit<JNINativeInterface_> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<JNINativeInterface_>(), 16usize, @@ -32,7 +33,6 @@ fn bindgen_test_layout_JNINativeInterface_() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).GetVersion) as usize - ptr as usize }, 0usize, @@ -44,10 +44,7 @@ fn bindgen_test_layout_JNINativeInterface_() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).__hack) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__hack) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang-9/class.rs b/tests/expectations/tests/libclang-9/class.rs index 81151d0f..0d64a9ff 100644 --- a/tests/expectations/tests/libclang-9/class.rs +++ b/tests/expectations/tests/libclang-9/class.rs @@ -45,6 +45,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 40usize, @@ -56,16 +57,12 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -96,6 +93,7 @@ pub struct C_with_zero_length_array { fn bindgen_test_layout_C_with_zero_length_array() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array>(), 40usize, @@ -107,10 +105,7 @@ fn bindgen_test_layout_C_with_zero_length_array() { concat!("Alignment of ", stringify!(C_with_zero_length_array)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -121,7 +116,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -134,7 +128,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -166,6 +159,7 @@ pub struct C_with_zero_length_array_2 { fn bindgen_test_layout_C_with_zero_length_array_2() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_2>(), 4usize, @@ -177,10 +171,7 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -191,7 +182,6 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -214,6 +204,7 @@ pub struct C_with_incomplete_array { fn bindgen_test_layout_C_with_incomplete_array() { const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_incomplete_array>(), 40usize, @@ -225,10 +216,7 @@ fn bindgen_test_layout_C_with_incomplete_array() { concat!("Alignment of ", stringify!(C_with_incomplete_array)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -239,7 +227,6 @@ fn bindgen_test_layout_C_with_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -252,7 +239,6 @@ fn bindgen_test_layout_C_with_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -284,6 +270,7 @@ pub struct C_with_incomplete_array_2 { fn bindgen_test_layout_C_with_incomplete_array_2() { const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_incomplete_array_2>(), 4usize, @@ -295,10 +282,7 @@ fn bindgen_test_layout_C_with_incomplete_array_2() { concat!("Alignment of ", stringify!(C_with_incomplete_array_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -309,7 +293,6 @@ fn bindgen_test_layout_C_with_incomplete_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -334,6 +317,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { const UNINIT: ::std::mem::MaybeUninit< C_with_zero_length_array_and_incomplete_array, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array>(), 40usize, @@ -351,10 +335,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -365,7 +346,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -378,7 +358,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -392,7 +371,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -426,6 +404,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { const UNINIT: ::std::mem::MaybeUninit< C_with_zero_length_array_and_incomplete_array_2, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array_2>( ), @@ -445,10 +424,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -459,7 +435,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -473,7 +448,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -495,6 +469,7 @@ pub struct WithDtor { fn bindgen_test_layout_WithDtor() { const UNINIT: ::std::mem::MaybeUninit<WithDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithDtor>(), 4usize, @@ -506,10 +481,7 @@ fn bindgen_test_layout_WithDtor() { concat!("Alignment of ", stringify!(WithDtor)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -528,6 +500,7 @@ pub struct IncompleteArrayNonCopiable { fn bindgen_test_layout_IncompleteArrayNonCopiable() { const UNINIT: ::std::mem::MaybeUninit<IncompleteArrayNonCopiable> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<IncompleteArrayNonCopiable>(), 8usize, @@ -540,7 +513,6 @@ fn bindgen_test_layout_IncompleteArrayNonCopiable() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize }, 0usize, @@ -553,7 +525,6 @@ fn bindgen_test_layout_IncompleteArrayNonCopiable() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -585,6 +556,7 @@ pub union Union { fn bindgen_test_layout_Union() { const UNINIT: ::std::mem::MaybeUninit<Union> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Union>(), 4usize, @@ -596,18 +568,12 @@ fn bindgen_test_layout_Union() { concat!("Alignment of ", stringify!(Union)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(i)) ); @@ -630,6 +596,7 @@ pub struct WithUnion { fn bindgen_test_layout_WithUnion() { const UNINIT: ::std::mem::MaybeUninit<WithUnion> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithUnion>(), 4usize, @@ -641,10 +608,7 @@ fn bindgen_test_layout_WithUnion() { concat!("Alignment of ", stringify!(WithUnion)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang-9/class_1_0.rs b/tests/expectations/tests/libclang-9/class_1_0.rs index 31c33ccc..e8c2e077 100644 --- a/tests/expectations/tests/libclang-9/class_1_0.rs +++ b/tests/expectations/tests/libclang-9/class_1_0.rs @@ -88,6 +88,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 40usize, @@ -99,16 +100,12 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -149,6 +146,7 @@ pub struct C_with_zero_length_array { fn bindgen_test_layout_C_with_zero_length_array() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array>(), 40usize, @@ -160,10 +158,7 @@ fn bindgen_test_layout_C_with_zero_length_array() { concat!("Alignment of ", stringify!(C_with_zero_length_array)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -174,7 +169,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -187,7 +181,6 @@ fn bindgen_test_layout_C_with_zero_length_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -219,6 +212,7 @@ pub struct C_with_zero_length_array_2 { fn bindgen_test_layout_C_with_zero_length_array_2() { const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_2>(), 4usize, @@ -230,10 +224,7 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { concat!("Alignment of ", stringify!(C_with_zero_length_array_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -244,7 +235,6 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -267,6 +257,7 @@ pub struct C_with_incomplete_array { fn bindgen_test_layout_C_with_incomplete_array() { const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_incomplete_array>(), 40usize, @@ -278,10 +269,7 @@ fn bindgen_test_layout_C_with_incomplete_array() { concat!("Alignment of ", stringify!(C_with_incomplete_array)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -292,7 +280,6 @@ fn bindgen_test_layout_C_with_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -305,7 +292,6 @@ fn bindgen_test_layout_C_with_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -337,6 +323,7 @@ pub struct C_with_incomplete_array_2 { fn bindgen_test_layout_C_with_incomplete_array_2() { const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_incomplete_array_2>(), 4usize, @@ -348,10 +335,7 @@ fn bindgen_test_layout_C_with_incomplete_array_2() { concat!("Alignment of ", stringify!(C_with_incomplete_array_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -362,7 +346,6 @@ fn bindgen_test_layout_C_with_incomplete_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -387,6 +370,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { const UNINIT: ::std::mem::MaybeUninit< C_with_zero_length_array_and_incomplete_array, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array>(), 40usize, @@ -404,10 +388,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -418,7 +399,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize }, 4usize, @@ -431,7 +411,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -445,7 +424,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -479,6 +457,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { const UNINIT: ::std::mem::MaybeUninit< C_with_zero_length_array_and_incomplete_array_2, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array_2>( ), @@ -498,10 +477,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -512,7 +488,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -526,7 +501,6 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -548,6 +522,7 @@ pub struct WithDtor { fn bindgen_test_layout_WithDtor() { const UNINIT: ::std::mem::MaybeUninit<WithDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithDtor>(), 4usize, @@ -559,10 +534,7 @@ fn bindgen_test_layout_WithDtor() { concat!("Alignment of ", stringify!(WithDtor)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -581,6 +553,7 @@ pub struct IncompleteArrayNonCopiable { fn bindgen_test_layout_IncompleteArrayNonCopiable() { const UNINIT: ::std::mem::MaybeUninit<IncompleteArrayNonCopiable> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<IncompleteArrayNonCopiable>(), 8usize, @@ -593,7 +566,6 @@ fn bindgen_test_layout_IncompleteArrayNonCopiable() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize }, 0usize, @@ -606,7 +578,6 @@ fn bindgen_test_layout_IncompleteArrayNonCopiable() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -639,6 +610,7 @@ pub struct Union { fn bindgen_test_layout_Union() { const UNINIT: ::std::mem::MaybeUninit<Union> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Union>(), 4usize, @@ -650,18 +622,12 @@ fn bindgen_test_layout_Union() { concat!("Alignment of ", stringify!(Union)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Union), "::", stringify!(i)) ); @@ -680,6 +646,7 @@ pub struct WithUnion { fn bindgen_test_layout_WithUnion() { const UNINIT: ::std::mem::MaybeUninit<WithUnion> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithUnion>(), 4usize, @@ -691,10 +658,7 @@ fn bindgen_test_layout_WithUnion() { concat!("Alignment of ", stringify!(WithUnion)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs index 0986449b..2af22cc4 100644 --- a/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs +++ b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs @@ -45,6 +45,7 @@ pub struct test { fn bindgen_test_layout_test() { const UNINIT: ::std::mem::MaybeUninit<test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<test>(), 4usize, @@ -56,16 +57,12 @@ fn bindgen_test_layout_test() { concat!("Alignment of ", stringify!(test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(test), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -88,6 +85,7 @@ pub struct test2 { fn bindgen_test_layout_test2() { const UNINIT: ::std::mem::MaybeUninit<test2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<test2>(), 4usize, @@ -99,16 +97,12 @@ fn bindgen_test_layout_test2() { concat!("Alignment of ", stringify!(test2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(test2), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, @@ -132,6 +126,7 @@ pub struct test3 { fn bindgen_test_layout_test3() { const UNINIT: ::std::mem::MaybeUninit<test3> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<test3>(), 4usize, @@ -143,16 +138,12 @@ fn bindgen_test_layout_test3() { concat!("Alignment of ", stringify!(test3)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(test3), "::", stringify!(a)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize }, @@ -166,7 +157,6 @@ fn bindgen_test_layout_test3() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize }, diff --git a/tests/expectations/tests/libclang-9/incomplete-array-padding.rs b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs index 5f33deeb..1de963bf 100644 --- a/tests/expectations/tests/libclang-9/incomplete-array-padding.rs +++ b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs @@ -132,6 +132,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -143,10 +144,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(b)) ); diff --git a/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs index aafd2d65..ab402cfb 100644 --- a/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs +++ b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs @@ -52,6 +52,7 @@ pub struct rte_ring_prod { fn bindgen_test_layout_rte_ring_prod() { const UNINIT: ::std::mem::MaybeUninit<rte_ring_prod> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ring_prod>(), 4usize, @@ -64,7 +65,6 @@ fn bindgen_test_layout_rte_ring_prod() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).watermark) as usize - ptr as usize }, 0usize, @@ -85,6 +85,7 @@ pub struct rte_ring_cons { fn bindgen_test_layout_rte_ring_cons() { const UNINIT: ::std::mem::MaybeUninit<rte_ring_cons> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ring_cons>(), 4usize, @@ -97,7 +98,6 @@ fn bindgen_test_layout_rte_ring_cons() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).sc_dequeue) as usize - ptr as usize }, 0usize, @@ -113,6 +113,7 @@ fn bindgen_test_layout_rte_ring_cons() { fn bindgen_test_layout_rte_ring() { const UNINIT: ::std::mem::MaybeUninit<rte_ring> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_ring>(), 16usize, @@ -124,10 +125,7 @@ fn bindgen_test_layout_rte_ring() { concat!("Alignment of ", stringify!(rte_ring)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).memzone) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).memzone) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -137,10 +135,7 @@ fn bindgen_test_layout_rte_ring() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).prod) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).prod) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -150,10 +145,7 @@ fn bindgen_test_layout_rte_ring() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cons) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cons) as usize - ptr as usize }, 12usize, concat!( "Offset of field: ", @@ -163,10 +155,7 @@ fn bindgen_test_layout_rte_ring() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ring) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ring) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang-9/layout_align.rs b/tests/expectations/tests/libclang-9/layout_align.rs index 1828c176..f6a32704 100644 --- a/tests/expectations/tests/libclang-9/layout_align.rs +++ b/tests/expectations/tests/libclang-9/layout_align.rs @@ -139,6 +139,7 @@ pub struct rte_kni_fifo { fn bindgen_test_layout_rte_kni_fifo() { const UNINIT: ::std::mem::MaybeUninit<rte_kni_fifo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_kni_fifo>(), 16usize, @@ -150,10 +151,7 @@ fn bindgen_test_layout_rte_kni_fifo() { concat!("Alignment of ", stringify!(rte_kni_fifo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).write) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).write) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -163,10 +161,7 @@ fn bindgen_test_layout_rte_kni_fifo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).read) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).read) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -176,10 +171,7 @@ fn bindgen_test_layout_rte_kni_fifo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -190,7 +182,6 @@ fn bindgen_test_layout_rte_kni_fifo() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).elem_size) as usize - ptr as usize }, 12usize, @@ -202,10 +193,7 @@ fn bindgen_test_layout_rte_kni_fifo() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", @@ -238,6 +226,7 @@ pub struct rte_eth_link { fn bindgen_test_layout_rte_eth_link() { const UNINIT: ::std::mem::MaybeUninit<rte_eth_link> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<rte_eth_link>(), 8usize, @@ -250,7 +239,6 @@ fn bindgen_test_layout_rte_eth_link() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).link_speed) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs index 3e655093..19f8881d 100644 --- a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs +++ b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs @@ -14,6 +14,7 @@ pub struct Rooted { fn bindgen_test_layout_Rooted() { const UNINIT: ::std::mem::MaybeUninit<Rooted> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Rooted>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Rooted() { concat!("Alignment of ", stringify!(Rooted)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/libclang-9/zero-sized-array.rs b/tests/expectations/tests/libclang-9/zero-sized-array.rs index f67ac2b3..3066fac4 100644 --- a/tests/expectations/tests/libclang-9/zero-sized-array.rs +++ b/tests/expectations/tests/libclang-9/zero-sized-array.rs @@ -45,6 +45,7 @@ pub struct ZeroSizedArray { fn bindgen_test_layout_ZeroSizedArray() { const UNINIT: ::std::mem::MaybeUninit<ZeroSizedArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ZeroSizedArray>(), 0usize, @@ -56,10 +57,7 @@ fn bindgen_test_layout_ZeroSizedArray() { concat!("Alignment of ", stringify!(ZeroSizedArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -79,6 +77,7 @@ pub struct ContainsZeroSizedArray { fn bindgen_test_layout_ContainsZeroSizedArray() { const UNINIT: ::std::mem::MaybeUninit<ContainsZeroSizedArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsZeroSizedArray>(), 0usize, @@ -90,10 +89,7 @@ fn bindgen_test_layout_ContainsZeroSizedArray() { concat!("Alignment of ", stringify!(ContainsZeroSizedArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).zsa) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).zsa) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -133,6 +129,7 @@ pub struct DynamicallySizedArray { fn bindgen_test_layout_DynamicallySizedArray() { const UNINIT: ::std::mem::MaybeUninit<DynamicallySizedArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<DynamicallySizedArray>(), 0usize, @@ -144,10 +141,7 @@ fn bindgen_test_layout_DynamicallySizedArray() { concat!("Alignment of ", stringify!(DynamicallySizedArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -167,6 +161,7 @@ pub struct ContainsDynamicallySizedArray { fn bindgen_test_layout_ContainsDynamicallySizedArray() { const UNINIT: ::std::mem::MaybeUninit<ContainsDynamicallySizedArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsDynamicallySizedArray>(), 0usize, @@ -178,10 +173,7 @@ fn bindgen_test_layout_ContainsDynamicallySizedArray() { concat!("Alignment of ", stringify!(ContainsDynamicallySizedArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).dsa) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).dsa) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/long_double.rs b/tests/expectations/tests/long_double.rs index 54ed2948..2c3b6c93 100644 --- a/tests/expectations/tests/long_double.rs +++ b/tests/expectations/tests/long_double.rs @@ -15,6 +15,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 16usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/msvc-no-usr.rs b/tests/expectations/tests/msvc-no-usr.rs index e0ffc043..285670ed 100644 --- a/tests/expectations/tests/msvc-no-usr.rs +++ b/tests/expectations/tests/msvc-no-usr.rs @@ -15,6 +15,7 @@ pub struct A { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 8usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(foo)) ); diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs index cca9927e..94c70326 100644 --- a/tests/expectations/tests/mutable.rs +++ b/tests/expectations/tests/mutable.rs @@ -15,6 +15,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 8usize, @@ -27,7 +28,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize }, 0usize, @@ -39,10 +39,7 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m_other) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m_other) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -61,6 +58,7 @@ pub struct NonCopiable { fn bindgen_test_layout_NonCopiable() { const UNINIT: ::std::mem::MaybeUninit<NonCopiable> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NonCopiable>(), 4usize, @@ -73,7 +71,6 @@ fn bindgen_test_layout_NonCopiable() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize }, 0usize, @@ -95,6 +92,7 @@ fn bindgen_test_layout_NonCopiableWithNonCopiableMutableMember() { const UNINIT: ::std::mem::MaybeUninit< NonCopiableWithNonCopiableMutableMember, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NonCopiableWithNonCopiableMutableMember>(), 4usize, @@ -113,7 +111,6 @@ fn bindgen_test_layout_NonCopiableWithNonCopiableMutableMember() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs index 555629d4..49c8a7ef 100644 --- a/tests/expectations/tests/namespace.rs +++ b/tests/expectations/tests/namespace.rs @@ -35,6 +35,7 @@ pub mod root { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 4usize, @@ -47,7 +48,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs index 82a483ae..415a7405 100644 --- a/tests/expectations/tests/nested.rs +++ b/tests/expectations/tests/nested.rs @@ -14,6 +14,7 @@ pub struct Calc { fn bindgen_test_layout_Calc() { const UNINIT: ::std::mem::MaybeUninit<Calc> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Calc>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Calc() { concat!("Alignment of ", stringify!(Calc)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).w) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).w) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Calc), "::", stringify!(w)) ); @@ -66,6 +64,7 @@ fn bindgen_test_layout_Test_Size_Dimension() { fn bindgen_test_layout_Test_Size() { const UNINIT: ::std::mem::MaybeUninit<Test_Size> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test_Size>(), 8usize, @@ -77,10 +76,7 @@ fn bindgen_test_layout_Test_Size() { concat!("Alignment of ", stringify!(Test_Size)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mWidth) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mWidth) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -90,10 +86,7 @@ fn bindgen_test_layout_Test_Size() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mHeight) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mHeight) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/nested_within_namespace.rs b/tests/expectations/tests/nested_within_namespace.rs index d4874d41..629c449a 100644 --- a/tests/expectations/tests/nested_within_namespace.rs +++ b/tests/expectations/tests/nested_within_namespace.rs @@ -26,6 +26,7 @@ pub mod root { fn bindgen_test_layout_Bar_Baz() { const UNINIT: ::std::mem::MaybeUninit<Bar_Baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar_Baz>(), 4usize, @@ -38,7 +39,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, @@ -54,6 +54,7 @@ pub mod root { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -66,7 +67,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, @@ -87,6 +87,7 @@ pub mod root { fn bindgen_test_layout_Baz() { const UNINIT: ::std::mem::MaybeUninit<Baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Baz>(), 4usize, @@ -99,7 +100,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/no-comments.rs b/tests/expectations/tests/no-comments.rs index 2f22f1cf..a375d8ea 100644 --- a/tests/expectations/tests/no-comments.rs +++ b/tests/expectations/tests/no-comments.rs @@ -14,6 +14,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).s) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(s)) ); diff --git a/tests/expectations/tests/no-derive-debug.rs b/tests/expectations/tests/no-derive-debug.rs index ffdc2c2f..c7a6d184 100644 --- a/tests/expectations/tests/no-derive-debug.rs +++ b/tests/expectations/tests/no-derive-debug.rs @@ -23,6 +23,7 @@ pub struct bar { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 8usize, @@ -34,18 +35,12 @@ fn bindgen_test_layout_bar() { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(bar), "::", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/no-derive-default.rs b/tests/expectations/tests/no-derive-default.rs index 7e21f8ab..46b2cb4e 100644 --- a/tests/expectations/tests/no-derive-default.rs +++ b/tests/expectations/tests/no-derive-default.rs @@ -23,6 +23,7 @@ pub struct bar { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 8usize, @@ -34,18 +35,12 @@ fn bindgen_test_layout_bar() { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(bar), "::", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/no-hash-allowlisted.rs b/tests/expectations/tests/no-hash-allowlisted.rs index b92ae996..549b72b5 100644 --- a/tests/expectations/tests/no-hash-allowlisted.rs +++ b/tests/expectations/tests/no-hash-allowlisted.rs @@ -14,6 +14,7 @@ pub struct NoHash { fn bindgen_test_layout_NoHash() { const UNINIT: ::std::mem::MaybeUninit<NoHash> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NoHash>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_NoHash() { concat!("Alignment of ", stringify!(NoHash)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(NoHash), "::", stringify!(i)) ); diff --git a/tests/expectations/tests/no-partialeq-allowlisted.rs b/tests/expectations/tests/no-partialeq-allowlisted.rs index 16fae741..c7895fe6 100644 --- a/tests/expectations/tests/no-partialeq-allowlisted.rs +++ b/tests/expectations/tests/no-partialeq-allowlisted.rs @@ -14,6 +14,7 @@ pub struct NoPartialEq { fn bindgen_test_layout_NoPartialEq() { const UNINIT: ::std::mem::MaybeUninit<NoPartialEq> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NoPartialEq>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_NoPartialEq() { concat!("Alignment of ", stringify!(NoPartialEq)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/no-recursive-allowlisting.rs b/tests/expectations/tests/no-recursive-allowlisting.rs index 2246fbda..6f1e19ba 100644 --- a/tests/expectations/tests/no-recursive-allowlisting.rs +++ b/tests/expectations/tests/no-recursive-allowlisting.rs @@ -16,6 +16,7 @@ pub struct Foo { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 8usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Foo), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs index ef19aa3f..457242c2 100644 --- a/tests/expectations/tests/no-std.rs +++ b/tests/expectations/tests/no-std.rs @@ -21,6 +21,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::core::mem::MaybeUninit<foo> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<foo>(), 16usize, @@ -32,26 +33,17 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/no_copy_allowlisted.rs b/tests/expectations/tests/no_copy_allowlisted.rs index a0d89a31..1c46de75 100644 --- a/tests/expectations/tests/no_copy_allowlisted.rs +++ b/tests/expectations/tests/no_copy_allowlisted.rs @@ -14,6 +14,7 @@ pub struct NoCopy { fn bindgen_test_layout_NoCopy() { const UNINIT: ::std::mem::MaybeUninit<NoCopy> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NoCopy>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_NoCopy() { concat!("Alignment of ", stringify!(NoCopy)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(NoCopy), "::", stringify!(i)) ); diff --git a/tests/expectations/tests/no_debug_allowlisted.rs b/tests/expectations/tests/no_debug_allowlisted.rs index b89dadd6..859dad8c 100644 --- a/tests/expectations/tests/no_debug_allowlisted.rs +++ b/tests/expectations/tests/no_debug_allowlisted.rs @@ -14,6 +14,7 @@ pub struct NoDebug { fn bindgen_test_layout_NoDebug() { const UNINIT: ::std::mem::MaybeUninit<NoDebug> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NoDebug>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_NoDebug() { concat!("Alignment of ", stringify!(NoDebug)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/no_default_allowlisted.rs b/tests/expectations/tests/no_default_allowlisted.rs index 94801362..c4deceb4 100644 --- a/tests/expectations/tests/no_default_allowlisted.rs +++ b/tests/expectations/tests/no_default_allowlisted.rs @@ -14,6 +14,7 @@ pub struct NoDefault { fn bindgen_test_layout_NoDefault() { const UNINIT: ::std::mem::MaybeUninit<NoDefault> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NoDefault>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_NoDefault() { concat!("Alignment of ", stringify!(NoDefault)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/non-type-params.rs b/tests/expectations/tests/non-type-params.rs index 84388828..2b38e216 100644 --- a/tests/expectations/tests/non-type-params.rs +++ b/tests/expectations/tests/non-type-params.rs @@ -18,6 +18,7 @@ pub struct UsesArray { fn bindgen_test_layout_UsesArray() { const UNINIT: ::std::mem::MaybeUninit<UsesArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<UsesArray>(), 40usize, @@ -30,7 +31,6 @@ fn bindgen_test_layout_UsesArray() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).array_char_16) as usize - ptr as usize }, 0usize, @@ -43,7 +43,6 @@ fn bindgen_test_layout_UsesArray() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).array_bool_8) as usize - ptr as usize }, 16usize, @@ -56,7 +55,6 @@ fn bindgen_test_layout_UsesArray() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).array_int_4) as usize - ptr as usize }, 24usize, diff --git a/tests/expectations/tests/objc_interface_type.rs b/tests/expectations/tests/objc_interface_type.rs index 1795eaad..423ba910 100644 --- a/tests/expectations/tests/objc_interface_type.rs +++ b/tests/expectations/tests/objc_interface_type.rs @@ -35,6 +35,7 @@ pub struct FooStruct { fn bindgen_test_layout_FooStruct() { const UNINIT: ::std::mem::MaybeUninit<FooStruct> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<FooStruct>(), 8usize, @@ -46,10 +47,7 @@ fn bindgen_test_layout_FooStruct() { concat!("Alignment of ", stringify!(FooStruct)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs index b0380e64..c28d9356 100644 --- a/tests/expectations/tests/opaque-template-inst-member-2.rs +++ b/tests/expectations/tests/opaque-template-inst-member-2.rs @@ -23,6 +23,7 @@ pub struct ContainsOpaqueTemplate { fn bindgen_test_layout_ContainsOpaqueTemplate() { const UNINIT: ::std::mem::MaybeUninit<ContainsOpaqueTemplate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsOpaqueTemplate>(), 8usize, @@ -34,10 +35,7 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { concat!("Alignment of ", stringify!(ContainsOpaqueTemplate)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBlah) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBlah) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -47,10 +45,7 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBaz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBaz) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -71,6 +66,7 @@ pub struct InheritsOpaqueTemplate { fn bindgen_test_layout_InheritsOpaqueTemplate() { const UNINIT: ::std::mem::MaybeUninit<InheritsOpaqueTemplate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<InheritsOpaqueTemplate>(), 16usize, @@ -82,10 +78,7 @@ fn bindgen_test_layout_InheritsOpaqueTemplate() { concat!("Alignment of ", stringify!(InheritsOpaqueTemplate)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).wow) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).wow) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs index f7f405dc..4ba85f66 100644 --- a/tests/expectations/tests/opaque-template-inst-member.rs +++ b/tests/expectations/tests/opaque-template-inst-member.rs @@ -21,6 +21,7 @@ pub struct ContainsOpaqueTemplate { fn bindgen_test_layout_ContainsOpaqueTemplate() { const UNINIT: ::std::mem::MaybeUninit<ContainsOpaqueTemplate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsOpaqueTemplate>(), 408usize, @@ -32,10 +33,7 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { concat!("Alignment of ", stringify!(ContainsOpaqueTemplate)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBlah) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBlah) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -45,10 +43,7 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBaz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBaz) as usize - ptr as usize }, 404usize, concat!( "Offset of field: ", @@ -83,6 +78,7 @@ pub struct InheritsOpaqueTemplate { fn bindgen_test_layout_InheritsOpaqueTemplate() { const UNINIT: ::std::mem::MaybeUninit<InheritsOpaqueTemplate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<InheritsOpaqueTemplate>(), 416usize, @@ -94,10 +90,7 @@ fn bindgen_test_layout_InheritsOpaqueTemplate() { concat!("Alignment of ", stringify!(InheritsOpaqueTemplate)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).wow) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).wow) as usize - ptr as usize }, 408usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs index cbb04872..3575216c 100644 --- a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs +++ b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs @@ -37,6 +37,7 @@ pub mod root { fn bindgen_test_layout_Foo() { const UNINIT: ::std::mem::MaybeUninit<Foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Foo>(), 1usize, @@ -49,7 +50,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, @@ -70,6 +70,7 @@ pub mod root { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -82,7 +83,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize }, 0usize, @@ -103,6 +103,7 @@ pub mod root { fn bindgen_test_layout_ContainsInstantiation() { const UNINIT: ::std::mem::MaybeUninit<ContainsInstantiation> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsInstantiation>(), 1usize, @@ -115,7 +116,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).not_opaque) as usize - ptr as usize }, @@ -146,6 +146,7 @@ pub mod root { fn bindgen_test_layout_ContainsOpaqueInstantiation() { const UNINIT: ::std::mem::MaybeUninit<ContainsOpaqueInstantiation> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsOpaqueInstantiation>(), 4usize, @@ -161,7 +162,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/opaque-template-instantiation.rs b/tests/expectations/tests/opaque-template-instantiation.rs index 53082631..910c616f 100644 --- a/tests/expectations/tests/opaque-template-instantiation.rs +++ b/tests/expectations/tests/opaque-template-instantiation.rs @@ -29,6 +29,7 @@ pub struct ContainsInstantiation { fn bindgen_test_layout_ContainsInstantiation() { const UNINIT: ::std::mem::MaybeUninit<ContainsInstantiation> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsInstantiation>(), 1usize, @@ -41,7 +42,6 @@ fn bindgen_test_layout_ContainsInstantiation() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).not_opaque) as usize - ptr as usize }, 0usize, @@ -71,6 +71,7 @@ pub struct ContainsOpaqueInstantiation { fn bindgen_test_layout_ContainsOpaqueInstantiation() { const UNINIT: ::std::mem::MaybeUninit<ContainsOpaqueInstantiation> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsOpaqueInstantiation>(), 4usize, @@ -82,10 +83,7 @@ fn bindgen_test_layout_ContainsOpaqueInstantiation() { concat!("Alignment of ", stringify!(ContainsOpaqueInstantiation)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).opaque) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs index 9caecc1f..0d13b121 100644 --- a/tests/expectations/tests/opaque_in_struct.rs +++ b/tests/expectations/tests/opaque_in_struct.rs @@ -34,6 +34,7 @@ pub struct container { fn bindgen_test_layout_container() { const UNINIT: ::std::mem::MaybeUninit<container> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<container>(), 4usize, @@ -46,7 +47,6 @@ fn bindgen_test_layout_container() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).contained) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs index 57bb2a9b..13b8cc36 100644 --- a/tests/expectations/tests/opaque_pointer.rs +++ b/tests/expectations/tests/opaque_pointer.rs @@ -42,6 +42,7 @@ pub struct WithOpaquePtr { fn bindgen_test_layout_WithOpaquePtr() { const UNINIT: ::std::mem::MaybeUninit<WithOpaquePtr> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithOpaquePtr>(), 16usize, @@ -54,7 +55,6 @@ fn bindgen_test_layout_WithOpaquePtr() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize }, 0usize, @@ -66,10 +66,7 @@ fn bindgen_test_layout_WithOpaquePtr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).other) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).other) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", @@ -79,10 +76,7 @@ fn bindgen_test_layout_WithOpaquePtr() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).t) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).t) as usize - ptr as usize }, 12usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/packed-n-with-padding.rs b/tests/expectations/tests/packed-n-with-padding.rs index 54414aeb..b171b1da 100644 --- a/tests/expectations/tests/packed-n-with-padding.rs +++ b/tests/expectations/tests/packed-n-with-padding.rs @@ -17,6 +17,7 @@ pub struct Packed { fn bindgen_test_layout_Packed() { const UNINIT: ::std::mem::MaybeUninit<Packed> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Packed>(), 10usize, @@ -28,34 +29,22 @@ fn bindgen_test_layout_Packed() { concat!("Alignment of ", stringify!(Packed)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Packed), "::", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 2usize, concat!("Offset of field: ", stringify!(Packed), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(Packed), "::", stringify!(c)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 6usize, concat!("Offset of field: ", stringify!(Packed), "::", stringify!(d)) ); diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs index b43f840f..ab57d37f 100644 --- a/tests/expectations/tests/private.rs +++ b/tests/expectations/tests/private.rs @@ -16,6 +16,7 @@ pub struct HasPrivate { fn bindgen_test_layout_HasPrivate() { const UNINIT: ::std::mem::MaybeUninit<HasPrivate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<HasPrivate>(), 8usize, @@ -28,7 +29,6 @@ fn bindgen_test_layout_HasPrivate() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mNotPrivate) as usize - ptr as usize }, 0usize, @@ -41,7 +41,6 @@ fn bindgen_test_layout_HasPrivate() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mIsPrivate) as usize - ptr as usize }, 4usize, @@ -64,6 +63,7 @@ pub struct VeryPrivate { fn bindgen_test_layout_VeryPrivate() { const UNINIT: ::std::mem::MaybeUninit<VeryPrivate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<VeryPrivate>(), 8usize, @@ -76,7 +76,6 @@ fn bindgen_test_layout_VeryPrivate() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mIsPrivate) as usize - ptr as usize }, 0usize, @@ -89,7 +88,6 @@ fn bindgen_test_layout_VeryPrivate() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mIsAlsoPrivate) as usize - ptr as usize }, 4usize, @@ -113,6 +111,7 @@ pub struct ContradictPrivate { fn bindgen_test_layout_ContradictPrivate() { const UNINIT: ::std::mem::MaybeUninit<ContradictPrivate> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContradictPrivate>(), 8usize, @@ -125,7 +124,6 @@ fn bindgen_test_layout_ContradictPrivate() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mNotPrivate) as usize - ptr as usize }, 0usize, @@ -138,7 +136,6 @@ fn bindgen_test_layout_ContradictPrivate() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mIsPrivate) as usize - ptr as usize }, 4usize, diff --git a/tests/expectations/tests/private_fields.rs b/tests/expectations/tests/private_fields.rs index 137689cc..8db332a5 100644 --- a/tests/expectations/tests/private_fields.rs +++ b/tests/expectations/tests/private_fields.rs @@ -101,6 +101,7 @@ pub struct PubPriv { fn bindgen_test_layout_PubPriv() { const UNINIT: ::std::mem::MaybeUninit<PubPriv> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<PubPriv>(), 8usize, @@ -112,10 +113,7 @@ fn bindgen_test_layout_PubPriv() { concat!("Alignment of ", stringify!(PubPriv)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -125,10 +123,7 @@ fn bindgen_test_layout_PubPriv() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -345,6 +340,7 @@ pub struct Base { fn bindgen_test_layout_Base() { const UNINIT: ::std::mem::MaybeUninit<Base> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Base>(), 4usize, @@ -356,10 +352,7 @@ fn bindgen_test_layout_Base() { concat!("Alignment of ", stringify!(Base)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -420,6 +413,7 @@ pub struct WithAnonStruct__bindgen_ty_1 { fn bindgen_test_layout_WithAnonStruct__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<WithAnonStruct__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithAnonStruct__bindgen_ty_1>(), 4usize, @@ -431,10 +425,7 @@ fn bindgen_test_layout_WithAnonStruct__bindgen_ty_1() { concat!("Alignment of ", stringify!(WithAnonStruct__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -453,6 +444,7 @@ pub struct WithAnonStruct__bindgen_ty_2 { fn bindgen_test_layout_WithAnonStruct__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<WithAnonStruct__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithAnonStruct__bindgen_ty_2>(), 4usize, @@ -464,10 +456,7 @@ fn bindgen_test_layout_WithAnonStruct__bindgen_ty_2() { concat!("Alignment of ", stringify!(WithAnonStruct__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/reparented_replacement.rs b/tests/expectations/tests/reparented_replacement.rs index 16915541..d9d13c1a 100644 --- a/tests/expectations/tests/reparented_replacement.rs +++ b/tests/expectations/tests/reparented_replacement.rs @@ -22,6 +22,7 @@ pub mod root { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -34,7 +35,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).bazz) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs index 7ff5b6d8..d4228e12 100644 --- a/tests/expectations/tests/replace_use.rs +++ b/tests/expectations/tests/replace_use.rs @@ -20,6 +20,7 @@ pub struct Test { fn bindgen_test_layout_Test() { const UNINIT: ::std::mem::MaybeUninit<Test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test>(), 4usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_Test() { concat!("Alignment of ", stringify!(Test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/repr-align.rs b/tests/expectations/tests/repr-align.rs index fd5c080a..c6fee20d 100644 --- a/tests/expectations/tests/repr-align.rs +++ b/tests/expectations/tests/repr-align.rs @@ -17,6 +17,7 @@ pub struct a { fn bindgen_test_layout_a() { const UNINIT: ::std::mem::MaybeUninit<a> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<a>(), 8usize, @@ -28,18 +29,12 @@ fn bindgen_test_layout_a() { concat!("Alignment of ", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(c)) ); @@ -55,6 +50,7 @@ pub struct b { fn bindgen_test_layout_b() { const UNINIT: ::std::mem::MaybeUninit<b> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<b>(), 8usize, @@ -66,18 +62,12 @@ fn bindgen_test_layout_b() { concat!("Alignment of ", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(b), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(b), "::", stringify!(c)) ); diff --git a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs index 30cfc67a..80024761 100644 --- a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs +++ b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs @@ -20,6 +20,7 @@ pub struct JS_shadow_Zone { fn bindgen_test_layout_JS_shadow_Zone() { const UNINIT: ::std::mem::MaybeUninit<JS_shadow_Zone> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<JS_shadow_Zone>(), 8usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_JS_shadow_Zone() { concat!("Alignment of ", stringify!(JS_shadow_Zone)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_JS_shadow_Zone() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/sentry-defined-multiple-times.rs b/tests/expectations/tests/sentry-defined-multiple-times.rs index 312823eb..48f8ca81 100644 --- a/tests/expectations/tests/sentry-defined-multiple-times.rs +++ b/tests/expectations/tests/sentry-defined-multiple-times.rs @@ -31,6 +31,7 @@ pub mod root { fn bindgen_test_layout_sentry() { const UNINIT: ::std::mem::MaybeUninit<sentry> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<sentry>(), 1usize, @@ -43,7 +44,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).i_am_plain_sentry) as usize - ptr as usize }, @@ -83,6 +83,7 @@ pub mod root { fn bindgen_test_layout_NotTemplateWrapper_sentry() { const UNINIT: ::std::mem::MaybeUninit<NotTemplateWrapper_sentry> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<NotTemplateWrapper_sentry>(), 1usize, @@ -95,7 +96,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!( (*ptr).i_am_not_template_wrapper_sentry ) as usize - @@ -125,6 +125,7 @@ pub mod root { const UNINIT: ::std::mem::MaybeUninit< InlineNotTemplateWrapper_sentry, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<InlineNotTemplateWrapper_sentry>(), 1usize, @@ -143,7 +144,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!( (*ptr).i_am_inline_not_template_wrapper_sentry ) as usize - @@ -233,6 +233,7 @@ pub mod root { const UNINIT: ::std::mem::MaybeUninit< OuterDoubleWrapper_InnerDoubleWrapper_sentry, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::< OuterDoubleWrapper_InnerDoubleWrapper_sentry, @@ -255,7 +256,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).i_am_double_wrapper_sentry) as usize - ptr as usize @@ -290,9 +290,10 @@ pub mod root { const UNINIT: ::std::mem::MaybeUninit< OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry, > = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq ! (:: std :: mem :: size_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > () , 4usize , concat ! ("Size of: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry))); assert_eq ! (:: std :: mem :: align_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > () , 4usize , concat ! ("Alignment of " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry))); - assert_eq ! (unsafe { let ptr = UNINIT . as_ptr () ; :: std :: ptr :: addr_of ! ((* ptr) . i_am_double_wrapper_inline_sentry) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) , "::" , stringify ! (i_am_double_wrapper_inline_sentry))); + assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . i_am_double_wrapper_inline_sentry) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) , "::" , stringify ! (i_am_double_wrapper_inline_sentry))); } #[test] fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper( @@ -355,6 +356,7 @@ pub mod root { fn bindgen_test_layout_sentry() { const UNINIT: ::std::mem::MaybeUninit<sentry> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<sentry>(), 4usize, @@ -367,7 +369,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).i_am_outside_namespace_sentry) as usize - ptr as usize diff --git a/tests/expectations/tests/size_t_is_usize.rs b/tests/expectations/tests/size_t_is_usize.rs index 5c2c2670..2397e0a5 100644 --- a/tests/expectations/tests/size_t_is_usize.rs +++ b/tests/expectations/tests/size_t_is_usize.rs @@ -16,6 +16,7 @@ pub struct A { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 24usize, @@ -27,26 +28,17 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(len)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(offset)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize }, 16usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(next)) ); diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs index 3b0d34f3..1aa8b9ac 100644 --- a/tests/expectations/tests/size_t_template.rs +++ b/tests/expectations/tests/size_t_template.rs @@ -14,6 +14,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 12usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(arr)) ); diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs index 37904270..8279fe1f 100644 --- a/tests/expectations/tests/struct_containing_forward_declared_struct.rs +++ b/tests/expectations/tests/struct_containing_forward_declared_struct.rs @@ -14,6 +14,7 @@ pub struct a { fn bindgen_test_layout_a() { const UNINIT: ::std::mem::MaybeUninit<a> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<a>(), 8usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_a() { concat!("Alignment of ", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).val_a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).val_a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(val_a)) ); @@ -51,6 +49,7 @@ pub struct b { fn bindgen_test_layout_b() { const UNINIT: ::std::mem::MaybeUninit<b> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<b>(), 4usize, @@ -62,10 +61,7 @@ fn bindgen_test_layout_b() { concat!("Alignment of ", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).val_b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).val_b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(b), "::", stringify!(val_b)) ); diff --git a/tests/expectations/tests/struct_typedef.rs b/tests/expectations/tests/struct_typedef.rs index dfe4822c..f9d7fedb 100644 --- a/tests/expectations/tests/struct_typedef.rs +++ b/tests/expectations/tests/struct_typedef.rs @@ -14,6 +14,7 @@ pub struct typedef_named_struct { fn bindgen_test_layout_typedef_named_struct() { const UNINIT: ::std::mem::MaybeUninit<typedef_named_struct> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<typedef_named_struct>(), 1usize, @@ -26,7 +27,6 @@ fn bindgen_test_layout_typedef_named_struct() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).has_name) as usize - ptr as usize }, 0usize, @@ -47,6 +47,7 @@ pub struct _bindgen_ty_1 { fn bindgen_test_layout__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<_bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_bindgen_ty_1>(), 8usize, @@ -58,10 +59,7 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).no_name) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).no_name) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_typedef_ns.rs b/tests/expectations/tests/struct_typedef_ns.rs index 5ac7d985..2bad358a 100644 --- a/tests/expectations/tests/struct_typedef_ns.rs +++ b/tests/expectations/tests/struct_typedef_ns.rs @@ -21,6 +21,7 @@ pub mod root { fn bindgen_test_layout_typedef_struct() { const UNINIT: ::std::mem::MaybeUninit<typedef_struct> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<typedef_struct>(), 4usize, @@ -33,7 +34,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, @@ -63,6 +63,7 @@ pub mod root { fn bindgen_test_layout__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<_bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_bindgen_ty_1>(), 4usize, @@ -75,7 +76,6 @@ pub mod root { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs index 47193018..238400a1 100644 --- a/tests/expectations/tests/struct_with_anon_struct.rs +++ b/tests/expectations/tests/struct_with_anon_struct.rs @@ -20,6 +20,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -61,6 +56,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -72,10 +68,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs index 1470a9f2..f3af6b60 100644 --- a/tests/expectations/tests/struct_with_anon_struct_array.rs +++ b/tests/expectations/tests/struct_with_anon_struct_array.rs @@ -21,6 +21,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -32,10 +33,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -45,10 +43,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -68,6 +63,7 @@ pub struct foo__bindgen_ty_2 { fn bindgen_test_layout_foo__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_2>(), 8usize, @@ -79,10 +75,7 @@ fn bindgen_test_layout_foo__bindgen_ty_2() { concat!("Alignment of ", stringify!(foo__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -92,10 +85,7 @@ fn bindgen_test_layout_foo__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -109,6 +99,7 @@ fn bindgen_test_layout_foo__bindgen_ty_2() { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 208usize, @@ -120,18 +111,12 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 16usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs index 77a2dcd5..5bb10079 100644 --- a/tests/expectations/tests/struct_with_anon_struct_pointer.rs +++ b/tests/expectations/tests/struct_with_anon_struct_pointer.rs @@ -20,6 +20,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -61,6 +56,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -72,10 +68,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs index f97c5236..08aab0a9 100644 --- a/tests/expectations/tests/struct_with_anon_union.rs +++ b/tests/expectations/tests/struct_with_anon_union.rs @@ -20,6 +20,7 @@ pub union foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -70,6 +65,7 @@ impl Default for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -81,10 +77,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/struct_with_anon_union_1_0.rs b/tests/expectations/tests/struct_with_anon_union_1_0.rs index e6b6d4f7..8db33d11 100644 --- a/tests/expectations/tests/struct_with_anon_union_1_0.rs +++ b/tests/expectations/tests/struct_with_anon_union_1_0.rs @@ -64,6 +64,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -75,10 +76,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -88,10 +86,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -110,6 +105,7 @@ impl Clone for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -121,10 +117,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs index 022f067f..56981065 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs @@ -20,6 +20,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs index f312ccd0..499fc7a1 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs @@ -20,6 +20,7 @@ pub union foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs index b138ef0f..55432d47 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs @@ -64,6 +64,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -75,10 +76,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -88,10 +86,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs index 921d6c83..a9be3006 100644 --- a/tests/expectations/tests/struct_with_bitfields.rs +++ b/tests/expectations/tests/struct_with_bitfields.rs @@ -104,6 +104,7 @@ pub struct bitfield { fn bindgen_test_layout_bitfield() { const UNINIT: ::std::mem::MaybeUninit<bitfield> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bitfield>(), 16usize, @@ -115,10 +116,7 @@ fn bindgen_test_layout_bitfield() { concat!("Alignment of ", stringify!(bitfield)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).e) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).e) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs index 890223ac..1bb7c77d 100644 --- a/tests/expectations/tests/struct_with_derive_debug.rs +++ b/tests/expectations/tests/struct_with_derive_debug.rs @@ -14,6 +14,7 @@ pub struct LittleArray { fn bindgen_test_layout_LittleArray() { const UNINIT: ::std::mem::MaybeUninit<LittleArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<LittleArray>(), 128usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_LittleArray() { concat!("Alignment of ", stringify!(LittleArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -47,6 +45,7 @@ pub struct BigArray { fn bindgen_test_layout_BigArray() { const UNINIT: ::std::mem::MaybeUninit<BigArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<BigArray>(), 132usize, @@ -58,10 +57,7 @@ fn bindgen_test_layout_BigArray() { concat!("Alignment of ", stringify!(BigArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -89,6 +85,7 @@ pub struct WithLittleArray { fn bindgen_test_layout_WithLittleArray() { const UNINIT: ::std::mem::MaybeUninit<WithLittleArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithLittleArray>(), 128usize, @@ -100,10 +97,7 @@ fn bindgen_test_layout_WithLittleArray() { concat!("Alignment of ", stringify!(WithLittleArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -122,6 +116,7 @@ pub struct WithBigArray { fn bindgen_test_layout_WithBigArray() { const UNINIT: ::std::mem::MaybeUninit<WithBigArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithBigArray>(), 132usize, @@ -133,10 +128,7 @@ fn bindgen_test_layout_WithBigArray() { concat!("Alignment of ", stringify!(WithBigArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/struct_with_large_array.rs b/tests/expectations/tests/struct_with_large_array.rs index 1d98ae13..9f2c0ecc 100644 --- a/tests/expectations/tests/struct_with_large_array.rs +++ b/tests/expectations/tests/struct_with_large_array.rs @@ -14,6 +14,7 @@ pub struct S { fn bindgen_test_layout_S() { const UNINIT: ::std::mem::MaybeUninit<S> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<S>(), 33usize, @@ -26,7 +27,6 @@ fn bindgen_test_layout_S() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs index 34d26f5f..ff177ff1 100644 --- a/tests/expectations/tests/struct_with_nesting.rs +++ b/tests/expectations/tests/struct_with_nesting.rs @@ -28,6 +28,7 @@ pub struct foo__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>(), 4usize, @@ -39,10 +40,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -52,10 +50,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -77,6 +72,7 @@ pub struct foo__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>(), 4usize, @@ -88,10 +84,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -101,10 +94,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d2) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", @@ -114,10 +104,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d3) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -127,10 +114,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d4) as usize - ptr as usize }, 3usize, concat!( "Offset of field: ", @@ -144,6 +128,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -155,10 +140,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -181,6 +163,7 @@ impl Default for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -192,10 +175,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/struct_with_nesting_1_0.rs b/tests/expectations/tests/struct_with_nesting_1_0.rs index e9acf626..af795b64 100644 --- a/tests/expectations/tests/struct_with_nesting_1_0.rs +++ b/tests/expectations/tests/struct_with_nesting_1_0.rs @@ -72,6 +72,7 @@ pub struct foo__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>(), 4usize, @@ -83,10 +84,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -96,10 +94,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -126,6 +121,7 @@ pub struct foo__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>(), 4usize, @@ -137,10 +133,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -150,10 +143,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d2) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", @@ -163,10 +153,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d3) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d3) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -176,10 +163,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d4) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d4) as usize - ptr as usize }, 3usize, concat!( "Offset of field: ", @@ -198,6 +182,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -209,10 +194,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -231,6 +213,7 @@ impl Clone for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -242,10 +225,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs index c34ea7bf..b8ea17cd 100644 --- a/tests/expectations/tests/struct_with_packing.rs +++ b/tests/expectations/tests/struct_with_packing.rs @@ -15,6 +15,7 @@ pub struct a { fn bindgen_test_layout_a() { const UNINIT: ::std::mem::MaybeUninit<a> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<a>(), 3usize, @@ -26,18 +27,12 @@ fn bindgen_test_layout_a() { concat!("Alignment of ", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 1usize, concat!("Offset of field: ", stringify!(a), "::", stringify!(c)) ); diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs index a334d79c..b1ee5db4 100644 --- a/tests/expectations/tests/struct_with_struct.rs +++ b/tests/expectations/tests/struct_with_struct.rs @@ -20,6 +20,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -61,6 +56,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -72,10 +68,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index 6b965f32..7637295a 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -70,6 +70,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 104usize, @@ -81,16 +82,12 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mB) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mB) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(mB)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBConstPtr) as usize - ptr as usize }, 8usize, @@ -103,7 +100,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBConstStructPtr) as usize - ptr as usize }, @@ -117,7 +113,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBConstStructPtrArray) as usize - ptr as usize }, @@ -130,10 +125,7 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBConst) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBConst) as usize - ptr as usize }, 32usize, concat!( "Offset of field: ", @@ -144,7 +136,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBVolatile) as usize - ptr as usize }, 36usize, @@ -157,7 +148,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBConstBool) as usize - ptr as usize }, 40usize, @@ -170,7 +160,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBConstChar) as usize - ptr as usize }, 42usize, @@ -182,10 +171,7 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBArray) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBArray) as usize - ptr as usize }, 44usize, concat!( "Offset of field: ", @@ -196,7 +182,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBPtrArray) as usize - ptr as usize }, 48usize, @@ -209,7 +194,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBArrayPtr) as usize - ptr as usize }, 56usize, @@ -221,16 +205,12 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBRef) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBRef) as usize - ptr as usize }, 64usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(mBRef)) ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBConstRef) as usize - ptr as usize }, 72usize, @@ -242,10 +222,7 @@ fn bindgen_test_layout_C() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPtrRef) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mPtrRef) as usize - ptr as usize }, 80usize, concat!( "Offset of field: ", @@ -256,7 +233,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mArrayRef) as usize - ptr as usize }, 88usize, @@ -269,7 +245,6 @@ fn bindgen_test_layout_C() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mBConstArray) as usize - ptr as usize }, 96usize, @@ -347,6 +322,7 @@ pub struct RootedContainer { fn bindgen_test_layout_RootedContainer() { const UNINIT: ::std::mem::MaybeUninit<RootedContainer> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<RootedContainer>(), 24usize, @@ -358,10 +334,7 @@ fn bindgen_test_layout_RootedContainer() { concat!("Alignment of ", stringify!(RootedContainer)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).root) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).root) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -405,6 +378,7 @@ pub struct PODButContainsDtor { fn bindgen_test_layout_PODButContainsDtor() { const UNINIT: ::std::mem::MaybeUninit<PODButContainsDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<PODButContainsDtor>(), 4usize, @@ -416,10 +390,7 @@ fn bindgen_test_layout_PODButContainsDtor() { concat!("Alignment of ", stringify!(PODButContainsDtor)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -453,6 +424,7 @@ pub struct POD { fn bindgen_test_layout_POD() { const UNINIT: ::std::mem::MaybeUninit<POD> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<POD>(), 4usize, @@ -465,7 +437,6 @@ fn bindgen_test_layout_POD() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).opaque_member) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/test_mixed_header_and_header_contents.rs b/tests/expectations/tests/test_mixed_header_and_header_contents.rs index 7475a521..5f8da2af 100644 --- a/tests/expectations/tests/test_mixed_header_and_header_contents.rs +++ b/tests/expectations/tests/test_mixed_header_and_header_contents.rs @@ -35,6 +35,7 @@ pub struct Test { fn bindgen_test_layout_Test() { const UNINIT: ::std::mem::MaybeUninit<Test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test>(), 12usize, @@ -46,82 +47,52 @@ fn bindgen_test_layout_Test() { concat!("Alignment of ", stringify!(Test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 1usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(u)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 2usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize }, 3usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize }, 5usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize }, 6usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize }, 7usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize }, 9usize, concat!( "Offset of field: ", @@ -131,18 +102,12 @@ fn bindgen_test_layout_Test() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize }, 10usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize }, 11usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd)) ); diff --git a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs index a51a11f6..b594d70c 100644 --- a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs +++ b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs @@ -29,6 +29,7 @@ pub struct Test { fn bindgen_test_layout_Test() { const UNINIT: ::std::mem::MaybeUninit<Test> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Test>(), 12usize, @@ -40,82 +41,52 @@ fn bindgen_test_layout_Test() { concat!("Alignment of ", stringify!(Test)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, 1usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(u)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, 2usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(d)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize }, 3usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize }, 5usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize }, 6usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize }, 7usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize }, 9usize, concat!( "Offset of field: ", @@ -125,18 +96,12 @@ fn bindgen_test_layout_Test() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize }, 10usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize }, 11usize, concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd)) ); diff --git a/tests/expectations/tests/timex.rs b/tests/expectations/tests/timex.rs index 916e4eec..dfcebdd2 100644 --- a/tests/expectations/tests/timex.rs +++ b/tests/expectations/tests/timex.rs @@ -102,6 +102,7 @@ pub struct timex { fn bindgen_test_layout_timex() { const UNINIT: ::std::mem::MaybeUninit<timex> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<timex>(), 48usize, @@ -113,10 +114,7 @@ fn bindgen_test_layout_timex() { concat!("Alignment of ", stringify!(timex)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tai) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tai) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -146,6 +144,7 @@ pub struct timex_named { fn bindgen_test_layout_timex_named() { const UNINIT: ::std::mem::MaybeUninit<timex_named> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<timex_named>(), 48usize, @@ -157,10 +156,7 @@ fn bindgen_test_layout_timex_named() { concat!("Alignment of ", stringify!(timex_named)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).tai) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).tai) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/type-referenced-by-allowlisted-function.rs b/tests/expectations/tests/type-referenced-by-allowlisted-function.rs index 0383e1dd..7ae042bc 100644 --- a/tests/expectations/tests/type-referenced-by-allowlisted-function.rs +++ b/tests/expectations/tests/type-referenced-by-allowlisted-function.rs @@ -14,6 +14,7 @@ pub struct dl_phdr_info { fn bindgen_test_layout_dl_phdr_info() { const UNINIT: ::std::mem::MaybeUninit<dl_phdr_info> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<dl_phdr_info>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_dl_phdr_info() { concat!("Alignment of ", stringify!(dl_phdr_info)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs index ad1a9761..a3a31daf 100644 --- a/tests/expectations/tests/typeref.rs +++ b/tests/expectations/tests/typeref.rs @@ -14,6 +14,7 @@ pub struct mozilla_FragmentOrURL { fn bindgen_test_layout_mozilla_FragmentOrURL() { const UNINIT: ::std::mem::MaybeUninit<mozilla_FragmentOrURL> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<mozilla_FragmentOrURL>(), 1usize, @@ -26,7 +27,6 @@ fn bindgen_test_layout_mozilla_FragmentOrURL() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mIsLocalRef) as usize - ptr as usize }, 0usize, @@ -92,6 +92,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -103,10 +104,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(mFoo)) ); @@ -128,6 +126,7 @@ pub struct nsFoo { fn bindgen_test_layout_nsFoo() { const UNINIT: ::std::mem::MaybeUninit<nsFoo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsFoo>(), 8usize, @@ -139,10 +138,7 @@ fn bindgen_test_layout_nsFoo() { concat!("Alignment of ", stringify!(nsFoo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs index c043b9e6..8e4143c0 100644 --- a/tests/expectations/tests/typeref_1_0.rs +++ b/tests/expectations/tests/typeref_1_0.rs @@ -57,6 +57,7 @@ pub struct mozilla_FragmentOrURL { fn bindgen_test_layout_mozilla_FragmentOrURL() { const UNINIT: ::std::mem::MaybeUninit<mozilla_FragmentOrURL> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<mozilla_FragmentOrURL>(), 1usize, @@ -69,7 +70,6 @@ fn bindgen_test_layout_mozilla_FragmentOrURL() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mIsLocalRef) as usize - ptr as usize }, 0usize, @@ -130,6 +130,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 8usize, @@ -141,10 +142,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(mFoo)) ); @@ -172,6 +170,7 @@ pub struct nsFoo { fn bindgen_test_layout_nsFoo() { const UNINIT: ::std::mem::MaybeUninit<nsFoo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsFoo>(), 8usize, @@ -183,10 +182,7 @@ fn bindgen_test_layout_nsFoo() { concat!("Alignment of ", stringify!(nsFoo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/underscore.rs b/tests/expectations/tests/underscore.rs index 8752d08e..bfc05ac1 100644 --- a/tests/expectations/tests/underscore.rs +++ b/tests/expectations/tests/underscore.rs @@ -15,6 +15,7 @@ pub struct ptr_t { fn bindgen_test_layout_ptr_t() { const UNINIT: ::std::mem::MaybeUninit<ptr_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ptr_t>(), 8usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_ptr_t() { concat!("Alignment of ", stringify!(ptr_t)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).__) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).__) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(ptr_t), "::", stringify!(__)) ); diff --git a/tests/expectations/tests/union-align.rs b/tests/expectations/tests/union-align.rs index 4c2f8ba5..062ea97a 100644 --- a/tests/expectations/tests/union-align.rs +++ b/tests/expectations/tests/union-align.rs @@ -15,6 +15,7 @@ pub union Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 16usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Bar), "::", stringify!(foo)) ); @@ -53,6 +51,7 @@ pub union Baz { fn bindgen_test_layout_Baz() { const UNINIT: ::std::mem::MaybeUninit<Baz> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Baz>(), 16usize, @@ -64,10 +63,7 @@ fn bindgen_test_layout_Baz() { concat!("Alignment of ", stringify!(Baz)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(Baz), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs index 27ade8e2..65f3f8f2 100644 --- a/tests/expectations/tests/union-in-ns.rs +++ b/tests/expectations/tests/union-in-ns.rs @@ -18,6 +18,7 @@ pub mod root { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 4usize, @@ -29,10 +30,7 @@ pub mod root { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union-in-ns_1_0.rs b/tests/expectations/tests/union-in-ns_1_0.rs index d81d22a2..a057cc34 100644 --- a/tests/expectations/tests/union-in-ns_1_0.rs +++ b/tests/expectations/tests/union-in-ns_1_0.rs @@ -65,6 +65,7 @@ pub mod root { fn bindgen_test_layout_bar() { const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<bar>(), 4usize, @@ -76,10 +77,7 @@ pub mod root { concat!("Alignment of ", stringify!(bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs index 95216024..085e5ca3 100644 --- a/tests/expectations/tests/union_dtor.rs +++ b/tests/expectations/tests/union_dtor.rs @@ -14,6 +14,7 @@ pub union UnionWithDtor { fn bindgen_test_layout_UnionWithDtor() { const UNINIT: ::std::mem::MaybeUninit<UnionWithDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<UnionWithDtor>(), 8usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_UnionWithDtor() { concat!("Alignment of ", stringify!(UnionWithDtor)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -38,10 +36,7 @@ fn bindgen_test_layout_UnionWithDtor() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_dtor_1_0.rs b/tests/expectations/tests/union_dtor_1_0.rs index 3579cb64..67455aa8 100644 --- a/tests/expectations/tests/union_dtor_1_0.rs +++ b/tests/expectations/tests/union_dtor_1_0.rs @@ -59,6 +59,7 @@ pub struct UnionWithDtor { fn bindgen_test_layout_UnionWithDtor() { const UNINIT: ::std::mem::MaybeUninit<UnionWithDtor> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<UnionWithDtor>(), 8usize, @@ -70,10 +71,7 @@ fn bindgen_test_layout_UnionWithDtor() { concat!("Alignment of ", stringify!(UnionWithDtor)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFoo) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -83,10 +81,7 @@ fn bindgen_test_layout_UnionWithDtor() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mBar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs index af1b1626..9135ca3c 100644 --- a/tests/expectations/tests/union_fields.rs +++ b/tests/expectations/tests/union_fields.rs @@ -16,6 +16,7 @@ pub union nsStyleUnion { fn bindgen_test_layout_nsStyleUnion() { const UNINIT: ::std::mem::MaybeUninit<nsStyleUnion> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsStyleUnion>(), 8usize, @@ -27,10 +28,7 @@ fn bindgen_test_layout_nsStyleUnion() { concat!("Alignment of ", stringify!(nsStyleUnion)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mInt) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mInt) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -40,10 +38,7 @@ fn bindgen_test_layout_nsStyleUnion() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFloat) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFloat) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -54,7 +49,6 @@ fn bindgen_test_layout_nsStyleUnion() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mPointer) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/union_fields_1_0.rs b/tests/expectations/tests/union_fields_1_0.rs index c575efb8..b5f94bcd 100644 --- a/tests/expectations/tests/union_fields_1_0.rs +++ b/tests/expectations/tests/union_fields_1_0.rs @@ -60,6 +60,7 @@ pub struct nsStyleUnion { fn bindgen_test_layout_nsStyleUnion() { const UNINIT: ::std::mem::MaybeUninit<nsStyleUnion> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<nsStyleUnion>(), 8usize, @@ -71,10 +72,7 @@ fn bindgen_test_layout_nsStyleUnion() { concat!("Alignment of ", stringify!(nsStyleUnion)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mInt) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mInt) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -84,10 +82,7 @@ fn bindgen_test_layout_nsStyleUnion() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFloat) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mFloat) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -98,7 +93,6 @@ fn bindgen_test_layout_nsStyleUnion() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mPointer) as usize - ptr as usize }, 0usize, diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs index f2502fc0..35b5829b 100644 --- a/tests/expectations/tests/union_with_anon_struct.rs +++ b/tests/expectations/tests/union_with_anon_struct.rs @@ -20,6 +20,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -61,6 +56,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -72,10 +68,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/union_with_anon_struct_1_0.rs b/tests/expectations/tests/union_with_anon_struct_1_0.rs index 61366539..8b11e757 100644 --- a/tests/expectations/tests/union_with_anon_struct_1_0.rs +++ b/tests/expectations/tests/union_with_anon_struct_1_0.rs @@ -64,6 +64,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 8usize, @@ -75,10 +76,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -88,10 +86,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -110,6 +105,7 @@ impl Clone for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -121,10 +117,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs index ccceca24..e81b3bef 100644 --- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs +++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs @@ -166,6 +166,7 @@ impl foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -177,10 +178,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs index 0a8c2aea..6ce6ed22 100644 --- a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs +++ b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs @@ -215,6 +215,7 @@ impl foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -226,10 +227,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs index 063fa546..487650bf 100644 --- a/tests/expectations/tests/union_with_anon_union.rs +++ b/tests/expectations/tests/union_with_anon_union.rs @@ -20,6 +20,7 @@ pub union foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -31,10 +32,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -44,10 +42,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -70,6 +65,7 @@ impl Default for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -81,10 +77,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/union_with_anon_union_1_0.rs b/tests/expectations/tests/union_with_anon_union_1_0.rs index c366fac0..f3e4b840 100644 --- a/tests/expectations/tests/union_with_anon_union_1_0.rs +++ b/tests/expectations/tests/union_with_anon_union_1_0.rs @@ -65,6 +65,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 4usize, @@ -76,10 +77,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -89,10 +87,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -111,6 +106,7 @@ impl Clone for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -122,10 +118,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs index d1aec853..cff5df04 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs @@ -23,6 +23,7 @@ pub struct pixel__bindgen_ty_1 { fn bindgen_test_layout_pixel__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<pixel__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<pixel__bindgen_ty_1>(), 4usize, @@ -34,10 +35,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { concat!("Alignment of ", stringify!(pixel__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -47,10 +45,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", @@ -60,10 +55,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -73,10 +65,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 3usize, concat!( "Offset of field: ", @@ -90,6 +79,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { fn bindgen_test_layout_pixel() { const UNINIT: ::std::mem::MaybeUninit<pixel> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<pixel>(), 4usize, @@ -101,10 +91,7 @@ fn bindgen_test_layout_pixel() { concat!("Alignment of ", stringify!(pixel)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rgba) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rgba) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs index cc4117f6..1562a8c9 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs @@ -67,6 +67,7 @@ pub struct pixel__bindgen_ty_1 { fn bindgen_test_layout_pixel__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<pixel__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<pixel__bindgen_ty_1>(), 4usize, @@ -78,10 +79,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { concat!("Alignment of ", stringify!(pixel__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -91,10 +89,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", @@ -104,10 +99,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", @@ -117,10 +109,7 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 3usize, concat!( "Offset of field: ", @@ -139,6 +128,7 @@ impl Clone for pixel__bindgen_ty_1 { fn bindgen_test_layout_pixel() { const UNINIT: ::std::mem::MaybeUninit<pixel> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<pixel>(), 4usize, @@ -150,10 +140,7 @@ fn bindgen_test_layout_pixel() { concat!("Alignment of ", stringify!(pixel)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).rgba) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).rgba) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs index 9da74dfc..f1abfc5a 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_union.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs @@ -21,6 +21,7 @@ pub union foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 2usize, @@ -32,10 +33,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -45,10 +43,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -71,6 +66,7 @@ impl Default for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -82,10 +78,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs index 4f3d711c..197a6bbf 100644 --- a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs +++ b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs @@ -66,6 +66,7 @@ pub struct foo__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1>(), 2usize, @@ -77,10 +78,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -90,10 +88,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -112,6 +107,7 @@ impl Clone for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -123,10 +119,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs index f80cba63..7110257b 100644 --- a/tests/expectations/tests/union_with_big_member.rs +++ b/tests/expectations/tests/union_with_big_member.rs @@ -15,6 +15,7 @@ pub union WithBigArray { fn bindgen_test_layout_WithBigArray() { const UNINIT: ::std::mem::MaybeUninit<WithBigArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithBigArray>(), 132usize, @@ -26,10 +27,7 @@ fn bindgen_test_layout_WithBigArray() { concat!("Alignment of ", stringify!(WithBigArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -39,10 +37,7 @@ fn bindgen_test_layout_WithBigArray() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -71,6 +66,7 @@ pub union WithBigArray2 { fn bindgen_test_layout_WithBigArray2() { const UNINIT: ::std::mem::MaybeUninit<WithBigArray2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithBigArray2>(), 36usize, @@ -82,10 +78,7 @@ fn bindgen_test_layout_WithBigArray2() { concat!("Alignment of ", stringify!(WithBigArray2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -95,10 +88,7 @@ fn bindgen_test_layout_WithBigArray2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -127,6 +117,7 @@ pub union WithBigMember { fn bindgen_test_layout_WithBigMember() { const UNINIT: ::std::mem::MaybeUninit<WithBigMember> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithBigMember>(), 132usize, @@ -138,10 +129,7 @@ fn bindgen_test_layout_WithBigMember() { concat!("Alignment of ", stringify!(WithBigMember)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -151,10 +139,7 @@ fn bindgen_test_layout_WithBigMember() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_big_member_1_0.rs b/tests/expectations/tests/union_with_big_member_1_0.rs index 4cb330bf..63b43baa 100644 --- a/tests/expectations/tests/union_with_big_member_1_0.rs +++ b/tests/expectations/tests/union_with_big_member_1_0.rs @@ -59,6 +59,7 @@ pub struct WithBigArray { fn bindgen_test_layout_WithBigArray() { const UNINIT: ::std::mem::MaybeUninit<WithBigArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithBigArray>(), 132usize, @@ -70,10 +71,7 @@ fn bindgen_test_layout_WithBigArray() { concat!("Alignment of ", stringify!(WithBigArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -83,10 +81,7 @@ fn bindgen_test_layout_WithBigArray() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -121,6 +116,7 @@ pub struct WithBigArray2 { fn bindgen_test_layout_WithBigArray2() { const UNINIT: ::std::mem::MaybeUninit<WithBigArray2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithBigArray2>(), 36usize, @@ -132,10 +128,7 @@ fn bindgen_test_layout_WithBigArray2() { concat!("Alignment of ", stringify!(WithBigArray2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -145,10 +138,7 @@ fn bindgen_test_layout_WithBigArray2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -174,6 +164,7 @@ pub struct WithBigMember { fn bindgen_test_layout_WithBigMember() { const UNINIT: ::std::mem::MaybeUninit<WithBigMember> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<WithBigMember>(), 132usize, @@ -185,10 +176,7 @@ fn bindgen_test_layout_WithBigMember() { concat!("Alignment of ", stringify!(WithBigMember)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -198,10 +186,7 @@ fn bindgen_test_layout_WithBigMember() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs index c399b633..ec9c1480 100644 --- a/tests/expectations/tests/union_with_nesting.rs +++ b/tests/expectations/tests/union_with_nesting.rs @@ -27,6 +27,7 @@ pub union foo__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>(), 2usize, @@ -38,10 +39,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -51,10 +49,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -83,6 +78,7 @@ pub union foo__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>(), 2usize, @@ -94,10 +90,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -107,10 +100,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -155,6 +145,7 @@ impl Default for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -166,10 +157,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/union_with_nesting_1_0.rs b/tests/expectations/tests/union_with_nesting_1_0.rs index 2bc30977..a1e452fe 100644 --- a/tests/expectations/tests/union_with_nesting_1_0.rs +++ b/tests/expectations/tests/union_with_nesting_1_0.rs @@ -72,6 +72,7 @@ pub struct foo__bindgen_ty_1__bindgen_ty_1 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>(), 2usize, @@ -83,10 +84,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -96,10 +94,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).b2) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -125,6 +120,7 @@ pub struct foo__bindgen_ty_1__bindgen_ty_2 { fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { const UNINIT: ::std::mem::MaybeUninit<foo__bindgen_ty_1__bindgen_ty_2> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>(), 2usize, @@ -136,10 +132,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c1) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -149,10 +142,7 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).c2) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -189,6 +179,7 @@ impl Clone for foo__bindgen_ty_1 { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 4usize, @@ -200,10 +191,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); diff --git a/tests/expectations/tests/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs index a48e9733..c790f009 100644 --- a/tests/expectations/tests/unknown_attr.rs +++ b/tests/expectations/tests/unknown_attr.rs @@ -17,6 +17,7 @@ pub struct max_align_t { fn bindgen_test_layout_max_align_t() { const UNINIT: ::std::mem::MaybeUninit<max_align_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<max_align_t>(), 32usize, @@ -29,7 +30,6 @@ fn bindgen_test_layout_max_align_t() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, @@ -43,7 +43,6 @@ fn bindgen_test_layout_max_align_t() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs index b2a7d303..e6124d5a 100644 --- a/tests/expectations/tests/use-core.rs +++ b/tests/expectations/tests/use-core.rs @@ -18,6 +18,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::core::mem::MaybeUninit<foo> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<foo>(), 16usize, @@ -29,26 +30,17 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); @@ -72,6 +64,7 @@ pub union _bindgen_ty_1 { fn bindgen_test_layout__bindgen_ty_1() { const UNINIT: ::core::mem::MaybeUninit<_bindgen_ty_1> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<_bindgen_ty_1>(), 8usize, @@ -83,10 +76,7 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -96,10 +86,7 @@ fn bindgen_test_layout__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs index ca852871..8c6d0fd2 100644 --- a/tests/expectations/tests/use-core_1_0.rs +++ b/tests/expectations/tests/use-core_1_0.rs @@ -61,6 +61,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::core::mem::MaybeUninit<foo> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<foo>(), 16usize, @@ -72,26 +73,17 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(a)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).b) as usize - ptr as usize }, 4usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(b)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar)) ); @@ -121,6 +113,7 @@ pub struct _bindgen_ty_1 { fn bindgen_test_layout__bindgen_ty_1() { const UNINIT: ::core::mem::MaybeUninit<_bindgen_ty_1> = ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::core::mem::size_of::<_bindgen_ty_1>(), 8usize, @@ -132,10 +125,7 @@ fn bindgen_test_layout__bindgen_ty_1() { concat!("Alignment of ", stringify!(_bindgen_ty_1)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -145,10 +135,7 @@ fn bindgen_test_layout__bindgen_ty_1() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::core::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::core::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs index 9d8e7450..4280802e 100644 --- a/tests/expectations/tests/var-tracing.rs +++ b/tests/expectations/tests/var-tracing.rs @@ -14,6 +14,7 @@ pub struct Bar { fn bindgen_test_layout_Bar() { const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Bar>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_Bar() { concat!("Alignment of ", stringify!(Bar)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).m_baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).m_baz) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/vector.rs b/tests/expectations/tests/vector.rs index 5f90c82f..12d2e1b1 100644 --- a/tests/expectations/tests/vector.rs +++ b/tests/expectations/tests/vector.rs @@ -14,6 +14,7 @@ pub struct foo { fn bindgen_test_layout_foo() { const UNINIT: ::std::mem::MaybeUninit<foo> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<foo>(), 8usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_foo() { concat!("Alignment of ", stringify!(foo)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/virtual_inheritance.rs b/tests/expectations/tests/virtual_inheritance.rs index eeafa0b3..2c15b428 100644 --- a/tests/expectations/tests/virtual_inheritance.rs +++ b/tests/expectations/tests/virtual_inheritance.rs @@ -14,6 +14,7 @@ pub struct A { fn bindgen_test_layout_A() { const UNINIT: ::std::mem::MaybeUninit<A> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<A>(), 4usize, @@ -25,10 +26,7 @@ fn bindgen_test_layout_A() { concat!("Alignment of ", stringify!(A)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize }, 0usize, concat!("Offset of field: ", stringify!(A), "::", stringify!(foo)) ); @@ -45,6 +43,7 @@ pub struct B { fn bindgen_test_layout_B() { const UNINIT: ::std::mem::MaybeUninit<B> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<B>(), 16usize, @@ -56,10 +55,7 @@ fn bindgen_test_layout_B() { concat!("Alignment of ", stringify!(B)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(B), "::", stringify!(bar)) ); @@ -85,6 +81,7 @@ pub struct C { fn bindgen_test_layout_C() { const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<C>(), 16usize, @@ -96,10 +93,7 @@ fn bindgen_test_layout_C() { concat!("Alignment of ", stringify!(C)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize }, 8usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(baz)) ); diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs index 0522899c..9383bada 100644 --- a/tests/expectations/tests/weird_bitfields.rs +++ b/tests/expectations/tests/weird_bitfields.rs @@ -123,6 +123,7 @@ pub struct Weird { fn bindgen_test_layout_Weird() { const UNINIT: ::std::mem::MaybeUninit<Weird> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<Weird>(), 24usize, @@ -135,7 +136,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mStrokeDasharrayLength) as usize - ptr as usize }, @@ -149,7 +149,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mClipRule) as usize - ptr as usize }, 8usize, @@ -162,7 +161,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mColorInterpolation) as usize - ptr as usize }, @@ -176,7 +174,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mColorInterpolationFilters) as usize - ptr as usize }, @@ -190,7 +187,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mFillRule) as usize - ptr as usize }, 11usize, @@ -203,7 +199,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mImageRendering) as usize - ptr as usize }, 12usize, @@ -216,7 +211,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mPaintOrder) as usize - ptr as usize }, 13usize, @@ -229,7 +223,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mShapeRendering) as usize - ptr as usize }, 14usize, @@ -242,7 +235,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mStrokeLinecap) as usize - ptr as usize }, 15usize, @@ -255,7 +247,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mStrokeLinejoin) as usize - ptr as usize }, 16usize, @@ -268,7 +259,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mTextAnchor) as usize - ptr as usize }, 17usize, @@ -281,7 +271,6 @@ fn bindgen_test_layout_Weird() { ); assert_eq!( unsafe { - let ptr = UNINIT.as_ptr(); ::std::ptr::addr_of!((*ptr).mTextRendering) as usize - ptr as usize }, 18usize, diff --git a/tests/expectations/tests/zero-size-array-align.rs b/tests/expectations/tests/zero-size-array-align.rs index 7158875e..d7d0f661 100644 --- a/tests/expectations/tests/zero-size-array-align.rs +++ b/tests/expectations/tests/zero-size-array-align.rs @@ -46,6 +46,7 @@ pub struct dm_deps { fn bindgen_test_layout_dm_deps() { const UNINIT: ::std::mem::MaybeUninit<dm_deps> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<dm_deps>(), 8usize, @@ -57,10 +58,7 @@ fn bindgen_test_layout_dm_deps() { concat!("Alignment of ", stringify!(dm_deps)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).count) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).count) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -70,10 +68,7 @@ fn bindgen_test_layout_dm_deps() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).filler) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).filler) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", @@ -83,10 +78,7 @@ fn bindgen_test_layout_dm_deps() { ) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).device) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).device) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", diff --git a/tests/expectations/tests/zero-sized-array.rs b/tests/expectations/tests/zero-sized-array.rs index 358164d3..4ba52498 100644 --- a/tests/expectations/tests/zero-sized-array.rs +++ b/tests/expectations/tests/zero-sized-array.rs @@ -45,6 +45,7 @@ pub struct ZeroSizedArray { fn bindgen_test_layout_ZeroSizedArray() { const UNINIT: ::std::mem::MaybeUninit<ZeroSizedArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ZeroSizedArray>(), 0usize, @@ -56,10 +57,7 @@ fn bindgen_test_layout_ZeroSizedArray() { concat!("Alignment of ", stringify!(ZeroSizedArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).arr) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", @@ -79,6 +77,7 @@ pub struct ContainsZeroSizedArray { fn bindgen_test_layout_ContainsZeroSizedArray() { const UNINIT: ::std::mem::MaybeUninit<ContainsZeroSizedArray> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<ContainsZeroSizedArray>(), 0usize, @@ -90,10 +89,7 @@ fn bindgen_test_layout_ContainsZeroSizedArray() { concat!("Alignment of ", stringify!(ContainsZeroSizedArray)) ); assert_eq!( - unsafe { - let ptr = UNINIT.as_ptr(); - ::std::ptr::addr_of!((*ptr).zsa) as usize - ptr as usize - }, + unsafe { ::std::ptr::addr_of!((*ptr).zsa) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", |