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)]
10 pub struct extern_type;
11
12 #[repr(C)]
13 #[derive(Debug)]
14 pub struct local_type {
15 pub inner: extern_type,
16 }
17 #[test]
bindgen_test_layout_local_type()18 fn bindgen_test_layout_local_type() {
19 const UNINIT: ::std::mem::MaybeUninit<local_type> =
20 ::std::mem::MaybeUninit::uninit();
21 let ptr = UNINIT.as_ptr();
22 assert_eq!(
23 ::std::mem::size_of::<local_type>(),
24 0usize,
25 concat!("Size of: ", stringify!(local_type))
26 );
27 assert_eq!(
28 ::std::mem::align_of::<local_type>(),
29 1usize,
30 concat!("Alignment of ", stringify!(local_type))
31 );
32 assert_eq!(
33 unsafe { ::std::ptr::addr_of!((*ptr).inner) as usize - ptr as usize },
34 0usize,
35 concat!(
36 "Offset of field: ",
37 stringify!(local_type),
38 "::",
39 stringify!(inner)
40 )
41 );
42 }
43