@@ -21,7 +21,6 @@ use crate::{ClosureOutlivesSubject, ClosureRegionRequirements, ConstraintCategor
21
21
22
22
pub ( crate ) struct ConstraintConversion < ' a , ' tcx > {
23
23
infcx : & ' a InferCtxt < ' tcx > ,
24
- tcx : TyCtxt < ' tcx > ,
25
24
universal_regions : & ' a UniversalRegions < ' tcx > ,
26
25
/// Each RBP `GK: 'a` is assumed to be true. These encode
27
26
/// relationships like `T: 'a` that are added via implicit bounds
@@ -34,7 +33,6 @@ pub(crate) struct ConstraintConversion<'a, 'tcx> {
34
33
/// logic expecting to see (e.g.) `ReStatic`, and if we supplied
35
34
/// our special inference variable there, we would mess that up.
36
35
region_bound_pairs : & ' a RegionBoundPairs < ' tcx > ,
37
- implicit_region_bound : ty:: Region < ' tcx > ,
38
36
param_env : ty:: ParamEnv < ' tcx > ,
39
37
known_type_outlives_obligations : & ' a [ ty:: PolyTypeOutlivesPredicate < ' tcx > ] ,
40
38
locations : Locations ,
@@ -49,7 +47,6 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
49
47
infcx : & ' a InferCtxt < ' tcx > ,
50
48
universal_regions : & ' a UniversalRegions < ' tcx > ,
51
49
region_bound_pairs : & ' a RegionBoundPairs < ' tcx > ,
52
- implicit_region_bound : ty:: Region < ' tcx > ,
53
50
param_env : ty:: ParamEnv < ' tcx > ,
54
51
known_type_outlives_obligations : & ' a [ ty:: PolyTypeOutlivesPredicate < ' tcx > ] ,
55
52
locations : Locations ,
@@ -59,10 +56,8 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
59
56
) -> Self {
60
57
Self {
61
58
infcx,
62
- tcx : infcx. tcx ,
63
59
universal_regions,
64
60
region_bound_pairs,
65
- implicit_region_bound,
66
61
param_env,
67
62
known_type_outlives_obligations,
68
63
locations,
@@ -96,7 +91,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
96
91
// into a vector. These are the regions that we will be
97
92
// relating to one another.
98
93
let closure_mapping = & UniversalRegions :: closure_mapping (
99
- self . tcx ,
94
+ self . infcx . tcx ,
100
95
closure_args,
101
96
closure_requirements. num_external_vids ,
102
97
closure_def_id,
@@ -111,7 +106,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
111
106
let subject = match outlives_requirement. subject {
112
107
ClosureOutlivesSubject :: Region ( re) => closure_mapping[ re] . into ( ) ,
113
108
ClosureOutlivesSubject :: Ty ( subject_ty) => {
114
- subject_ty. instantiate ( self . tcx , |vid| closure_mapping[ vid] ) . into ( )
109
+ subject_ty. instantiate ( self . infcx . tcx , |vid| closure_mapping[ vid] ) . into ( )
115
110
}
116
111
} ;
117
112
@@ -127,14 +122,14 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
127
122
predicate : ty:: OutlivesPredicate < ' tcx , ty:: GenericArg < ' tcx > > ,
128
123
constraint_category : ConstraintCategory < ' tcx > ,
129
124
) {
125
+ let tcx = self . infcx . tcx ;
130
126
debug ! ( "generate: constraints at: {:#?}" , self . locations) ;
131
127
132
128
// Extract out various useful fields we'll need below.
133
129
let ConstraintConversion {
134
- tcx,
135
130
infcx,
131
+ universal_regions,
136
132
region_bound_pairs,
137
- implicit_region_bound,
138
133
known_type_outlives_obligations,
139
134
..
140
135
} = * self ;
@@ -145,7 +140,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
145
140
break ;
146
141
}
147
142
148
- if !self . tcx . recursion_limit ( ) . value_within_limit ( iteration) {
143
+ if !tcx. recursion_limit ( ) . value_within_limit ( iteration) {
149
144
bug ! (
150
145
"FIXME(-Znext-solver): Overflowed when processing region obligations: {outlives_predicates:#?}"
151
146
) ;
@@ -170,10 +165,11 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
170
165
) ;
171
166
}
172
167
168
+ let implicit_region_bound =
169
+ ty:: Region :: new_var ( tcx, universal_regions. implicit_region_bound ( ) ) ;
173
170
// we don't actually use this for anything, but
174
171
// the `TypeOutlives` code needs an origin.
175
172
let origin = infer:: RelateParamBound ( self . span , t1, None ) ;
176
-
177
173
TypeOutlives :: new (
178
174
& mut * self ,
179
175
tcx,
@@ -205,7 +201,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
205
201
/// are dealt with during trait solving.
206
202
fn replace_placeholders_with_nll < T : TypeFoldable < TyCtxt < ' tcx > > > ( & mut self , value : T ) -> T {
207
203
if value. has_placeholders ( ) {
208
- fold_regions ( self . tcx , value, |r, _| match r. kind ( ) {
204
+ fold_regions ( self . infcx . tcx , value, |r, _| match r. kind ( ) {
209
205
ty:: RePlaceholder ( placeholder) => {
210
206
self . constraints . placeholder_region ( self . infcx , placeholder)
211
207
}
0 commit comments