fn apply_member_constraint(
        &mut self,
        scc: ConstraintSccIndex,
        member_constraint_index: NllMemberConstraintIndex,
        choice_regions: &[ty::RegionVid],
    ) -> bool {
        debug!("apply_member_constraint(scc={:?}, choice_regions={:#?})", scc, choice_regions,);

        if let Some(uh_oh) =
            choice_regions.iter().find(|&&r| !self.universal_regions.is_universal_region(r))
        {
            // FIXME(#61773): This case can only occur with
            // `impl_trait_in_bindings`, I believe, and we are just
            // opting not to handle it for now. See #61773 for
            // details.
            bug!(
                "member constraint for `{:?}` has an option region `{:?}` \
                 that is not a universal region",
                self.member_constraints[member_constraint_index].opaque_type_def_id,
                uh_oh,
            );
        }

        // Create a mutable vector of the options. We'll try to winnow
        // them down.
        let mut choice_regions: Vec<ty::RegionVid> = choice_regions.to_vec();

        // The 'member region' in a member constraint is part of the
        // hidden type, which must be in the root universe. Therefore,
        // it cannot have any placeholders in its value.
        assert!(self.scc_universes[scc] == ty::UniverseIndex::ROOT);
        debug_assert!(
            self.scc_values.placeholders_contained_in(scc).next().is_none(),
            "scc {:?} in a member constraint has placeholder value: {:?}",
            scc,
            self.scc_values.region_value_str(scc),
        );

        // The existing value for `scc` is a lower-bound. This will
        // consist of some set `{P} + {LB}` of points `{P}` and
        // lower-bound free regions `{LB}`. As each choice region `O`
        // is a free region, it will outlive the points. But we can
        // only consider the option `O` if `O: LB`.
        choice_regions.retain(|&o_r| {
            self.scc_values
                .universal_regions_outlived_by(scc)
                .all(|lb| self.universal_region_relations.outlives(o_r, lb))
        });
        debug!("apply_member_constraint: after lb, choice_regions={:?}", choice_regions);

        // Now find all the *upper bounds* -- that is, each UB is a
        // free region that must outlive the member region `R0` (`UB:
        // R0`). Therefore, we need only keep an option `O` if `UB: O`
        // for all UB.
        if choice_regions.len() > 1 {
            let universal_region_relations = self.universal_region_relations.clone();
            let rev_constraint_graph = self.rev_constraint_graph();
            for ub in self.upper_bounds(scc, &rev_constraint_graph) {
                debug!("apply_member_constraint: ub={:?}", ub);
                choice_regions.retain(|&o_r| universal_region_relations.outlives(ub, o_r));
            }
            debug!("apply_member_constraint: after ub, choice_regions={:?}", choice_regions);
        }

        // If we ruled everything out, we're done.
        if choice_regions.is_empty() {
            return false;
        }

        // Otherwise, we need to find the minimum remaining choice, if
        // any, and take that.
        debug!("apply_member_constraint: choice_regions remaining are {:#?}", choice_regions);
        let min = |r1: ty::RegionVid, r2: ty::RegionVid| -> Option<ty::RegionVid> {
            let r1_outlives_r2 = self.universal_region_relations.outlives(r1, r2);
            let r2_outlives_r1 = self.universal_region_relations.outlives(r2, r1);
            match (r1_outlives_r2, r2_outlives_r1) {
                (true, true) => Some(r1.min(r2)),
                (true, false) => Some(r2),
                (false, true) => Some(r1),
                (false, false) => None,
            }
        };
        let mut min_choice = choice_regions[0];
        for &other_option in &choice_regions[1..] {
            debug!(
                "apply_member_constraint: min_choice={:?} other_option={:?}",
                min_choice, other_option,
            );
            match min(min_choice, other_option) {
                Some(m) => min_choice = m,
                None => {
                    debug!(
                        "apply_member_constraint: {:?} and {:?} are incomparable; no min choice",
                        min_choice, other_option,
                    );
                    return false;
                }
            }
        }

        let min_choice_scc = self.constraint_sccs.scc(min_choice);
        debug!(
            "apply_member_constraint: min_choice={:?} best_choice_scc={:?}",
            min_choice,
            min_choice_scc,
        );
        if self.scc_values.add_region(scc, min_choice_scc) {
            self.member_constraints_applied.push(AppliedMemberConstraint {
                member_region_scc: scc,
                min_choice,
                member_constraint_index,
            });

            true
        } else {
            false
        }
    }
