summaryrefslogtreecommitdiff
path: root/tests/expectations/tests/derive-partialeq-pointer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/expectations/tests/derive-partialeq-pointer.rs')
-rw-r--r--tests/expectations/tests/derive-partialeq-pointer.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/expectations/tests/derive-partialeq-pointer.rs b/tests/expectations/tests/derive-partialeq-pointer.rs
index 17a5edcb..a2d6246c 100644
--- a/tests/expectations/tests/derive-partialeq-pointer.rs
+++ b/tests/expectations/tests/derive-partialeq-pointer.rs
@@ -23,7 +23,11 @@ fn bindgen_test_layout_Bar() {
concat!("Alignment of ", stringify!(Bar))
);
assert_eq!(
- unsafe { &(*(::std::ptr::null::<Bar>())).b as *const _ as usize },
+ unsafe {
+ let uninit = ::std::mem::MaybeUninit::<Bar>::uninit();
+ let ptr = uninit.as_ptr();
+ ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
+ },
0usize,
concat!("Offset of field: ", stringify!(Bar), "::", stringify!(b))
);
@@ -109,7 +113,11 @@ fn bindgen_test_layout_a() {
concat!("Alignment of ", stringify!(a))
);
assert_eq!(
- unsafe { &(*(::std::ptr::null::<a>())).d as *const _ as usize },
+ unsafe {
+ let uninit = ::std::mem::MaybeUninit::<a>::uninit();
+ let ptr = uninit.as_ptr();
+ ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize
+ },
0usize,
concat!("Offset of field: ", stringify!(a), "::", stringify!(d))
);