forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepr_combination.rs
79 lines (67 loc) · 1.8 KB
/
repr_combination.rs
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
68
69
70
71
72
73
74
75
76
77
78
79
#![no_std]
// Combinations of `#[repr(..)]` attributes.
// Rustdoc JSON emits normalized output, regardless of the original source.
//@ is "$.index[?(@.name=='ReprCI8')].attrs" '["#[repr(C, i8)]"]'
#[repr(C, i8)]
pub enum ReprCI8 {
First,
}
//@ is "$.index[?(@.name=='SeparateReprCI16')].attrs" '["#[repr(C, i16)]"]'
#[repr(C)]
#[repr(i16)]
pub enum SeparateReprCI16 {
First,
}
//@ is "$.index[?(@.name=='ReversedReprCUsize')].attrs" '["#[repr(C, usize)]"]'
#[repr(usize, C)]
pub enum ReversedReprCUsize {
First,
}
//@ is "$.index[?(@.name=='ReprCPacked')].attrs" '["#[repr(C, packed(1))]"]'
#[repr(C, packed)]
pub struct ReprCPacked {
a: i8,
b: i64,
}
//@ is "$.index[?(@.name=='SeparateReprCPacked')].attrs" '["#[repr(C, packed(2))]"]'
#[repr(C)]
#[repr(packed(2))]
pub struct SeparateReprCPacked {
a: i8,
b: i64,
}
//@ is "$.index[?(@.name=='ReversedReprCPacked')].attrs" '["#[repr(C, packed(2))]"]'
#[repr(packed(2), C)]
pub struct ReversedReprCPacked {
a: i8,
b: i64,
}
//@ is "$.index[?(@.name=='ReprCAlign')].attrs" '["#[repr(C, align(16))]"]'
#[repr(C, align(16))]
pub struct ReprCAlign {
a: i8,
b: i64,
}
//@ is "$.index[?(@.name=='SeparateReprCAlign')].attrs" '["#[repr(C, align(2))]"]'
#[repr(C)]
#[repr(align(2))]
pub struct SeparateReprCAlign {
a: i8,
b: i64,
}
//@ is "$.index[?(@.name=='ReversedReprCAlign')].attrs" '["#[repr(C, align(2))]"]'
#[repr(align(2), C)]
pub struct ReversedReprCAlign {
a: i8,
b: i64,
}
//@ is "$.index[?(@.name=='AlignedExplicitRepr')].attrs" '["#[repr(C, align(16), isize)]"]'
#[repr(C, align(16), isize)]
pub enum AlignedExplicitRepr {
First,
}
//@ is "$.index[?(@.name=='ReorderedAlignedExplicitRepr')].attrs" '["#[repr(C, align(16), isize)]"]'
#[repr(isize, C, align(16))]
pub enum ReorderedAlignedExplicitRepr {
First,
}