/// Invoked for each `R0 member of [R1..Rn]` constraint.
///
/// `scc` is the SCC containing R0, and `choice_regions` are the
/// `R1..Rn` regions -- they are always known to be universal
/// regions (and if that's not true, we just don't attempt to
/// enforce the constraint).
///
/// The current value of `scc` at the time the method is invoked
/// is considered a *lower bound*.  If possible, we will modify
/// the constraint to set it equal to one of the option regions.
/// If we make any changes, returns true, else false.
Invoked for each `R0 member of [R1..Rn]` constraint.

The current value of `scc` at the time the method is invoked
is considered a *lower bound*.  If possible, we will modify
the constraint to set it equal to one of the option regions.
If we make any changes, returns true, else false.
Invoked for each ` R0 member of [ R1 .. Rn ] ` constraint . The current value of ` scc ` at the time the method is invoked is considered a * lower bound * . If possible we will modify the constraint to set it equal to one of the option regions . If we make any changes returns true else false .
fn apply_member_constraint(
        &mut self,
        scc: ConstraintSccIndex,
        member_constraint_index: NllMemberConstraintIndex,
        choice_regions: &[ty::RegionVid],
    ) -> bool {
        debug!("apply_member_constraint(scc={:?}, choice_regions={:#?})", scc, choice_regions,);
        if let Some(uh_oh) =
            choice_regions.iter().find(|&&r| !self.universal_regions.is_universal_region(r))
        {
            // FIXME(#61773): This case can only occur with
            // `impl_trait_in_bindings`, I believe, and we are just
            // opting not to handle it for now. See #61773 for
            // details.
            bug!(
                "member constraint for `{:?}` has an option region `{:?}` \
                 that is not a universal region",
                self.member_constraints[member_constraint_index].opaque_type_def_id,
                uh_oh,
            );
        }
        // Create a mutable vector of the options. We'll try to winnow
        // them down.
        let mut choice_regions: Vec<ty::RegionVid> = choice_regions.to_vec();
        // The 'member region' in a member constraint is part of the
        // hidden type, which must be in the root universe. Therefore,
        // it cannot have any placeholders in its value.
        assert!(self.scc_universes[scc] == ty::UniverseIndex::ROOT);
        debug_assert!(
            self.scc_values.placeholders_contained_in(scc).next().is_none(),
            "scc {:?} in a member constraint has placeholder value: {:?}",
            scc,
            self.scc_values.region_value_str(scc),
        );
        // The existing value for `scc` is a lower-bound. This will
        // consist of some set `{P} + {LB}` of points `{P}` and
        // lower-bound free regions `{LB}`. As each choice region `O`
        // is a free region, it will outlive the points. But we can
        // only consider the option `O` if `O: LB`.
        choice_regions.retain(|&o_r| {
            self.scc_values
                .universal_regions_outlived_by(scc)
                .all(|lb| self.universal_region_relations.outlives(o_r, lb))
        });
        debug!("apply_member_constraint: after lb, choice_regions={:?}", choice_regions);
        // Now find all the *upper bounds* -- that is, each UB is a
        // free region that must outlive the member region `R0` (`UB:
        // R0`). Therefore, we need only keep an option `O` if `UB: O`
        // for all UB.
        if choice_regions.len() > 1 {
            let universal_region_relations = self.universal_region_relations.clone();
            let rev_constraint_graph = self.rev_constraint_graph();
            for ub in self.upper_bounds(scc, &rev_constraint_graph) {
                debug!("apply_member_constraint: ub={:?}", ub);
                choice_regions.retain(|&o_r| universal_region_relations.outlives(ub, o_r));
            }
            debug!("apply_member_constraint: after ub, choice_regions={:?}", choice_regions);
        }
        // If we ruled everything out, we're done.
        if choice_regions.is_empty() {
            return false;
        }
        // Otherwise, we need to find the minimum remaining choice, if
        // any, and take that.
        debug!("apply_member_constraint: choice_regions remaining are {:#?}", choice_regions);
        let min = |r1: ty::RegionVid, r2: ty::RegionVid| -> Option<ty::RegionVid> {
            let r1_outlives_r2 = self.universal_region_relations.outlives(r1, r2);
            let r2_outlives_r1 = self.universal_region_relations.outlives(r2, r1);
            match (r1_outlives_r2, r2_outlives_r1) {
                (true, true) => Some(r1.min(r2)),
                (true, false) => Some(r2),
                (false, true) => Some(r1),
                (false, false) => None,
            }
        };
        let mut min_choice = choice_regions[0];
        for &other_option in &choice_regions[1..] {
            debug!(
                "apply_member_constraint: min_choice={:?} other_option={:?}",
                min_choice, other_option,
            );
            match min(min_choice, other_option) {
                Some(m) => min_choice = m,
                None => {
                    debug!(
                        "apply_member_constraint: {:?} and {:?} are incomparable; no min choice",
                        min_choice, other_option,
                    );
                    return false;
                }
            }
        }
        let min_choice_scc = self.constraint_sccs.scc(min_choice);
        debug!(
            "apply_member_constraint: min_choice={:?} best_choice_scc={:?}",
            min_choice,
            min_choice_scc,
        );
        if self.scc_values.add_region(scc, min_choice_scc) {
            self.member_constraints_applied.push(AppliedMemberConstraint {
                member_region_scc: scc,
                min_choice,
                member_constraint_index,
            });
            true
        } else {
            false
        }
    }
