@@ -58,19 +58,6 @@ pub struct FulfillmentContext<'tcx> {
58
58
59
59
relationships : FxHashMap < ty:: TyVid , ty:: FoundRelationships > ,
60
60
61
- // Should this fulfillment context register type-lives-for-region
62
- // obligations on its parent infcx? In some cases, region
63
- // obligations are either already known to hold (normalization) or
64
- // hopefully verified elsewhere (type-impls-bound), and therefore
65
- // should not be checked.
66
- //
67
- // Note that if we are normalizing a type that we already
68
- // know is well-formed, there should be no harm setting this
69
- // to true - all the region variables should be determinable
70
- // using the RFC 447 rules, which don't depend on
71
- // type-lives-for-region constraints, and because the type
72
- // is well-formed, the constraints should hold.
73
- register_region_obligations : bool ,
74
61
// Is it OK to register obligations into this infcx inside
75
62
// an infcx snapshot?
76
63
//
@@ -103,7 +90,6 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
103
90
FulfillmentContext {
104
91
predicates : ObligationForest :: new ( ) ,
105
92
relationships : FxHashMap :: default ( ) ,
106
- register_region_obligations : true ,
107
93
usable_in_snapshot : false ,
108
94
}
109
95
}
@@ -112,30 +98,18 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
112
98
FulfillmentContext {
113
99
predicates : ObligationForest :: new ( ) ,
114
100
relationships : FxHashMap :: default ( ) ,
115
- register_region_obligations : true ,
116
101
usable_in_snapshot : true ,
117
102
}
118
103
}
119
104
120
- pub fn new_ignoring_regions ( ) -> FulfillmentContext < ' tcx > {
121
- FulfillmentContext {
122
- predicates : ObligationForest :: new ( ) ,
123
- relationships : FxHashMap :: default ( ) ,
124
- register_region_obligations : false ,
125
- usable_in_snapshot : false ,
126
- }
127
- }
128
-
129
105
/// Attempts to select obligations using `selcx`.
130
106
fn select ( & mut self , selcx : & mut SelectionContext < ' a , ' tcx > ) -> Vec < FulfillmentError < ' tcx > > {
131
107
let span = debug_span ! ( "select" , obligation_forest_size = ?self . predicates. len( ) ) ;
132
108
let _enter = span. enter ( ) ;
133
109
134
110
// Process pending obligations.
135
- let outcome: Outcome < _ , _ > = self . predicates . process_obligations ( & mut FulfillProcessor {
136
- selcx,
137
- register_region_obligations : self . register_region_obligations ,
138
- } ) ;
111
+ let outcome: Outcome < _ , _ > =
112
+ self . predicates . process_obligations ( & mut FulfillProcessor { selcx } ) ;
139
113
140
114
// FIXME: if we kept the original cache key, we could mark projection
141
115
// obligations as complete for the projection cache here.
@@ -239,7 +213,6 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
239
213
240
214
struct FulfillProcessor < ' a , ' b , ' tcx > {
241
215
selcx : & ' a mut SelectionContext < ' b , ' tcx > ,
242
- register_region_obligations : bool ,
243
216
}
244
217
245
218
fn mk_pending ( os : Vec < PredicateObligation < ' _ > > ) -> Vec < PendingPredicateObligation < ' _ > > {
@@ -385,19 +358,16 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
385
358
}
386
359
387
360
ty:: PredicateKind :: RegionOutlives ( data) => {
388
- match infcx. region_outlives_predicate ( & obligation. cause , Binder :: dummy ( data) ) {
389
- Ok ( ( ) ) => ProcessResult :: Changed ( vec ! [ ] ) ,
390
- Err ( _) => ProcessResult :: Error ( CodeSelectionError ( Unimplemented ) ) ,
361
+ if infcx. considering_regions || data. has_placeholders ( ) {
362
+ infcx. region_outlives_predicate ( & obligation. cause , Binder :: dummy ( data) ) ;
391
363
}
364
+
365
+ ProcessResult :: Changed ( vec ! [ ] )
392
366
}
393
367
394
368
ty:: PredicateKind :: TypeOutlives ( ty:: OutlivesPredicate ( t_a, r_b) ) => {
395
- if self . register_region_obligations {
396
- self . selcx . infcx ( ) . register_region_obligation_with_cause (
397
- t_a,
398
- r_b,
399
- & obligation. cause ,
400
- ) ;
369
+ if infcx. considering_regions {
370
+ infcx. register_region_obligation_with_cause ( t_a, r_b, & obligation. cause ) ;
401
371
}
402
372
ProcessResult :: Changed ( vec ! [ ] )
403
373
}
0 commit comments