| #![allow( |
| dead_code, |
| non_snake_case, |
| non_camel_case_types, |
| non_upper_case_globals |
| )] |
| |
| #[repr(C)] |
| #[derive(Debug, Copy, Clone)] |
| pub struct Foo { |
| _unused: [u8; 0], |
| } |
| #[repr(C)] |
| #[derive(Debug, Copy, Clone)] |
| pub struct RefPtr<T> { |
| pub m_inner: *mut T, |
| pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, |
| } |
| impl<T> Default for RefPtr<T> { |
| fn default() -> Self { |
| let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); |
| unsafe { |
| ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); |
| s.assume_init() |
| } |
| } |
| } |
| #[repr(C)] |
| #[derive(Debug, Copy, Clone)] |
| pub struct Bar { |
| pub m_member: RefPtr<Foo>, |
| } |
| #[test] |
| fn bindgen_test_layout_Bar() { |
| assert_eq!( |
| ::std::mem::size_of::<Bar>(), |
| 8usize, |
| concat!("Size of: ", stringify!(Bar)) |
| ); |
| assert_eq!( |
| ::std::mem::align_of::<Bar>(), |
| 8usize, |
| concat!("Alignment of ", stringify!(Bar)) |
| ); |
| assert_eq!( |
| unsafe { |
| &(*(::std::ptr::null::<Bar>())).m_member as *const _ as usize |
| }, |
| 0usize, |
| concat!( |
| "Offset of field: ", |
| stringify!(Bar), |
| "::", |
| stringify!(m_member) |
| ) |
| ); |
| } |
| impl Default for Bar { |
| fn default() -> Self { |
| let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); |
| unsafe { |
| ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); |
| s.assume_init() |
| } |
| } |
| } |
| #[test] |
| fn __bindgen_test_layout_RefPtr_open0_Foo_close0_instantiation() { |
| assert_eq!( |
| ::std::mem::size_of::<RefPtr<Foo>>(), |
| 8usize, |
| concat!("Size of template specialization: ", stringify!(RefPtr<Foo>)) |
| ); |
| assert_eq!( |
| ::std::mem::align_of::<RefPtr<Foo>>(), |
| 8usize, |
| concat!( |
| "Alignment of template specialization: ", |
| stringify!(RefPtr<Foo>) |
| ) |
| ); |
| } |