1 // Copyright 2019 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #[macro_use]
6 extern crate zerocopy;
7
main()8 fn main() {}
9
10 //
11 // Generic errors
12 //
13
14 #[derive(FromBytes)]
15 #[repr("foo")]
16 enum Generic1 {
17 A,
18 }
19
20 #[derive(FromBytes)]
21 #[repr(foo)]
22 enum Generic2 {
23 A,
24 }
25
26 #[derive(FromBytes)]
27 #[repr(transparent)]
28 enum Generic3 {
29 A,
30 }
31
32 #[derive(FromBytes)]
33 #[repr(u8, u16)]
34 enum Generic4 {
35 A,
36 }
37
38 #[derive(FromBytes)]
39 enum Generic5 {
40 A,
41 }
42
43 //
44 // FromBytes errors
45 //
46
47 #[derive(FromBytes)]
48 #[repr(C)]
49 enum FromBytes1 {
50 A,
51 }
52
53 #[derive(FromBytes)]
54 #[repr(usize)]
55 enum FromBytes2 {
56 A,
57 }
58
59 #[derive(FromBytes)]
60 #[repr(isize)]
61 enum FromBytes3 {
62 A,
63 }
64
65 #[derive(FromBytes)]
66 #[repr(u32)]
67 enum FromBytes4 {
68 A,
69 }
70
71 #[derive(FromBytes)]
72 #[repr(i32)]
73 enum FromBytes5 {
74 A,
75 }
76
77 #[derive(FromBytes)]
78 #[repr(u64)]
79 enum FromBytes6 {
80 A,
81 }
82
83 #[derive(FromBytes)]
84 #[repr(i64)]
85 enum FromBytes7 {
86 A,
87 }
88
89 //
90 // Unaligned errors
91 //
92
93 #[derive(Unaligned)]
94 #[repr(C)]
95 enum Unaligned1 {
96 A,
97 }
98
99 #[derive(Unaligned)]
100 #[repr(u16)]
101 enum Unaligned2 {
102 A,
103 }
104
105 #[derive(Unaligned)]
106 #[repr(i16)]
107 enum Unaligned3 {
108 A,
109 }
110
111 #[derive(Unaligned)]
112 #[repr(u32)]
113 enum Unaligned4 {
114 A,
115 }
116
117 #[derive(Unaligned)]
118 #[repr(i32)]
119 enum Unaligned5 {
120 A,
121 }
122
123 #[derive(Unaligned)]
124 #[repr(u64)]
125 enum Unaligned6 {
126 A,
127 }
128
129 #[derive(Unaligned)]
130 #[repr(i64)]
131 enum Unaligned7 {
132 A,
133 }
134
135 #[derive(Unaligned)]
136 #[repr(usize)]
137 enum Unaligned8 {
138 A,
139 }
140
141 #[derive(Unaligned)]
142 #[repr(isize)]
143 enum Unaligned9 {
144 A,
145 }
146
147 #[derive(Unaligned)]
148 #[repr(u8, align(2))]
149 enum Unaligned10 {
150 A,
151 }
152
153 #[derive(Unaligned)]
154 #[repr(i8, align(2))]
155 enum Unaligned11 {
156 A,
157 }
158
159 #[derive(Unaligned)]
160 #[repr(align(1), align(2))]
161 enum Unaligned12 {
162 A,
163 }
164
165 #[derive(Unaligned)]
166 #[repr(align(2), align(4))]
167 enum Unaligned13 {
168 A,
169 }
170