@@ -76,27 +76,29 @@ use crate::infer::outlives::env::RegionBoundPairs;
76
76
use crate :: infer:: outlives:: verify:: VerifyBoundCx ;
77
77
use crate :: infer:: resolve:: OpportunisticRegionResolver ;
78
78
use crate :: infer:: snapshot:: undo_log:: UndoLog ;
79
- use crate :: infer:: { self , GenericKind , InferCtxt , RegionObligation , SubregionOrigin , VerifyBound } ;
79
+ use crate :: infer:: {
80
+ self , GenericKind , InferCtxt , SubregionOrigin , TypeOutlivesConstraint , VerifyBound ,
81
+ } ;
80
82
use crate :: traits:: { ObligationCause , ObligationCauseCode } ;
81
83
82
84
impl < ' tcx > InferCtxt < ' tcx > {
83
- pub fn outlives_predicate_with_cause (
85
+ pub fn register_outlives_constraint (
84
86
& self ,
85
87
ty:: OutlivesPredicate ( arg, r2) : ty:: OutlivesPredicate < ' tcx , ty:: GenericArg < ' tcx > > ,
86
88
cause : & ObligationCause < ' tcx > ,
87
89
) {
88
90
match arg. unpack ( ) {
89
91
ty:: GenericArgKind :: Lifetime ( r1) => {
90
- self . region_outlives_predicate ( ty:: OutlivesPredicate ( r1, r2) , cause) ;
92
+ self . register_region_outlives_constraint ( ty:: OutlivesPredicate ( r1, r2) , cause) ;
91
93
}
92
94
ty:: GenericArgKind :: Type ( ty1) => {
93
- self . type_outlives_predicate_with_cause ( ty1, r2, cause) ;
95
+ self . register_type_outlives_constraint ( ty1, r2, cause) ;
94
96
}
95
97
ty:: GenericArgKind :: Const ( _) => unreachable ! ( ) ,
96
98
}
97
99
}
98
100
99
- pub fn region_outlives_predicate (
101
+ pub fn register_region_outlives_constraint (
100
102
& self ,
101
103
ty:: OutlivesPredicate ( r_a, r_b) : ty:: RegionOutlivesPredicate < ' tcx > ,
102
104
cause : & ObligationCause < ' tcx > ,
@@ -114,13 +116,16 @@ impl<'tcx> InferCtxt<'tcx> {
114
116
/// available (see `region_obligations` field for more
115
117
/// information).
116
118
#[ instrument( level = "debug" , skip( self ) ) ]
117
- pub fn type_outlives_predicate ( & self , obligation : RegionObligation < ' tcx > ) {
119
+ pub fn register_type_outlives_constraint_inner (
120
+ & self ,
121
+ obligation : TypeOutlivesConstraint < ' tcx > ,
122
+ ) {
118
123
let mut inner = self . inner . borrow_mut ( ) ;
119
- inner. undo_log . push ( UndoLog :: PushRegionObligation ) ;
124
+ inner. undo_log . push ( UndoLog :: PushTypeOutlivesConstraint ) ;
120
125
inner. region_obligations . push ( obligation) ;
121
126
}
122
127
123
- pub fn type_outlives_predicate_with_cause (
128
+ pub fn register_type_outlives_constraint (
124
129
& self ,
125
130
sup_type : Ty < ' tcx > ,
126
131
sub_region : Region < ' tcx > ,
@@ -152,11 +157,15 @@ impl<'tcx> InferCtxt<'tcx> {
152
157
)
153
158
} ) ;
154
159
155
- self . type_outlives_predicate ( RegionObligation { sup_type, sub_region, origin } ) ;
160
+ self . register_type_outlives_constraint_inner ( TypeOutlivesConstraint {
161
+ sup_type,
162
+ sub_region,
163
+ origin,
164
+ } ) ;
156
165
}
157
166
158
167
/// Trait queries just want to pass back type obligations "as is"
159
- pub fn take_registered_region_obligations ( & self ) -> Vec < RegionObligation < ' tcx > > {
168
+ pub fn take_registered_region_obligations ( & self ) -> Vec < TypeOutlivesConstraint < ' tcx > > {
160
169
std:: mem:: take ( & mut self . inner . borrow_mut ( ) . region_obligations )
161
170
}
162
171
@@ -194,7 +203,7 @@ impl<'tcx> InferCtxt<'tcx> {
194
203
) ;
195
204
}
196
205
197
- for RegionObligation { sup_type, sub_region, origin } in my_region_obligations {
206
+ for TypeOutlivesConstraint { sup_type, sub_region, origin } in my_region_obligations {
198
207
let outlives = ty:: Binder :: dummy ( ty:: OutlivesPredicate ( sup_type, sub_region) ) ;
199
208
let ty:: OutlivesPredicate ( sup_type, sub_region) =
200
209
deeply_normalize_ty ( outlives, origin. clone ( ) )
0 commit comments