@@ -13,7 +13,7 @@ use rustc_hir::def_id::DefId;
1313use rustc_index:: vec:: IndexVec ;
1414use rustc_middle:: ty:: ReStatic ;
1515use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
16- use rustc_middle:: ty:: { ReLateBound , ReVar } ;
16+ use rustc_middle:: ty:: { OutlivesPredicate , ReLateBound , ReVar , RegionKind } ;
1717use rustc_middle:: ty:: { Region , RegionVid } ;
1818use rustc_span:: Span ;
1919
@@ -137,14 +137,23 @@ pub enum Constraint<'tcx> {
137137 RegSubReg ( Region < ' tcx > , Region < ' tcx > ) ,
138138}
139139
140- impl Constraint < ' _ > {
140+ impl < ' tcx > Constraint < ' tcx > {
141141 pub fn involves_placeholders ( & self ) -> bool {
142142 match self {
143143 Constraint :: VarSubVar ( _, _) => false ,
144144 Constraint :: VarSubReg ( _, r) | Constraint :: RegSubVar ( r, _) => r. is_placeholder ( ) ,
145145 Constraint :: RegSubReg ( r, s) => r. is_placeholder ( ) || s. is_placeholder ( ) ,
146146 }
147147 }
148+
149+ pub fn to_region_outlives_predicate ( self ) -> OutlivesPredicate < RegionKind , RegionKind > {
150+ match self {
151+ Self :: VarSubVar ( a, b) => OutlivesPredicate ( RegionKind :: ReVar ( a) , RegionKind :: ReVar ( b) ) ,
152+ Self :: RegSubVar ( a, b) => OutlivesPredicate ( * a, RegionKind :: ReVar ( b) ) ,
153+ Self :: VarSubReg ( a, b) => OutlivesPredicate ( RegionKind :: ReVar ( a) , * b) ,
154+ Self :: RegSubReg ( a, b) => OutlivesPredicate ( * a, * b) ,
155+ }
156+ }
148157}
149158
150159/// `VerifyGenericBound(T, _, R, RS)`: the parameter type `T` (or
0 commit comments