@@ -250,13 +250,15 @@ impl<'tcx> FulfillmentContext<'tcx> {
250
250
self . predicates . retain ( |predicate| {
251
251
// Hack: Retain does not pass in the index, but we want
252
252
// to avoid processing the first `start_count` entries.
253
- if skip == 0 {
254
- retain_predicate ( selcx, predicate,
255
- & mut selections, & mut errors, region_obligations)
256
- } else {
257
- skip -= 1 ;
258
- true
259
- }
253
+ let processed =
254
+ if skip == 0 {
255
+ process_predicate ( selcx, predicate,
256
+ & mut selections, & mut errors, region_obligations)
257
+ } else {
258
+ skip -= 1 ;
259
+ false
260
+ } ;
261
+ !processed
260
262
} ) ;
261
263
}
262
264
@@ -286,17 +288,17 @@ impl<'tcx> FulfillmentContext<'tcx> {
286
288
}
287
289
}
288
290
289
- fn retain_predicate < ' a , ' tcx > ( selcx : & mut SelectionContext < ' a , ' tcx > ,
290
- predicate : & PredicateObligation < ' tcx > ,
291
- selections : & mut Vec < Selection < ' tcx > > ,
292
- errors : & mut Vec < FulfillmentError < ' tcx > > ,
293
- region_obligations : & mut NodeMap < Vec < RegionObligation < ' tcx > > > )
294
- -> bool
291
+ fn process_predicate < ' a , ' tcx > ( selcx : & mut SelectionContext < ' a , ' tcx > ,
292
+ predicate : & PredicateObligation < ' tcx > ,
293
+ selections : & mut Vec < Selection < ' tcx > > ,
294
+ errors : & mut Vec < FulfillmentError < ' tcx > > ,
295
+ region_obligations : & mut NodeMap < Vec < RegionObligation < ' tcx > > > )
296
+ -> bool
295
297
{
296
298
/*!
297
- * Evaluates a predicate obligation and modifies the appropriate
298
- * output array. Returns `true` if the predicate must be retained
299
- * because it could not be fully evaluated yet due to insufficient
299
+ * Processes a predicate obligation and modifies the appropriate
300
+ * output array with the successful/error result. Returns `false`
301
+ * if the predicate could not be processed due to insufficient
300
302
* type inference.
301
303
*/
302
304
@@ -308,11 +310,11 @@ fn retain_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
308
310
trait_ref : trait_ref. clone ( ) } ;
309
311
match selcx. select ( & trait_obligation) {
310
312
Ok ( None ) => {
311
- true
313
+ false
312
314
}
313
315
Ok ( Some ( s) ) => {
314
316
selections. push ( s) ;
315
- false
317
+ true
316
318
}
317
319
Err ( selection_err) => {
318
320
debug ! ( "predicate: {} error: {}" ,
@@ -322,7 +324,7 @@ fn retain_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
322
324
FulfillmentError :: new (
323
325
predicate. clone ( ) ,
324
326
CodeSelectionError ( selection_err) ) ) ;
325
- false
327
+ true
326
328
}
327
329
}
328
330
}
@@ -331,27 +333,27 @@ fn retain_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
331
333
let origin = infer:: EquatePredicate ( predicate. cause . span ) ;
332
334
match infer:: mk_eqty ( selcx. infcx ( ) , false , origin, a, b) {
333
335
Ok ( ( ) ) => {
334
- false
336
+ true
335
337
}
336
338
Err ( _) => {
337
339
errors. push (
338
340
FulfillmentError :: new (
339
341
predicate. clone ( ) ,
340
342
CodeSelectionError ( Unimplemented ) ) ) ;
341
- false
343
+ true
342
344
}
343
345
}
344
346
}
345
347
346
348
ty:: Predicate :: RegionOutlives ( r_a, r_b) => {
347
349
let origin = infer:: RelateRegionParamBound ( predicate. cause . span ) ;
348
350
let ( ) = infer:: mk_subr ( selcx. infcx ( ) , origin, r_b, r_a) ; // `b : a` ==> `a <= b`
349
- false
351
+ true
350
352
}
351
353
352
354
ty:: Predicate :: TypeOutlives ( t_a, r_b) => {
353
355
register_region_obligation ( tcx, t_a, r_b, predicate. cause , region_obligations) ;
354
- false
356
+ true
355
357
}
356
358
}
357
359
}
0 commit comments