pub fn required_region_bounds(self,
                                  erased_self_ty: Ty<'tcx>,
                                  predicates: Vec<ty::Predicate<'tcx>>)
                                  -> Vec<&'tcx ty::Region>    {
        debug!("required_region_bounds(erased_self_ty={:?}, predicates={:?})",
               erased_self_ty,
               predicates);

        assert!(!erased_self_ty.has_escaping_regions());

        traits::elaborate_predicates(self, predicates)
            .filter_map(|predicate| {
                match predicate {
                    ty::Predicate::Projection(..) |
                    ty::Predicate::Trait(..) |
                    ty::Predicate::Equate(..) |
                    ty::Predicate::WellFormed(..) |
                    ty::Predicate::ObjectSafe(..) |
                    ty::Predicate::ClosureKind(..) |
                    ty::Predicate::RegionOutlives(..) => {
                        None
                    }
                    ty::Predicate::TypeOutlives(ty::Binder(ty::OutlivesPredicate(t, r))) => {
                        // Search for a bound of the form `erased_self_ty
                        // : 'a`, but be wary of something like `for<'a>
                        // erased_self_ty : 'a` (we interpret a
                        // higher-ranked bound like that as 'static,
                        // though at present the code in `fulfill.rs`
                        // considers such bounds to be unsatisfiable, so
                        // it's kind of a moot point since you could never
                        // construct such an object, but this seems
                        // correct even if that code changes).
                        if t == erased_self_ty && !r.has_escaping_regions() {
                            Some(r)
                        } else {
                            None
                        }
                    }
                }
            })
            .collect()
    }
/// Given a set of predicates that apply to an object type, returns
/// the region bounds that the (erased) `Self` type must
/// outlive. Precisely *because* the `Self` type is erased, the
/// parameter `erased_self_ty` must be supplied to indicate what type
/// has been used to represent `Self` in the predicates
/// themselves. This should really be a unique type; `FreshTy(0)` is a
/// popular choice.
///
/// NB: in some cases, particularly around higher-ranked bounds,
/// this function returns a kind of conservative approximation.
/// That is, all regions returned by this function are definitely
/// required, but there may be other region bounds that are not
/// returned, as well as requirements like `for<'a> T: 'a`.
///
/// Requires that trait definitions have been processed so that we can
/// elaborate predicates and walk supertraits.
Given a set of predicates that apply to an object type, returns
the region bounds that the (erased) `Self` type must
outlive.

in some cases, particularly around higher-ranked bounds,
this function returns a kind of conservative approximation.
That is, all regions returned by this function are definitely
required, but there may be other region bounds that are not
returned, as well as requirements like `for<'a> T: 'a`.

Requires that trait definitions have been processed so that we can
elaborate predicates and walk supertraits.
Given a set of predicates that apply to an object type returns the region bounds that the ( erased ) ` Self ` type must outlive . in some cases particularly around higher - ranked bounds this function returns a kind of conservative approximation . That is all regions returned by this function are definitely required but there may be other region bounds that are not returned as well as requirements like ` for< ' a > T : ' a ` . Requires that trait definitions have been processed so that we can elaborate predicates and walk supertraits .
pub fn required_region_bounds(self,
                                  erased_self_ty: Ty<'tcx>,
                                  predicates: Vec<ty::Predicate<'tcx>>)
                                  -> Vec<&'tcx ty::Region>    {
        debug!("required_region_bounds(erased_self_ty={:?}, predicates={:?})",
               erased_self_ty,
               predicates);
        assert!(!erased_self_ty.has_escaping_regions());
        traits::elaborate_predicates(self, predicates)
            .filter_map(|predicate| {
                match predicate {
                    ty::Predicate::Projection(..) |
                    ty::Predicate::Trait(..) |
                    ty::Predicate::Equate(..) |
                    ty::Predicate::WellFormed(..) |
                    ty::Predicate::ObjectSafe(..) |
                    ty::Predicate::ClosureKind(..) |
                    ty::Predicate::RegionOutlives(..) => {
                        None
                    }
                    ty::Predicate::TypeOutlives(ty::Binder(ty::OutlivesPredicate(t, r))) => {
                        // Search for a bound of the form `erased_self_ty
                        // : 'a`, but be wary of something like `for<'a>
                        // erased_self_ty : 'a` (we interpret a
                        // higher-ranked bound like that as 'static,
                        // though at present the code in `fulfill.rs`
                        // considers such bounds to be unsatisfiable, so
                        // it's kind of a moot point since you could never
                        // construct such an object, but this seems
                        // correct even if that code changes).
                        if t == erased_self_ty && !r.has_escaping_regions() {
                            Some(r)
                        } else {
                            None
                        }
                    }
                }
            })
            .collect()
    }
pub fn required_region_bounds ( self , erased_self_ty : Ty < ' tcx > , predicates : Vec < ty :: Predicate < ' tcx > > ) -> Vec < & ' tcx ty :: Region > { debug ! ( " " erased_self_ty predicates ) ; assert ! ( erased_self_ty has_escaping_regions ( ) ) ; traits :: elaborate_predicates ( self , predicates ) . filter_map ( | predicate | { match predicate { ty :: Predicate :: Projection ( .. ) | ty :: Predicate :: Trait ( .. ) | ty :: Predicate :: Equate ( .. ) | ty :: Predicate :: WellFormed ( .. ) | ty :: Predicate :: ObjectSafe ( .. ) | ty :: Predicate :: ClosureKind ( .. ) | ty :: Predicate :: RegionOutlives ( .. ) => { None } ty :: Predicate :: TypeOutlives ( ty :: Binder ( ty :: OutlivesPredicate ( t , r ) ) ) => { // Search for a bound of the form `erased_self_ty // : 'a`, but be wary of something like `for<'a> // erased_self_ty : 'a` (we interpret a // higher-ranked bound like that as 'static, // though at present the code in `fulfill.rs` // considers such bounds to be unsatisfiable, so // it's kind of a moot point since you could never // construct such an object, but this seems // correct even if that code changes). if t == erased_self_ty && ! r . has_escaping_regions ( ) { Some ( r ) } else { None } } } } ) . collect ( ) }
Given a set of predicates that apply to an object type, returns
the region bounds that the (erased) `Self` type must
outlive.
Given a set of predicates that apply to an object type returns the region bounds that the ( erased ) ` Self ` type must outlive .
self
erased_self_ty
Ty<'tcx>
predicates
Vec<ty::Predicate<'tcx>>