fn apply_member_constraint ( & mut self , scc : ConstraintSccIndex , member_constraint_index : NllMemberConstraintIndex , choice_regions : & [ ty :: RegionVid ] , ) -> bool { debug ! ( " " scc choice_regions ) ; if let Some ( uh_oh ) = choice_regions . iter ( ) . find ( | & & r | ! self . universal_regions . is_universal_region ( r ) ) { // FIXME(#61773): This case can only occur with // `impl_trait_in_bindings`, I believe, and we are just // opting not to handle it for now. See #61773 for // details. bug ! ( " \
 " self member_constraints [ member_constraint_index ] opaque_type_def_id uh_oh ) ; } // Create a mutable vector of the options. We'll try to winnow // them down. let mut choice_regions : Vec < ty :: RegionVid > = choice_regions . to_vec ( ) ; // The 'member region' in a member constraint is part of the // hidden type, which must be in the root universe. Therefore, // it cannot have any placeholders in its value. assert ! ( self scc_universes [ scc ] ty UniverseIndex ROOT ) ; debug_assert ! ( self scc_values placeholders_contained_in ( scc ) next ( ) is_none ( ) " " scc self scc_values region_value_str ( scc ) ) ; // The existing value for `scc` is a lower-bound. This will // consist of some set `{P} + {LB}` of points `{P}` and // lower-bound free regions `{LB}`. As each choice region `O` // is a free region, it will outlive the points. But we can // only consider the option `O` if `O: LB`. choice_regions . retain ( | & o_r | { self . scc_values . universal_regions_outlived_by ( scc ) . all ( | lb | self . universal_region_relations . outlives ( o_r , lb ) ) } ) ; debug ! ( " " choice_regions ) ; // Now find all the *upper bounds* -- that is, each UB is a // free region that must outlive the member region `R0` (`UB: // R0`). Therefore, we need only keep an option `O` if `UB: O` // for all UB. if choice_regions . len ( ) > 1 { let universal_region_relations = self . universal_region_relations . clone ( ) ; let rev_constraint_graph = self . rev_constraint_graph ( ) ; for ub in self . upper_bounds ( scc , & rev_constraint_graph ) { debug ! ( " " ub ) ; choice_regions . retain ( | & o_r | universal_region_relations . outlives ( ub , o_r ) ) ; } debug ! ( " " choice_regions ) ; } // If we ruled everything out, we're done. if choice_regions . is_empty ( ) { return false ; } // Otherwise, we need to find the minimum remaining choice, if // any, and take that. debug ! ( " " choice_regions ) ; let min = | r1 : ty :: RegionVid , r2 : ty :: RegionVid | -> Option < ty :: RegionVid > { let r1_outlives_r2 = self . universal_region_relations . outlives ( r1 , r2 ) ; let r2_outlives_r1 = self . universal_region_relations . outlives ( r2 , r1 ) ; match ( r1_outlives_r2 , r2_outlives_r1 ) { ( true , true ) => Some ( r1 . min ( r2 ) ) , ( true , false ) => Some ( r2 ) , ( false , true ) => Some ( r1 ) , ( false , false ) => None , } } ; let mut min_choice = choice_regions [ 0 ] ; for & other_option in & choice_regions [ 1 .. ] { debug ! ( " " min_choice other_option ) ; match min ( min_choice , other_option ) { Some ( m ) => min_choice = m , None => { debug ! ( " " min_choice other_option ) ; return false ; } } } let min_choice_scc = self . constraint_sccs . scc ( min_choice ) ; debug ! ( " " min_choice min_choice_scc ) ; if self . scc_values . add_region ( scc , min_choice_scc ) { self . member_constraints_applied . push ( AppliedMemberConstraint { member_region_scc : scc , min_choice , member_constraint_index , } ) ; true } else { false } }
Invoked for each `R0 member of [R1..Rn]` constraint.
Invoked for each ` R0 member of [ R1 .. Rn ] ` constraint .
&mut self
scc
ConstraintSccIndex
member_constraint_index
NllMemberConstraintIndex
choice_regions
&[ty::RegionVid]