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