• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(
2     dead_code,
3     non_snake_case,
4     non_camel_case_types,
5     non_upper_case_globals
6 )]
7 
8 pub type RefPtr<T> = T;
9 
10 #[repr(C)]
11 #[derive(Debug, Default, Copy, Clone)]
12 pub struct A {
13     pub _address: u8,
14 }
15 pub type A_a = b;
16 #[test]
bindgen_test_layout_A()17 fn bindgen_test_layout_A() {
18     assert_eq!(
19         ::std::mem::size_of::<A>(),
20         1usize,
21         concat!("Size of: ", stringify!(A))
22     );
23     assert_eq!(
24         ::std::mem::align_of::<A>(),
25         1usize,
26         concat!("Alignment of ", stringify!(A))
27     );
28 }
29 #[repr(C)]
30 pub struct e<c> {
31     pub d: RefPtr<c>,
32     pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<c>>,
33 }
34 impl<c> Default for e<c> {
default() -> Self35     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 #[repr(C)]
44 #[derive(Debug, Default, Copy, Clone)]
45 pub struct f {
46     pub _address: u8,
47 }
48 #[repr(C)]
49 pub struct g {
50     pub h: f,
51 }
52 #[test]
bindgen_test_layout_g()53 fn bindgen_test_layout_g() {
54     const UNINIT: ::std::mem::MaybeUninit<g> =
55         ::std::mem::MaybeUninit::uninit();
56     let ptr = UNINIT.as_ptr();
57     assert_eq!(
58         ::std::mem::size_of::<g>(),
59         1usize,
60         concat!("Size of: ", stringify!(g))
61     );
62     assert_eq!(
63         ::std::mem::align_of::<g>(),
64         1usize,
65         concat!("Alignment of ", stringify!(g))
66     );
67     assert_eq!(
68         unsafe { ::std::ptr::addr_of!((*ptr).h) as usize - ptr as usize },
69         0usize,
70         concat!("Offset of field: ", stringify!(g), "::", stringify!(h))
71     );
72 }
73 impl Default for g {
default() -> Self74     fn default() -> Self {
75         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
76         unsafe {
77             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
78             s.assume_init()
79         }
80     }
81 }
82 #[repr(C)]
83 pub struct b {
84     pub _base: g,
85 }
86 #[test]
bindgen_test_layout_b()87 fn bindgen_test_layout_b() {
88     assert_eq!(
89         ::std::mem::size_of::<b>(),
90         1usize,
91         concat!("Size of: ", stringify!(b))
92     );
93     assert_eq!(
94         ::std::mem::align_of::<b>(),
95         1usize,
96         concat!("Alignment of ", stringify!(b))
97     );
98 }
99 impl Default for b {
default() -> Self100     fn default() -> Self {
101         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
102         unsafe {
103             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
104             s.assume_init()
105         }
106     }
107 }
108 extern "C" {
109     #[link_name = "\u{1}_Z25Servo_Element_GetSnapshotv"]
Servo_Element_GetSnapshot() -> A110     pub fn Servo_Element_GetSnapshot() -> A;
111 }
112 #[test]
__bindgen_test_layout_f_open0_e_open1_int_close1_close0_instantiation()113 fn __bindgen_test_layout_f_open0_e_open1_int_close1_close0_instantiation() {
114     assert_eq!(
115         ::std::mem::size_of::<f>(),
116         1usize,
117         concat!("Size of template specialization: ", stringify!(f))
118     );
119     assert_eq!(
120         ::std::mem::align_of::<f>(),
121         1usize,
122         concat!("Alignment of template specialization: ", stringify!(f))
123     );
124 }
125