@@ -682,7 +682,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
682
682
// for all UB.
683
683
if choice_regions. len ( ) > 1 {
684
684
let universal_region_relations = self . universal_region_relations . clone ( ) ;
685
- for ub in self . upper_bounds ( scc) {
685
+ let rev_constraint_graph = self . rev_constraint_graph ( ) ;
686
+ for ub in self . upper_bounds ( scc, & rev_constraint_graph) {
686
687
debug ! ( "apply_member_constraint: ub={:?}" , ub) ;
687
688
choice_regions. retain ( |& o_r| universal_region_relations. outlives ( ub, o_r) ) ;
688
689
}
@@ -749,22 +750,17 @@ impl<'tcx> RegionInferenceContext<'tcx> {
749
750
750
751
/// Compute and return the reverse SCC-based constraint graph (lazilly).
751
752
fn upper_bounds (
752
- & mut self ,
753
+ & ' a mut self ,
753
754
scc0 : ConstraintSccIndex ,
754
- ) -> Vec < RegionVid > {
755
- // I wanted to return an `impl Iterator` here, but it's
756
- // annoying because the `rev_constraint_graph` is in a local
757
- // variable. We'd need a "once-cell" or some such thing to let
758
- // us borrow it for the right amount of time. -- nikomatsakis
759
- let rev_constraint_graph = self . rev_constraint_graph ( ) ;
755
+ rev_constraint_graph : & ' a VecGraph < ConstraintSccIndex > ,
756
+ ) -> impl Iterator < Item = RegionVid > + ' a {
760
757
let scc_values = & self . scc_values ;
761
758
let mut duplicates = FxHashSet :: default ( ) ;
762
759
rev_constraint_graph
763
760
. depth_first_search ( scc0)
764
761
. skip ( 1 )
765
- . flat_map ( |scc1| scc_values. universal_regions_outlived_by ( scc1) )
766
- . filter ( |& r| duplicates. insert ( r) )
767
- . collect ( )
762
+ . flat_map ( move |scc1| scc_values. universal_regions_outlived_by ( scc1) )
763
+ . filter ( move |& r| duplicates. insert ( r) )
768
764
}
769
765
770
766
/// Compute and return the reverse SCC-based constraint graph (lazilly).
0 commit comments