]>
Commit | Line | Data |
---|---|---|
ff7c6d11 XL |
1 | //! Various code related to computing outlives relations. |
2 | ||
abe05a73 | 3 | pub mod env; |
8faf50e0 | 4 | pub mod obligations; |
0bf4aa26 | 5 | pub mod verify; |
ba9703b0 XL |
6 | |
7 | use rustc_middle::traits::query::OutlivesBound; | |
8 | use rustc_middle::ty; | |
3dfed10e | 9 | use rustc_middle::ty::fold::TypeFoldable; |
ba9703b0 XL |
10 | |
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()"); | |
3dfed10e XL |
15 | param_env |
16 | .caller_bounds() | |
17 | .into_iter() | |
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(..) => None, | |
30 | ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(r_a, r_b)) => { | |
31 | Some(OutlivesBound::RegionSubRegion(r_b, r_a)) | |
32 | } | |
33 | }) | |
ba9703b0 | 34 | } |