Skip to content

Commit a693e45

Browse files
committed
tests: check that enums cannot derive Zeroable
Signed-off-by: Benno Lossin <lossin@kernel.org>
1 parent 871cf88 commit a693e45

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
extern crate pin_init;
2+
use pin_init::*;
3+
4+
#[derive(Zeroable)]
5+
enum Num {
6+
A(u32),
7+
B(i32),
8+
}
9+
10+
#[derive(MaybeZeroable)]
11+
enum Num2 {
12+
A(u32),
13+
B(i32),
14+
}
15+
16+
fn main() {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error: no rules expected keyword `enum`
2+
--> tests/ui/compile-fail/zeroable/enum.rs:5:1
3+
|
4+
5 | enum Num {
5+
| ^^^^ no rules expected this token in macro call
6+
|
7+
note: while trying to match keyword `struct`
8+
--> src/macros.rs
9+
|
10+
| $vis:vis struct $name:ident
11+
| ^^^^^^
12+
13+
error: no rules expected keyword `enum`
14+
--> tests/ui/compile-fail/zeroable/enum.rs:11:1
15+
|
16+
11 | enum Num2 {
17+
| ^^^^ no rules expected this token in macro call
18+
|
19+
note: while trying to match keyword `struct`
20+
--> src/macros.rs
21+
|
22+
| $vis:vis struct $name:ident
23+
| ^^^^^^

0 commit comments

Comments
 (0)