1 //! Various code related to computing outlives relations.
7 use rustc_middle::traits::query::OutlivesBound;
9 use rustc_middle::ty::fold::TypeFoldable;
11 pub fn explicit_outlives_bounds<'tcx>(
12 param_env: ty::ParamEnv<'tcx>,
13 ) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
14 debug!("explicit_outlives_bounds()");
18 .map(ty::Predicate::skip_binders)
19 .filter(|atom| !atom.has_escaping_bound_vars())
20 .filter_map(move |atom| match atom {
21 ty::PredicateAtom::Projection(..)
22 | ty::PredicateAtom::Trait(..)
23 | ty::PredicateAtom::Subtype(..)
24 | ty::PredicateAtom::WellFormed(..)
25 | ty::PredicateAtom::ObjectSafe(..)
26 | ty::PredicateAtom::ClosureKind(..)
27 | ty::PredicateAtom::TypeOutlives(..)
28 | ty::PredicateAtom::ConstEvaluatable(..)
29 | ty::PredicateAtom::ConstEquate(..)
30 | ty::PredicateAtom::TypeWellFormedFromEnv(..) => None,
31 ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(r_a, r_b)) => {
32 Some(OutlivesBound::RegionSubRegion(r_b, r_a))