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 {
2323fn main ( ) {
2424 let result = OpenResult :: Ok ( ( ) ) ;
2525 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- }
3626}
Original file line number Diff line number Diff line change @@ -55,12 +55,23 @@ pub enum E2<X> {
5555 V4 ,
5656}
5757
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 ,
6163 }
64+ }
6265
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 ,
6571 }
6672}
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