@@ -5,6 +5,7 @@ fn with_anon_struct() {
5
5
assert_bind_eq ( "headers/struct_with_anon_struct.h" , "
6
6
#[repr(C)]
7
7
#[derive(Copy)]
8
+ #[derive(Debug)]
8
9
pub struct Struct_foo {
9
10
pub bar: Struct_Unnamed1,
10
11
}
@@ -16,6 +17,7 @@ fn with_anon_struct() {
16
17
}
17
18
#[repr(C)]
18
19
#[derive(Copy)]
20
+ #[derive(Debug)]
19
21
pub struct Struct_Unnamed1 {
20
22
pub a: ::std::os::raw::c_int,
21
23
pub b: ::std::os::raw::c_int,
@@ -34,6 +36,7 @@ fn with_anon_struct_array() {
34
36
assert_bind_eq ( "headers/struct_with_anon_struct_array.h" , "
35
37
#[repr(C)]
36
38
#[derive(Copy)]
39
+ #[derive(Debug)]
37
40
pub struct Struct_foo {
38
41
pub bar: [Struct_Unnamed1; 2usize],
39
42
pub baz: [[[Struct_Unnamed2; 4usize]; 3usize]; 2usize],
@@ -49,6 +52,7 @@ fn with_anon_struct_array() {
49
52
50
53
#[repr(C)]
51
54
#[derive(Copy)]
55
+ #[derive(Debug)]
52
56
pub struct Struct_Unnamed1 {
53
57
pub a: ::std::os::raw::c_int,
54
58
pub b: ::std::os::raw::c_int,
@@ -64,6 +68,7 @@ fn with_anon_struct_array() {
64
68
65
69
#[repr(C)]
66
70
#[derive(Copy)]
71
+ #[derive(Debug)]
67
72
pub struct Struct_Unnamed2 {
68
73
pub a: ::std::os::raw::c_int,
69
74
pub b: ::std::os::raw::c_int,
@@ -84,6 +89,7 @@ fn with_anon_struct_pointer() {
84
89
assert_bind_eq ( "headers/struct_with_anon_struct_pointer.h" , "
85
90
#[repr(C)]
86
91
#[derive(Copy)]
92
+ #[derive(Debug)]
87
93
pub struct Struct_foo {
88
94
pub bar: *mut Struct_Unnamed1,
89
95
}
@@ -95,6 +101,7 @@ fn with_anon_struct_pointer() {
95
101
}
96
102
#[repr(C)]
97
103
#[derive(Copy)]
104
+ #[derive(Debug)]
98
105
pub struct Struct_Unnamed1 {
99
106
pub a: ::std::os::raw::c_int,
100
107
pub b: ::std::os::raw::c_int,
@@ -113,6 +120,7 @@ fn with_anon_union() {
113
120
assert_bind_eq ( "headers/struct_with_anon_union.h" , "
114
121
#[repr(C)]
115
122
#[derive(Copy)]
123
+ #[derive(Debug)]
116
124
pub struct Struct_foo {
117
125
pub bar: Union_Unnamed1,
118
126
}
@@ -151,6 +159,7 @@ fn with_anon_unnamed_struct() {
151
159
assert_bind_eq ( "headers/struct_with_anon_unnamed_struct.h" , "
152
160
#[repr(C)]
153
161
#[derive(Copy)]
162
+ #[derive(Debug)]
154
163
pub struct Struct_foo {
155
164
pub _bindgen_data_1_: [u32; 2usize],
156
165
}
@@ -178,6 +187,7 @@ fn with_anon_unnamed_union() {
178
187
assert_bind_eq ( "headers/struct_with_anon_unnamed_union.h" , "
179
188
#[repr(C)]
180
189
#[derive(Copy)]
190
+ #[derive(Debug)]
181
191
pub struct Struct_foo {
182
192
pub _bindgen_data_1_: [u32; 1usize],
183
193
}
@@ -205,6 +215,7 @@ fn with_nesting() {
205
215
assert_bind_eq ( "headers/struct_with_nesting.h" , "
206
216
#[repr(C)]
207
217
#[derive(Copy)]
218
+ #[derive(Debug)]
208
219
pub struct Struct_foo {
209
220
pub a: ::std::os::raw::c_uint,
210
221
pub _bindgen_data_1_: [u32; 1usize],
@@ -253,6 +264,7 @@ fn containing_fwd_decl_struct() {
253
264
assert_bind_eq ( "headers/struct_containing_forward_declared_struct.h" , "
254
265
#[repr(C)]
255
266
#[derive(Copy)]
267
+ #[derive(Debug)]
256
268
pub struct Struct_a {
257
269
pub val_a: *mut Struct_b,
258
270
}
@@ -267,6 +279,7 @@ fn containing_fwd_decl_struct() {
267
279
268
280
#[repr(C)]
269
281
#[derive(Copy)]
282
+ #[derive(Debug)]
270
283
pub struct Struct_b {
271
284
pub val_b: ::std::os::raw::c_int,
272
285
}
@@ -286,6 +299,7 @@ fn with_bitfields() {
286
299
assert_bind_eq ( "headers/struct_with_bitfields.h" , "
287
300
#[repr(C)]
288
301
#[derive(Copy)]
302
+ #[derive(Debug)]
289
303
pub struct Struct_bitfield {
290
304
pub _bindgen_bitfield_1_: ::std::os::raw::c_ushort,
291
305
pub e: ::std::os::raw::c_int,
@@ -308,6 +322,7 @@ fn with_fwd_decl_struct() {
308
322
assert_bind_eq ( "headers/forward_declared_struct.h" , "
309
323
#[repr(C)]
310
324
#[derive(Copy)]
325
+ #[derive(Debug)]
311
326
pub struct Struct_a {
312
327
pub b: ::std::os::raw::c_int,
313
328
}
@@ -319,6 +334,7 @@ fn with_fwd_decl_struct() {
319
334
}
320
335
#[repr(C)]
321
336
#[derive(Copy)]
337
+ #[derive(Debug)]
322
338
pub struct Struct_c {
323
339
pub d: ::std::os::raw::c_int,
324
340
}
@@ -337,6 +353,7 @@ fn packed_struct() {
337
353
assert_bind_eq ( "headers/struct_with_packing.h" , "
338
354
#[repr(C, packed)]
339
355
#[derive(Copy)]
356
+ #[derive(Debug)]
340
357
pub struct Struct_a {
341
358
pub b: ::std::os::raw::c_char,
342
359
pub c: ::std::os::raw::c_short,
@@ -350,3 +367,54 @@ fn packed_struct() {
350
367
" ) ;
351
368
}
352
369
370
+ #[ test]
371
+ fn derive_debug_big_array ( ) {
372
+ assert_bind_eq ( "headers/struct_with_derive_debug.h" , "
373
+ #[repr(C)]
374
+ #[derive(Copy)]
375
+ #[derive(Debug)]
376
+ pub struct Struct_LittleArray {
377
+ pub a: [::std::os::raw::c_int; 32usize],
378
+ }
379
+ impl ::std::clone::Clone for Struct_LittleArray {
380
+ fn clone(&self) -> Self { *self }
381
+ }
382
+ impl ::std::default::Default for Struct_LittleArray {
383
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
384
+ }
385
+ #[repr(C)]
386
+ #[derive(Copy)]
387
+ pub struct Struct_BigArray {
388
+ pub a: [::std::os::raw::c_int; 33usize],
389
+ }
390
+ impl ::std::clone::Clone for Struct_BigArray {
391
+ fn clone(&self) -> Self { *self }
392
+ }
393
+ impl ::std::default::Default for Struct_BigArray {
394
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
395
+ }
396
+ #[repr(C)]
397
+ #[derive(Copy)]
398
+ #[derive(Debug)]
399
+ pub struct Struct_WithLittleArray {
400
+ pub a: Struct_LittleArray,
401
+ }
402
+ impl ::std::clone::Clone for Struct_WithLittleArray {
403
+ fn clone(&self) -> Self { *self }
404
+ }
405
+ impl ::std::default::Default for Struct_WithLittleArray {
406
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
407
+ }
408
+ #[repr(C)]
409
+ #[derive(Copy)]
410
+ pub struct Struct_WithBigArray {
411
+ pub a: Struct_BigArray,
412
+ }
413
+ impl ::std::clone::Clone for Struct_WithBigArray {
414
+ fn clone(&self) -> Self { *self }
415
+ }
416
+ impl ::std::default::Default for Struct_WithBigArray {
417
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
418
+ }
419
+ " ) ;
420
+ }
0 commit comments