Skip to content

Commit 2de25e0

Browse files
committed
test compiler error when all variants of enum disabled
1 parent 4a6b90b commit 2de25e0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tests/ui/invalid_pyclass_enum.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,13 @@ enum InvalidOrderedComplexEnum2 {
9393
VariantB { msg: String }
9494
}
9595

96+
#[pyclass(eq)]
97+
#[derive(PartialEq)]
98+
enum AllEnumVariantsDisabled {
99+
#[cfg(any())]
100+
DisabledA,
101+
#[cfg(not(all()))]
102+
DisabledB,
103+
}
104+
96105
fn main() {}

tests/ui/invalid_pyclass_enum.stderr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ error: The `ord` option requires the `eq` option.
6666
83 | #[pyclass(ord)]
6767
| ^^^
6868

69+
error: All variants of enum `AllEnumVariantsDisabled` have been disabled by cfg attributes
70+
--> tests/ui/invalid_pyclass_enum.rs:96:1
71+
|
72+
96 | #[pyclass(eq)]
73+
| ^^^^^^^^^^^^^^
74+
|
75+
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
76+
6977
error[E0369]: binary operation `==` cannot be applied to type `&SimpleEqOptRequiresPartialEq`
7078
--> tests/ui/invalid_pyclass_enum.rs:31:11
7179
|

0 commit comments

Comments
 (0)