@@ -747,27 +747,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
747
747
// Otherwise, we need to find the minimum remaining choice, if
748
748
// any, and take that.
749
749
debug ! ( "choice_regions remaining are {:#?}" , choice_regions) ;
750
- let min = |r1 : ty:: RegionVid , r2 : ty:: RegionVid | -> Option < ty:: RegionVid > {
751
- let r1_outlives_r2 = self . universal_region_relations . outlives ( r1, r2) ;
752
- let r2_outlives_r1 = self . universal_region_relations . outlives ( r2, r1) ;
753
- match ( r1_outlives_r2, r2_outlives_r1) {
754
- ( true , true ) => Some ( r1. min ( r2) ) ,
755
- ( true , false ) => Some ( r2) ,
756
- ( false , true ) => Some ( r1) ,
757
- ( false , false ) => None ,
758
- }
750
+ let Some ( & min_choice) = choice_regions. iter ( ) . find ( |& r1| {
751
+ choice_regions. iter ( ) . all ( |& r2| {
752
+ self . universal_region_relations . outlives ( r2, * r1)
753
+ } )
754
+ } ) else {
755
+ debug ! ( "no choice region outlived by all others" ) ;
756
+ return false ;
759
757
} ;
760
- let mut min_choice = choice_regions[ 0 ] ;
761
- for & other_option in & choice_regions[ 1 ..] {
762
- debug ! ( ?min_choice, ?other_option, ) ;
763
- match min ( min_choice, other_option) {
764
- Some ( m) => min_choice = m,
765
- None => {
766
- debug ! ( ?min_choice, ?other_option, "incomparable; no min choice" , ) ;
767
- return false ;
768
- }
769
- }
770
- }
771
758
772
759
let min_choice_scc = self . constraint_sccs . scc ( min_choice) ;
773
760
debug ! ( ?min_choice, ?min_choice_scc) ;
0 commit comments