@@ -441,7 +441,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
441
441
442
442
for required_region in required_region_bounds {
443
443
concrete_ty. visit_with ( & mut ConstrainOpaqueTypeRegionVisitor {
444
- infcx : self ,
445
444
op : |r| self . sub_regions ( infer:: CallReturn ( span) , required_region, r) ,
446
445
} ) ;
447
446
}
@@ -510,7 +509,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
510
509
}
511
510
}
512
511
concrete_ty. visit_with ( & mut ConstrainOpaqueTypeRegionVisitor {
513
- infcx : self ,
514
512
op : |r| self . sub_regions ( infer:: CallReturn ( span) , least_region, r) ,
515
513
} ) ;
516
514
}
@@ -545,7 +543,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
545
543
) ;
546
544
547
545
concrete_ty. visit_with ( & mut ConstrainOpaqueTypeRegionVisitor {
548
- infcx : self ,
549
546
op : |r| {
550
547
self . member_constraint (
551
548
opaque_type_def_id,
@@ -686,12 +683,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
686
683
//
687
684
// We ignore any type parameters because impl trait values are assumed to
688
685
// capture all the in-scope type parameters.
689
- struct ConstrainOpaqueTypeRegionVisitor < ' cx , ' tcx , OP > {
690
- infcx : & ' cx InferCtxt < ' cx , ' tcx > ,
686
+ struct ConstrainOpaqueTypeRegionVisitor < OP > {
691
687
op : OP ,
692
688
}
693
689
694
- impl < ' cx , ' tcx , OP > TypeVisitor < ' tcx > for ConstrainOpaqueTypeRegionVisitor < ' cx , ' tcx , OP >
690
+ impl < ' tcx , OP > TypeVisitor < ' tcx > for ConstrainOpaqueTypeRegionVisitor < OP >
695
691
where
696
692
OP : FnMut ( ty:: Region < ' tcx > ) ,
697
693
{
@@ -721,36 +717,28 @@ where
721
717
ty:: Closure ( _, ref substs) => {
722
718
// Skip lifetime parameters of the enclosing item(s)
723
719
724
- let ty = self . infcx . shallow_resolve ( substs. as_closure ( ) . tupled_upvars_ty ( ) ) ;
725
- if let ty:: Infer ( ty:: TyVar ( _) ) = ty. kind ( ) {
726
- // Not yet resolved.
727
- ty. super_visit_with ( self ) ;
728
- } else {
729
- for upvar_ty in substs. as_closure ( ) . upvar_tys ( ) {
730
- upvar_ty. visit_with ( self ) ;
731
- }
720
+ substs. as_closure ( ) . tupled_upvars_ty ( ) . visit_with ( self ) ;
732
721
733
- substs. as_closure ( ) . sig_as_fn_ptr_ty ( ) . visit_with ( self ) ;
722
+ for upvar_ty in substs. as_closure ( ) . upvar_tys ( ) {
723
+ upvar_ty. visit_with ( self ) ;
734
724
}
725
+
726
+ substs. as_closure ( ) . sig_as_fn_ptr_ty ( ) . visit_with ( self ) ;
735
727
}
736
728
737
729
ty:: Generator ( _, ref substs, _) => {
738
730
// Skip lifetime parameters of the enclosing item(s)
739
731
// Also skip the witness type, because that has no free regions.
740
732
741
- let ty = self . infcx . shallow_resolve ( substs. as_generator ( ) . tupled_upvars_ty ( ) ) ;
742
- if let ty:: Infer ( ty:: TyVar ( _) ) = ty. kind ( ) {
743
- // Not yet resolved.
744
- ty. super_visit_with ( self ) ;
745
- } else {
746
- for upvar_ty in substs. as_generator ( ) . upvar_tys ( ) {
747
- upvar_ty. visit_with ( self ) ;
748
- }
733
+ substs. as_generator ( ) . tupled_upvars_ty ( ) . visit_with ( self ) ;
749
734
750
- substs. as_generator ( ) . return_ty ( ) . visit_with ( self ) ;
751
- substs. as_generator ( ) . yield_ty ( ) . visit_with ( self ) ;
752
- substs. as_generator ( ) . resume_ty ( ) . visit_with ( self ) ;
735
+ for upvar_ty in substs. as_generator ( ) . upvar_tys ( ) {
736
+ upvar_ty. visit_with ( self ) ;
753
737
}
738
+
739
+ substs. as_generator ( ) . return_ty ( ) . visit_with ( self ) ;
740
+ substs. as_generator ( ) . yield_ty ( ) . visit_with ( self ) ;
741
+ substs. as_generator ( ) . resume_ty ( ) . visit_with ( self ) ;
754
742
}
755
743
_ => {
756
744
ty. super_visit_with ( self ) ;
0 commit comments