|
| 1 | +/* automatically generated by rust-bindgen */ |
| 2 | + |
| 3 | + |
| 4 | +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] |
| 5 | + |
| 6 | + |
| 7 | +/// We emit a `[u8; 63usize]` padding field for this struct, which cannot derive |
| 8 | +/// Debug because 63 is over the hard coded limit. (Yes, this struct doesn't end |
| 9 | +/// up with the reight alignment, we're waiting on `#[repr(align="N")]` to land |
| 10 | +/// in rustc). |
| 11 | +#[repr(C)] |
| 12 | +#[derive(Copy)] |
| 13 | +pub struct NoDebug { |
| 14 | + pub c: ::std::os::raw::c_char, |
| 15 | + pub __bindgen_padding_0: [u8; 63usize], |
| 16 | +} |
| 17 | +#[test] |
| 18 | +fn bindgen_test_layout_NoDebug() { |
| 19 | + assert_eq!(::std::mem::size_of::<NoDebug>() , 64usize , concat ! ( |
| 20 | + "Size of: " , stringify ! ( NoDebug ) )); |
| 21 | + assert_eq! (unsafe { |
| 22 | + & ( * ( 0 as * const NoDebug ) ) . c as * const _ as usize } , |
| 23 | + 0usize , concat ! ( |
| 24 | + "Alignment of field: " , stringify ! ( NoDebug ) , "::" , |
| 25 | + stringify ! ( c ) )); |
| 26 | +} |
| 27 | +impl Clone for NoDebug { |
| 28 | + fn clone(&self) -> Self { *self } |
| 29 | +} |
| 30 | +impl Default for NoDebug { |
| 31 | + fn default() -> Self { unsafe { ::std::mem::zeroed() } } |
| 32 | +} |
| 33 | +/// This should derive Debug because the padding size is less than the max derive |
| 34 | +/// Debug impl for arrays. However, we conservatively don't derive Debug because |
| 35 | +/// we determine Debug derive-ability before we compute padding, which happens at |
| 36 | +/// codegen. (Again, we expect to get the alignment wrong for similar reasons.) |
| 37 | +#[repr(C)] |
| 38 | +#[derive(Copy)] |
| 39 | +pub struct ShouldDeriveDebugButDoesNot { |
| 40 | + pub c: [::std::os::raw::c_char; 32usize], |
| 41 | + pub d: ::std::os::raw::c_char, |
| 42 | + pub __bindgen_padding_0: [u8; 31usize], |
| 43 | +} |
| 44 | +#[test] |
| 45 | +fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() { |
| 46 | + assert_eq!(::std::mem::size_of::<ShouldDeriveDebugButDoesNot>() , 64usize |
| 47 | + , concat ! ( |
| 48 | + "Size of: " , stringify ! ( ShouldDeriveDebugButDoesNot ) )); |
| 49 | + assert_eq! (unsafe { |
| 50 | + & ( * ( 0 as * const ShouldDeriveDebugButDoesNot ) ) . c as * |
| 51 | + const _ as usize } , 0usize , concat ! ( |
| 52 | + "Alignment of field: " , stringify ! ( |
| 53 | + ShouldDeriveDebugButDoesNot ) , "::" , stringify ! ( c ) )); |
| 54 | + assert_eq! (unsafe { |
| 55 | + & ( * ( 0 as * const ShouldDeriveDebugButDoesNot ) ) . d as * |
| 56 | + const _ as usize } , 32usize , concat ! ( |
| 57 | + "Alignment of field: " , stringify ! ( |
| 58 | + ShouldDeriveDebugButDoesNot ) , "::" , stringify ! ( d ) )); |
| 59 | +} |
| 60 | +impl Clone for ShouldDeriveDebugButDoesNot { |
| 61 | + fn clone(&self) -> Self { *self } |
| 62 | +} |
| 63 | +impl Default for ShouldDeriveDebugButDoesNot { |
| 64 | + fn default() -> Self { unsafe { ::std::mem::zeroed() } } |
| 65 | +} |
0 commit comments