@@ -490,7 +490,7 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>(
490
490
// The bounds we that we would require from `to_check`
491
491
let mut bounds = FxHashSet :: default ( ) ;
492
492
493
- let ( regions, types) = GATSubstCollector :: visit ( tcx , gat_def_id. to_def_id ( ) , to_check) ;
493
+ let ( regions, types) = GATSubstCollector :: visit ( gat_def_id. to_def_id ( ) , to_check) ;
494
494
495
495
// If both regions and types are empty, then this GAT isn't in the
496
496
// set of types we are checking, and we shouldn't try to do clause analysis
@@ -664,7 +664,6 @@ fn resolve_regions_with_wf_tys<'tcx>(
664
664
/// the two vectors, `regions` and `types` (depending on their kind). For each
665
665
/// parameter `Pi` also track the index `i`.
666
666
struct GATSubstCollector < ' tcx > {
667
- tcx : TyCtxt < ' tcx > ,
668
667
gat : DefId ,
669
668
// Which region appears and which parameter index its substituted for
670
669
regions : FxHashSet < ( ty:: Region < ' tcx > , usize ) > ,
@@ -674,16 +673,11 @@ struct GATSubstCollector<'tcx> {
674
673
675
674
impl < ' tcx > GATSubstCollector < ' tcx > {
676
675
fn visit < T : TypeFoldable < ' tcx > > (
677
- tcx : TyCtxt < ' tcx > ,
678
676
gat : DefId ,
679
677
t : T ,
680
678
) -> ( FxHashSet < ( ty:: Region < ' tcx > , usize ) > , FxHashSet < ( Ty < ' tcx > , usize ) > ) {
681
- let mut visitor = GATSubstCollector {
682
- tcx,
683
- gat,
684
- regions : FxHashSet :: default ( ) ,
685
- types : FxHashSet :: default ( ) ,
686
- } ;
679
+ let mut visitor =
680
+ GATSubstCollector { gat, regions : FxHashSet :: default ( ) , types : FxHashSet :: default ( ) } ;
687
681
t. visit_with ( & mut visitor) ;
688
682
( visitor. regions , visitor. types )
689
683
}
@@ -692,19 +686,12 @@ impl<'tcx> GATSubstCollector<'tcx> {
692
686
impl < ' tcx > TypeVisitor < ' tcx > for GATSubstCollector < ' tcx > {
693
687
type BreakTy = !;
694
688
695
- fn visit_binder < T : TypeFoldable < ' tcx > > (
696
- & mut self ,
697
- t : & ty:: Binder < ' tcx , T > ,
698
- ) -> ControlFlow < Self :: BreakTy > {
699
- self . tcx . liberate_late_bound_regions ( self . gat , t. clone ( ) ) . visit_with ( self )
700
- }
701
-
702
689
fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
703
690
match t. kind ( ) {
704
691
ty:: Projection ( p) if p. item_def_id == self . gat => {
705
692
for ( idx, subst) in p. substs . iter ( ) . enumerate ( ) {
706
693
match subst. unpack ( ) {
707
- GenericArgKind :: Lifetime ( lt) => {
694
+ GenericArgKind :: Lifetime ( lt) if !lt . is_late_bound ( ) => {
708
695
self . regions . insert ( ( lt, idx) ) ;
709
696
}
710
697
GenericArgKind :: Type ( t) => {
0 commit comments