File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,21 @@ const TEST_A: Discriminant<Test> = discriminant(&Test::A(5));
15
15
const TEST_A_OTHER : Discriminant < Test > = discriminant ( & Test :: A ( 17 ) ) ;
16
16
const TEST_B : Discriminant < Test > = discriminant ( & Test :: B ) ;
17
17
18
+ enum Void { }
19
+
20
+ enum SingleVariant {
21
+ V ,
22
+ Never ( Void ) ,
23
+ }
24
+
25
+ const TEST_V : Discriminant < SingleVariant > = discriminant ( & SingleVariant :: V ) ;
26
+
18
27
fn main ( ) {
19
28
assert_eq ! ( TEST_A , TEST_A_OTHER ) ;
20
29
assert_eq ! ( TEST_A , discriminant( identity( & Test :: A ( 17 ) ) ) ) ;
21
30
assert_eq ! ( TEST_B , discriminant( identity( & Test :: B ) ) ) ;
22
31
assert_ne ! ( TEST_A , TEST_B ) ;
23
32
assert_ne ! ( TEST_B , discriminant( identity( & Test :: C { a: 42 , b: 7 } ) ) ) ;
33
+
34
+ assert_eq ! ( TEST_V , discriminant( identity( & SingleVariant :: V ) ) ) ;
24
35
}
You can’t perform that action at this time.
0 commit comments