Skip to content

Commit 6fe2546

Browse files
committed
test: Add test that common fields macro fails when used with a unit case
It should only work for (possibly empty) struct cases
1 parent c5bd61a commit 6fe2546

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use nested_enum_utils::common_fields;
2+
3+
#[common_fields({ x: u64 })]
4+
enum Enum {
5+
A,
6+
B {},
7+
}
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
error: Expected named variants in enum
2+
--> tests/compile_fail/common_fields_unit.rs:3:1
3+
|
4+
3 | #[common_fields({ x: u64 })]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: this error originates in the attribute macro `common_fields` (in Nightly builds, run with -Z macro-backtrace for more info)

0 commit comments

Comments
 (0)