1 //! Various code related to computing outlives relations.
7 use rustc_middle::traits::query::OutlivesBound;
10 pub fn explicit_outlives_bounds<'tcx>(
11 param_env: ty::ParamEnv<'tcx>,
12 ) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
13 debug!("explicit_outlives_bounds()");
14 param_env.caller_bounds.into_iter().filter_map(move |predicate| match predicate.kind() {
15 ty::PredicateKind::Projection(..)
16 | ty::PredicateKind::Trait(..)
17 | ty::PredicateKind::Subtype(..)
18 | ty::PredicateKind::WellFormed(..)
19 | ty::PredicateKind::ObjectSafe(..)
20 | ty::PredicateKind::ClosureKind(..)
21 | ty::PredicateKind::TypeOutlives(..)
22 | ty::PredicateKind::ConstEvaluatable(..)
23 | ty::PredicateKind::ConstEquate(..) => None,
24 ty::PredicateKind::RegionOutlives(ref data) => data
26 .map(|ty::OutlivesPredicate(r_a, r_b)| OutlivesBound::RegionSubRegion(r_b, r_a)),