summaryrefslogtreecommitdiffstats
path: root/tests/rust/layout_aligned_opaque.rs
blob: c4991248aa7fa86034d4a855146ee4abc4b07864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#[repr(packed, C)]
pub struct PackedStruct {
    pub arg1: usize,
    pub arg2: *mut u8,
}

#[repr(packed, C)]
pub union PackedUnion {
    pub variant1: usize,
    pub variant2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(1), C)]
pub union OpaqueAlign1Union {
    pub variant1: usize,
    pub variant2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(4), C)]
pub union OpaqueAlign4Union {
    pub variant1: usize,
    pub variant2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(16), C)]
pub union OpaqueAlign16Union {
    pub variant1: usize,
    pub variant2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(1), C)]
pub struct OpaqueAlign1Struct {
    pub arg1: usize,
    pub arg2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(2), C)]
pub struct OpaqueAlign2Struct {
    pub arg1: usize,
    pub arg2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(4), C)]
pub struct OpaqueAlign4Struct {
    pub arg1: usize,
    pub arg2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(8), C)]
pub struct OpaqueAlign8Struct {
    pub arg1: usize,
    pub arg2: *mut u8,
}

// Opaque because aligned_n is not defined.
#[repr(align(32), C)]
pub struct OpaqueAlign32Struct {
    pub arg1: usize,
    pub arg2: *mut u8,
}