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));
1515const TEST_A_OTHER : Discriminant < Test > = discriminant ( & Test :: A ( 17 ) ) ;
1616const TEST_B : Discriminant < Test > = discriminant ( & Test :: B ) ;
1717
18+ enum Void { }
19+
20+ enum SingleVariant {
21+ V ,
22+ Never ( Void ) ,
23+ }
24+
25+ const TEST_V : Discriminant < SingleVariant > = discriminant ( & SingleVariant :: V ) ;
26+
1827fn main ( ) {
1928 assert_eq ! ( TEST_A , TEST_A_OTHER ) ;
2029 assert_eq ! ( TEST_A , discriminant( identity( & Test :: A ( 17 ) ) ) ) ;
2130 assert_eq ! ( TEST_B , discriminant( identity( & Test :: B ) ) ) ;
2231 assert_ne ! ( TEST_A , TEST_B ) ;
2332 assert_ne ! ( TEST_B , discriminant( identity( & Test :: C { a: 42 , b: 7 } ) ) ) ;
33+
34+ assert_eq ! ( TEST_V , discriminant( identity( & SingleVariant :: V ) ) ) ;
2435}
You can’t perform that action at this time.
0 commit comments