File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed
tests/ui/enum-discriminant Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,4 @@ fn some_match(result: OpenResult) -> u8 {
23
23
fn main ( ) {
24
24
let result = OpenResult :: Ok ( ( ) ) ;
25
25
assert_eq ! ( some_match( result) , 0 ) ;
26
-
27
- let result = OpenResult :: Ok ( ( ) ) ;
28
- match result {
29
- OpenResult :: Ok ( ( ) ) => ( ) ,
30
- _ => unreachable ! ( "message a" ) ,
31
- }
32
- match result {
33
- OpenResult :: Ok ( ( ) ) => ( ) ,
34
- _ => unreachable ! ( "message b" ) ,
35
- }
36
26
}
Original file line number Diff line number Diff line change @@ -55,12 +55,23 @@ pub enum E2<X> {
55
55
V4 ,
56
56
}
57
57
58
- fn main ( ) {
59
- if let E1 :: V2 { .. } = ( E1 :: V1 { f : true } ) {
60
- unreachable ! ( )
58
+ #[ inline( never) ]
59
+ fn match_e1 ( y : E1 ) -> u8 {
60
+ match y {
61
+ E1 :: V2 { .. } => 1 ,
62
+ _ => 0 ,
61
63
}
64
+ }
62
65
63
- if let E2 :: V1 { .. } = E2 :: V3 :: < Infallible > {
64
- unreachable ! ( )
66
+ #[ inline( never) ]
67
+ fn match_e2 ( y : E2 < Infallible > ) -> u8 {
68
+ match y {
69
+ E2 :: V1 { .. } => 1 ,
70
+ _ => 0 ,
65
71
}
66
72
}
73
+
74
+ fn main ( ) {
75
+ assert_eq ! ( match_e1( E1 :: V1 { f: true } ) , 0 ) ;
76
+ assert_eq ! ( match_e2( E2 :: V3 ) , 0 ) ;
77
+ }
You can’t perform that action at this time.
0 commit comments