summaryrefslogtreecommitdiff
path: root/tests/headers/issue-648-derive-debug-with-padding.h
blob: 2ef70e47c8eb72924a29ab8fc0eec9ee763b534e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
/**
 * We emit a `[u8; 63usize]` padding field for this struct, which cannot derive
 * Debug/Hash because 63 is over the hard coded limit. (Yes, this struct doesn't end
 * up with the reight alignment, we're waiting on `#[repr(align="N")]` to land
 * in rustc).
 */
struct NoDebug {
    char c;
    // padding of 63 bytes
} __attribute__((__aligned__(64)));

/**
 * This should derive Debug/Hash/PartialEq because the padding size is less than the max derive
 * Debug/Hash/PartialEq impl for arrays. However, we conservatively don't derive Debug/Hash because
 * we determine Debug derive-ability before we compute padding, which happens at
 * codegen. (Again, we expect to get the alignment wrong for similar reasons.)
 */
struct ShouldDeriveDebugButDoesNot {
    char c[32];
    char d;
    // padding of 31 bytes
} __attribute__((__aligned__(64)));