@@ -15,7 +15,6 @@ use super::{CombinedSnapshot,
15
15
InferCtxt ,
16
16
LateBoundRegion ,
17
17
HigherRankedType ,
18
- SubregionOrigin ,
19
18
SkolemizationMap } ;
20
19
use super :: combine:: CombineFields ;
21
20
use super :: region_inference:: { TaintDirections } ;
@@ -527,7 +526,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
527
526
// be itself or other new variables.
528
527
let incoming_taints = self . tainted_regions ( snapshot,
529
528
skol,
530
- TaintDirections :: incoming ( ) ) ;
529
+ TaintDirections :: both ( ) ) ;
531
530
for & tainted_region in & incoming_taints {
532
531
// Each skolemized should only be relatable to itself
533
532
// or new variables:
@@ -568,71 +567,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
568
567
569
568
self . issue_32330_warnings ( span, & warnings) ;
570
569
571
- for ( _, & skol) in skol_map {
572
- // The outputs from a skolemized variable must all be
573
- // equatable with `'static`.
574
- let outgoing_taints = self . tainted_regions ( snapshot,
575
- skol,
576
- TaintDirections :: outgoing ( ) ) ;
577
- for & tainted_region in & outgoing_taints {
578
- match tainted_region {
579
- ty:: ReVar ( vid) if new_vars. contains ( & vid) => {
580
- // There is a path from a skolemized variable
581
- // to some region variable that doesn't escape
582
- // this snapshot:
583
- //
584
- // [skol] -> [tainted_region]
585
- //
586
- // We can ignore this. The reasoning relies on
587
- // the fact that the preivous loop
588
- // completed. There are two possible cases
589
- // here.
590
- //
591
- // - `tainted_region` eventually reaches a
592
- // skolemized variable, which *must* be `skol`
593
- // (because otherwise we would have already
594
- // returned `Err`). In that case,
595
- // `tainted_region` could be inferred to `skol`.
596
- //
597
- // - `tainted_region` never reaches a
598
- // skolemized variable. In that case, we can
599
- // safely choose `'static` as an upper bound
600
- // incoming edges. This is a conservative
601
- // choice -- the LUB might be one of the
602
- // incoming skolemized variables, which we
603
- // might know by ambient bounds. We can
604
- // consider a more clever choice of upper
605
- // bound later (modulo some theoretical
606
- // breakage).
607
- //
608
- // We used to force such `tainted_region` to be
609
- // `'static`, but that leads to problems when
610
- // combined with `plug_leaks`. If you have a case
611
- // where `[skol] -> [tainted_region] -> [skol]`,
612
- // then `plug_leaks` concludes it should replace
613
- // `'static` with a late-bound region, which is
614
- // clearly wrong. (Well, what actually happens is
615
- // you get assertion failures because it WOULD
616
- // have to replace 'static with a late-bound
617
- // region.)
618
- }
619
- ty:: ReSkolemized ( ..) => {
620
- // the only skolemized region we find in the
621
- // successors of X can be X; if there was another
622
- // region Y, then X would have been in the preds
623
- // of Y, and we would have aborted above
624
- assert_eq ! ( skol, tainted_region) ;
625
- }
626
- _ => {
627
- self . region_vars . make_subregion (
628
- SubregionOrigin :: SkolemizeSuccessor ( span) ,
629
- ty:: ReStatic ,
630
- tainted_region) ;
631
- }
632
- }
633
- }
634
- }
635
-
636
570
Ok ( ( ) )
637
571
}
638
572
@@ -682,7 +616,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
682
616
skol_map
683
617
. iter ( )
684
618
. flat_map ( |( & skol_br, & skol) | {
685
- self . tainted_regions ( snapshot, skol, TaintDirections :: incoming ( ) )
619
+ self . tainted_regions ( snapshot, skol, TaintDirections :: both ( ) )
686
620
. into_iter ( )
687
621
. map ( move |tainted_region| ( tainted_region, skol_br) )
688
622
} )
0 commit comments