@@ -13,7 +13,7 @@ use rustc_hir::def_id::DefId;
13
13
use rustc_index:: vec:: IndexVec ;
14
14
use rustc_middle:: ty:: ReStatic ;
15
15
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
16
- use rustc_middle:: ty:: { ReLateBound , ReVar } ;
16
+ use rustc_middle:: ty:: { OutlivesPredicate , ReLateBound , ReVar , RegionKind } ;
17
17
use rustc_middle:: ty:: { Region , RegionVid } ;
18
18
use rustc_span:: Span ;
19
19
@@ -137,14 +137,23 @@ pub enum Constraint<'tcx> {
137
137
RegSubReg ( Region < ' tcx > , Region < ' tcx > ) ,
138
138
}
139
139
140
- impl Constraint < ' _ > {
140
+ impl < ' tcx > Constraint < ' tcx > {
141
141
pub fn involves_placeholders ( & self ) -> bool {
142
142
match self {
143
143
Constraint :: VarSubVar ( _, _) => false ,
144
144
Constraint :: VarSubReg ( _, r) | Constraint :: RegSubVar ( r, _) => r. is_placeholder ( ) ,
145
145
Constraint :: RegSubReg ( r, s) => r. is_placeholder ( ) || s. is_placeholder ( ) ,
146
146
}
147
147
}
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
+ }
148
157
}
149
158
150
159
/// `VerifyGenericBound(T, _, R, RS)`: the parameter type `T` (or
0 commit comments