1 #![allow(
2     dead_code,
3     non_snake_case,
4     non_camel_case_types,
5     non_upper_case_globals
6 )]
7 
8 #[repr(C)]
9 #[derive(Debug, Copy, Clone)]
10 pub struct foo {
11     pub bar: *const *const *mut *const ::std::os::raw::c_int,
12 }
13 #[test]
bindgen_test_layout_foonull14 fn bindgen_test_layout_foo() {
15     const UNINIT: ::std::mem::MaybeUninit<foo> =
16         ::std::mem::MaybeUninit::uninit();
17     let ptr = UNINIT.as_ptr();
18     assert_eq!(
19         ::std::mem::size_of::<foo>(),
20         8usize,
21         concat!("Size of: ", stringify!(foo))
22     );
23     assert_eq!(
24         ::std::mem::align_of::<foo>(),
25         8usize,
26         concat!("Alignment of ", stringify!(foo))
27     );
28     assert_eq!(
29         unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize },
30         0usize,
31         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
32     );
33 }
34 impl Default for foo {
defaultnull35     fn default() -> Self {
36         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
37         unsafe {
38             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
39             s.assume_init()
40         }
41     }
42 }
43