]> git.lizzy.rs Git - rust.git/blob - src/librustc_infer/infer/outlives/mod.rs
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.git] / src / librustc_infer / infer / outlives / mod.rs
1 //! Various code related to computing outlives relations.
2
3 pub mod env;
4 pub mod obligations;
5 pub mod verify;
6
7 use rustc::traits::query::OutlivesBound;
8 use rustc::ty;
9
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 {
15         ty::Predicate::Projection(..)
16         | ty::Predicate::Trait(..)
17         | ty::Predicate::Subtype(..)
18         | ty::Predicate::WellFormed(..)
19         | ty::Predicate::ObjectSafe(..)
20         | ty::Predicate::ClosureKind(..)
21         | ty::Predicate::TypeOutlives(..)
22         | ty::Predicate::ConstEvaluatable(..) => None,
23         ty::Predicate::RegionOutlives(ref data) => data
24             .no_bound_vars()
25             .map(|ty::OutlivesPredicate(r_a, r_b)| OutlivesBound::RegionSubRegion(r_b, r_a)),
26     })
27 }