@@ -227,7 +227,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
227
227
. iter ( )
228
228
. filter_map ( |param| match param. kind {
229
229
ty:: GenericParamDefKind :: Lifetime => Some ( param. name . to_string ( ) ) ,
230
- _ => None
230
+ _ => None ,
231
231
} )
232
232
. collect ( ) ;
233
233
@@ -359,8 +359,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
359
359
& Err ( SelectionError :: Unimplemented ) => {
360
360
if self . is_of_param ( pred. skip_binder ( ) . trait_ref . substs ) {
361
361
already_visited. remove ( & pred) ;
362
- self . add_user_pred ( & mut user_computed_preds,
363
- ty:: Predicate :: Trait ( pred. clone ( ) ) ) ;
362
+ self . add_user_pred (
363
+ & mut user_computed_preds,
364
+ ty:: Predicate :: Trait ( pred. clone ( ) ) ,
365
+ ) ;
364
366
predicates. push_back ( pred) ;
365
367
} else {
366
368
debug ! (
@@ -418,8 +420,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
418
420
// under which a type implements an auto trait. A trait predicate involving
419
421
// a HRTB means that the type needs to work with any choice of lifetime,
420
422
// not just one specific lifetime (e.g. 'static).
421
- fn add_user_pred < ' c > ( & self , user_computed_preds : & mut FxHashSet < ty:: Predicate < ' c > > ,
422
- new_pred : ty:: Predicate < ' c > ) {
423
+ fn add_user_pred < ' c > (
424
+ & self ,
425
+ user_computed_preds : & mut FxHashSet < ty:: Predicate < ' c > > ,
426
+ new_pred : ty:: Predicate < ' c > ,
427
+ ) {
423
428
let mut should_add_new = true ;
424
429
user_computed_preds. retain ( |& old_pred| {
425
430
match ( & new_pred, old_pred) {
@@ -431,20 +436,19 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
431
436
if !new_substs. types ( ) . eq ( old_substs. types ( ) ) {
432
437
// We can't compare lifetimes if the types are different,
433
438
// so skip checking old_pred
434
- return true
439
+ return true ;
435
440
}
436
441
437
- for ( new_region, old_region) in new_substs
438
- . regions ( )
439
- . zip ( old_substs. regions ( ) ) {
440
-
442
+ for ( new_region, old_region) in
443
+ new_substs. regions ( ) . zip ( old_substs. regions ( ) )
444
+ {
441
445
match ( new_region, old_region) {
442
446
// If both predicates have an 'ReLateBound' (a HRTB) in the
443
447
// same spot, we do nothing
444
448
(
445
449
ty:: RegionKind :: ReLateBound ( _, _) ,
446
- ty:: RegionKind :: ReLateBound ( _, _)
447
- ) => { } ,
450
+ ty:: RegionKind :: ReLateBound ( _, _) ,
451
+ ) => { }
448
452
449
453
( ty:: RegionKind :: ReLateBound ( _, _) , _) => {
450
454
// The new predicate has a HRTB in a spot where the old
@@ -458,7 +462,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
458
462
// so we return 'false' to remove the old predicate from
459
463
// user_computed_preds
460
464
return false ;
461
- } ,
465
+ }
462
466
( _, ty:: RegionKind :: ReLateBound ( _, _) ) => {
463
467
// This is the opposite situation as the previous arm - the
464
468
// old predicate has a HRTB lifetime in a place where the
@@ -471,10 +475,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
471
475
}
472
476
}
473
477
}
474
- } ,
478
+ }
475
479
_ => { }
476
480
}
477
- return true
481
+ return true ;
478
482
} ) ;
479
483
480
484
if should_add_new {
@@ -513,44 +517,32 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
513
517
match constraint {
514
518
& Constraint :: VarSubVar ( r1, r2) => {
515
519
{
516
- let deps1 = vid_map
517
- . entry ( RegionTarget :: RegionVid ( r1) )
518
- . or_default ( ) ;
520
+ let deps1 = vid_map. entry ( RegionTarget :: RegionVid ( r1) ) . or_default ( ) ;
519
521
deps1. larger . insert ( RegionTarget :: RegionVid ( r2) ) ;
520
522
}
521
523
522
- let deps2 = vid_map
523
- . entry ( RegionTarget :: RegionVid ( r2) )
524
- . or_default ( ) ;
524
+ let deps2 = vid_map. entry ( RegionTarget :: RegionVid ( r2) ) . or_default ( ) ;
525
525
deps2. smaller . insert ( RegionTarget :: RegionVid ( r1) ) ;
526
526
}
527
527
& Constraint :: RegSubVar ( region, vid) => {
528
528
{
529
- let deps1 = vid_map
530
- . entry ( RegionTarget :: Region ( region) )
531
- . or_default ( ) ;
529
+ let deps1 = vid_map. entry ( RegionTarget :: Region ( region) ) . or_default ( ) ;
532
530
deps1. larger . insert ( RegionTarget :: RegionVid ( vid) ) ;
533
531
}
534
532
535
- let deps2 = vid_map
536
- . entry ( RegionTarget :: RegionVid ( vid) )
537
- . or_default ( ) ;
533
+ let deps2 = vid_map. entry ( RegionTarget :: RegionVid ( vid) ) . or_default ( ) ;
538
534
deps2. smaller . insert ( RegionTarget :: Region ( region) ) ;
539
535
}
540
536
& Constraint :: VarSubReg ( vid, region) => {
541
537
finished_map. insert ( vid, region) ;
542
538
}
543
539
& Constraint :: RegSubReg ( r1, r2) => {
544
540
{
545
- let deps1 = vid_map
546
- . entry ( RegionTarget :: Region ( r1) )
547
- . or_default ( ) ;
541
+ let deps1 = vid_map. entry ( RegionTarget :: Region ( r1) ) . or_default ( ) ;
548
542
deps1. larger . insert ( RegionTarget :: Region ( r2) ) ;
549
543
}
550
544
551
- let deps2 = vid_map
552
- . entry ( RegionTarget :: Region ( r2) )
553
- . or_default ( ) ;
545
+ let deps2 = vid_map. entry ( RegionTarget :: Region ( r2) ) . or_default ( ) ;
554
546
deps2. smaller . insert ( RegionTarget :: Region ( r1) ) ;
555
547
}
556
548
}
@@ -683,7 +675,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
683
675
}
684
676
}
685
677
& ty:: Predicate :: RegionOutlives ( ref binder) => {
686
- if select. infcx ( ) . region_outlives_predicate ( & dummy_cause, binder) . is_err ( ) {
678
+ if select
679
+ . infcx ( )
680
+ . region_outlives_predicate ( & dummy_cause, binder)
681
+ . is_err ( )
682
+ {
687
683
return false ;
688
684
}
689
685
}
0 commit comments