@@ -15,11 +15,43 @@ pub struct Foo<T> {
15
15
impl < T > Default for Foo < T > {
16
16
fn default ( ) -> Self { unsafe { :: std:: mem:: zeroed ( ) } }
17
17
}
18
+ #[ repr( C ) ]
19
+ #[ derive( Debug , Copy , Clone ) ]
20
+ pub struct B < T > {
21
+ pub m_member : T ,
22
+ pub _phantom_0 : :: std:: marker:: PhantomData < :: std:: cell:: UnsafeCell < T > > ,
23
+ }
24
+ impl < T > Default for B < T > {
25
+ fn default ( ) -> Self { unsafe { :: std:: mem:: zeroed ( ) } }
26
+ }
18
27
extern "C" {
19
28
#[ link_name = "_Z3bar3FooIiiE" ]
20
29
pub fn bar ( foo : Foo < :: std:: os:: raw:: c_int > ) ;
21
30
}
22
31
#[ repr( C ) ]
32
+ #[ derive( Debug , Copy ) ]
33
+ pub struct C {
34
+ pub mBBB : B < :: std:: os:: raw:: c_uint > ,
35
+ }
36
+ #[ test]
37
+ fn bindgen_test_layout_C ( ) {
38
+ assert_eq ! ( :: std:: mem:: size_of:: <C >( ) , 4usize , concat ! (
39
+ "Size of: " , stringify ! ( C ) ) ) ;
40
+ assert_eq ! ( :: std:: mem:: align_of:: <C >( ) , 4usize , concat ! (
41
+ "Alignment of " , stringify ! ( C ) ) ) ;
42
+ assert_eq ! ( unsafe {
43
+ & ( * ( 0 as * const C ) ) . mBBB as * const _ as usize } ,
44
+ 0usize , concat ! (
45
+ "Alignment of field: " , stringify ! ( C ) , "::" , stringify
46
+ ! ( mBBB ) ) ) ;
47
+ }
48
+ impl Clone for C {
49
+ fn clone ( & self ) -> Self { * self }
50
+ }
51
+ impl Default for C {
52
+ fn default ( ) -> Self { unsafe { :: std:: mem:: zeroed ( ) } }
53
+ }
54
+ #[ repr( C ) ]
23
55
#[ derive( Debug ) ]
24
56
pub struct D {
25
57
pub m_foo : D_MyFoo ,
@@ -234,7 +266,7 @@ impl <T> Default for ReplacedWithoutDestructorFwd<T> {
234
266
fn default ( ) -> Self { unsafe { :: std:: mem:: zeroed ( ) } }
235
267
}
236
268
#[ test]
237
- fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation ( ) {
269
+ fn __bindgen_test_layout_Foo_open0_c_int_c_int_close0_instantiation ( ) {
238
270
assert_eq ! ( :: std:: mem:: size_of:: <Foo <:: std:: os:: raw:: c_int>>( ) , 24usize ,
239
271
concat ! (
240
272
"Size of template specialization: " , stringify ! (
@@ -245,7 +277,18 @@ fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation() {
245
277
Foo <:: std:: os:: raw:: c_int> ) ) ) ;
246
278
}
247
279
#[ test]
248
- fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation_1 ( ) {
280
+ fn __bindgen_test_layout_B_open0_c_uint_close0_instantiation ( ) {
281
+ assert_eq ! ( :: std:: mem:: size_of:: <B <:: std:: os:: raw:: c_uint>>( ) , 4usize ,
282
+ concat ! (
283
+ "Size of template specialization: " , stringify ! (
284
+ B <:: std:: os:: raw:: c_uint> ) ) ) ;
285
+ assert_eq ! ( :: std:: mem:: align_of:: <B <:: std:: os:: raw:: c_uint>>( ) , 4usize ,
286
+ concat ! (
287
+ "Alignment of template specialization: " , stringify ! (
288
+ B <:: std:: os:: raw:: c_uint> ) ) ) ;
289
+ }
290
+ #[ test]
291
+ fn __bindgen_test_layout_Foo_open0_c_int_c_int_close0_instantiation_1 ( ) {
249
292
assert_eq ! ( :: std:: mem:: size_of:: <Foo <:: std:: os:: raw:: c_int>>( ) , 24usize ,
250
293
concat ! (
251
294
"Size of template specialization: " , stringify ! (
@@ -256,7 +299,7 @@ fn __bindgen_test_layout_Foo_open0_int_int_close0_instantiation_1() {
256
299
Foo <:: std:: os:: raw:: c_int> ) ) ) ;
257
300
}
258
301
#[ test]
259
- fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_108_close0_instantiation ( ) {
302
+ fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_118_close0_instantiation ( ) {
260
303
assert_eq ! ( :: std:: mem:: size_of:: <Rooted <* mut :: std:: os:: raw:: c_void>>( ) ,
261
304
24usize , concat ! (
262
305
"Size of template specialization: " , stringify ! (
@@ -267,7 +310,7 @@ fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_108_close0_instantiation()
267
310
Rooted <* mut :: std:: os:: raw:: c_void> ) ) ) ;
268
311
}
269
312
#[ test]
270
- fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_114_close0_instantiation ( ) {
313
+ fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_124_close0_instantiation ( ) {
271
314
assert_eq ! ( :: std:: mem:: size_of:: <Rooted <* mut :: std:: os:: raw:: c_void>>( ) ,
272
315
24usize , concat ! (
273
316
"Size of template specialization: " , stringify ! (
@@ -278,7 +321,7 @@ fn __bindgen_test_layout_Rooted_open0__bindgen_ty_id_114_close0_instantiation()
278
321
Rooted <* mut :: std:: os:: raw:: c_void> ) ) ) ;
279
322
}
280
323
#[ test]
281
- fn __bindgen_test_layout_WithDtor_open0_int_close0_instantiation ( ) {
324
+ fn __bindgen_test_layout_WithDtor_open0_c_int_close0_instantiation ( ) {
282
325
assert_eq ! ( :: std:: mem:: size_of:: <WithDtor <:: std:: os:: raw:: c_int>>( ) ,
283
326
4usize , concat ! (
284
327
"Size of template specialization: " , stringify ! (
@@ -289,7 +332,7 @@ fn __bindgen_test_layout_WithDtor_open0_int_close0_instantiation() {
289
332
WithDtor <:: std:: os:: raw:: c_int> ) ) ) ;
290
333
}
291
334
#[ test]
292
- fn __bindgen_test_layout_Opaque_open0_int_close0_instantiation ( ) {
335
+ fn __bindgen_test_layout_Opaque_open0_c_int_close0_instantiation ( ) {
293
336
assert_eq ! ( :: std:: mem:: size_of:: <u32 >( ) , 4usize , concat ! (
294
337
"Size of template specialization: " , stringify ! ( u32 ) ) ) ;
295
338
assert_eq ! ( :: std:: mem:: align_of:: <u32 >( ) , 4usize , concat ! (
0 commit comments