@@ -673,6 +673,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
673
673
}
674
674
}
675
675
}
676
+ ( TestKind :: Len { .. } , _) => {
677
+ fully_matched = false ;
678
+ None
679
+ }
676
680
677
681
( TestKind :: Range ( test) , & TestCase :: Range ( pat) ) => {
678
682
if test. as_ref ( ) == pat {
@@ -700,29 +704,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
700
704
None
701
705
}
702
706
703
- ( & TestKind :: Eq { .. } | & TestKind :: Len { .. } , _) => {
704
- // The call to `self.test(&match_pair)` below is not actually used to generate any
705
- // MIR. Instead, we just want to compare with `test` (the parameter of the method)
706
- // to see if it is the same.
707
- //
708
- // However, at this point we can still encounter or-patterns that were extracted
709
- // from previous calls to `sort_candidate`, so we need to manually address that
710
- // case to avoid panicking in `self.test()`.
711
- if let TestCase :: Or { .. } = & match_pair. test_case {
712
- return None ;
713
- }
714
-
715
- // These are all binary tests.
716
- //
717
- // FIXME(#29623) we can be more clever here
718
- let pattern_test = self . test ( match_pair) ;
719
- if pattern_test. kind == test. kind {
720
- fully_matched = true ;
721
- Some ( 0 )
722
- } else {
723
- fully_matched = false ;
724
- None
725
- }
707
+ // FIXME(#29623): return `Some(1)` when the values are different.
708
+ ( TestKind :: Eq { value : test_val, .. } , TestCase :: Constant { value : case_val } )
709
+ if test_val == case_val =>
710
+ {
711
+ fully_matched = true ;
712
+ Some ( 0 )
713
+ }
714
+ ( TestKind :: Eq { .. } , _) => {
715
+ fully_matched = false ;
716
+ None
726
717
}
727
718
} ;
728
719
0 commit comments