@@ -490,7 +490,7 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>(
490490 // The bounds we that we would require from `to_check`
491491 let mut bounds = FxHashSet :: default ( ) ;
492492
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) ;
494494
495495 // If both regions and types are empty, then this GAT isn't in the
496496 // 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>(
664664/// the two vectors, `regions` and `types` (depending on their kind). For each
665665/// parameter `Pi` also track the index `i`.
666666struct GATSubstCollector < ' tcx > {
667- tcx : TyCtxt < ' tcx > ,
668667 gat : DefId ,
669668 // Which region appears and which parameter index its substituted for
670669 regions : FxHashSet < ( ty:: Region < ' tcx > , usize ) > ,
@@ -674,16 +673,11 @@ struct GATSubstCollector<'tcx> {
674673
675674impl < ' tcx > GATSubstCollector < ' tcx > {
676675 fn visit < T : TypeFoldable < ' tcx > > (
677- tcx : TyCtxt < ' tcx > ,
678676 gat : DefId ,
679677 t : T ,
680678 ) -> ( 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 ( ) } ;
687681 t. visit_with ( & mut visitor) ;
688682 ( visitor. regions , visitor. types )
689683 }
@@ -692,19 +686,12 @@ impl<'tcx> GATSubstCollector<'tcx> {
692686impl < ' tcx > TypeVisitor < ' tcx > for GATSubstCollector < ' tcx > {
693687 type BreakTy = !;
694688
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-
702689 fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
703690 match t. kind ( ) {
704691 ty:: Projection ( p) if p. item_def_id == self . gat => {
705692 for ( idx, subst) in p. substs . iter ( ) . enumerate ( ) {
706693 match subst. unpack ( ) {
707- GenericArgKind :: Lifetime ( lt) => {
694+ GenericArgKind :: Lifetime ( lt) if !lt . is_late_bound ( ) => {
708695 self . regions . insert ( ( lt, idx) ) ;
709696 }
710697 GenericArgKind :: Type ( t) => {
0 commit comments