@@ -695,14 +695,25 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
695
695
} ,
696
696
|this| {
697
697
this. visit_generic_params ( & bare_fn. generic_params , false ) ;
698
- this. resolve_fn_signature (
699
- ty. id ,
700
- None ,
701
- false ,
702
- // We don't need to deal with patterns in parameters, because
703
- // they are not possible for foreign or bodiless functions.
704
- bare_fn. decl . inputs . iter ( ) . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
705
- & bare_fn. decl . output ,
698
+ this. with_lifetime_rib (
699
+ LifetimeRibKind :: AnonymousCreateParameter {
700
+ binder : ty. id ,
701
+ report_in_path : false ,
702
+ } ,
703
+ |this| {
704
+ this. resolve_fn_signature (
705
+ ty. id ,
706
+ false ,
707
+ // We don't need to deal with patterns in parameters, because
708
+ // they are not possible for foreign or bodiless functions.
709
+ bare_fn
710
+ . decl
711
+ . inputs
712
+ . iter ( )
713
+ . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
714
+ & bare_fn. decl . output ,
715
+ )
716
+ } ,
706
717
) ;
707
718
} ,
708
719
)
@@ -782,12 +793,19 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
782
793
| FnKind :: Fn ( _, _, sig, _, generics, None ) => {
783
794
self . visit_fn_header ( & sig. header ) ;
784
795
self . visit_generics ( generics) ;
785
- self . resolve_fn_signature (
786
- fn_id,
787
- None ,
788
- sig. decl . has_self ( ) ,
789
- sig. decl . inputs . iter ( ) . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
790
- & sig. decl . output ,
796
+ self . with_lifetime_rib (
797
+ LifetimeRibKind :: AnonymousCreateParameter {
798
+ binder : fn_id,
799
+ report_in_path : false ,
800
+ } ,
801
+ |this| {
802
+ this. resolve_fn_signature (
803
+ fn_id,
804
+ sig. decl . has_self ( ) ,
805
+ sig. decl . inputs . iter ( ) . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
806
+ & sig. decl . output ,
807
+ )
808
+ } ,
791
809
) ;
792
810
return ;
793
811
}
@@ -812,15 +830,22 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
812
830
let declaration = & sig. decl ;
813
831
let async_node_id = sig. header . asyncness . opt_return_id ( ) ;
814
832
815
- this. resolve_fn_signature (
816
- fn_id,
817
- async_node_id,
818
- declaration. has_self ( ) ,
819
- declaration
820
- . inputs
821
- . iter ( )
822
- . map ( |Param { pat, ty, .. } | ( Some ( & * * pat) , & * * ty) ) ,
823
- & declaration. output ,
833
+ this. with_lifetime_rib (
834
+ LifetimeRibKind :: AnonymousCreateParameter {
835
+ binder : fn_id,
836
+ report_in_path : async_node_id. is_some ( ) ,
837
+ } ,
838
+ |this| {
839
+ this. resolve_fn_signature (
840
+ fn_id,
841
+ declaration. has_self ( ) ,
842
+ declaration
843
+ . inputs
844
+ . iter ( )
845
+ . map ( |Param { pat, ty, .. } | ( Some ( & * * pat) , & * * ty) ) ,
846
+ & declaration. output ,
847
+ )
848
+ } ,
824
849
) ;
825
850
826
851
// Construct the list of in-scope lifetime parameters for async lowering.
@@ -1035,12 +1060,19 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
1035
1060
kind : LifetimeBinderKind :: PolyTrait ,
1036
1061
..
1037
1062
} => {
1038
- self . resolve_fn_signature (
1039
- binder,
1040
- None ,
1041
- false ,
1042
- p_args. inputs . iter ( ) . map ( |ty| ( None , & * * ty) ) ,
1043
- & p_args. output ,
1063
+ self . with_lifetime_rib (
1064
+ LifetimeRibKind :: AnonymousCreateParameter {
1065
+ binder,
1066
+ report_in_path : false ,
1067
+ } ,
1068
+ |this| {
1069
+ this. resolve_fn_signature (
1070
+ binder,
1071
+ false ,
1072
+ p_args. inputs . iter ( ) . map ( |ty| ( None , & * * ty) ) ,
1073
+ & p_args. output ,
1074
+ )
1075
+ } ,
1044
1076
) ;
1045
1077
break ;
1046
1078
}
@@ -1813,18 +1845,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1813
1845
fn resolve_fn_signature (
1814
1846
& mut self ,
1815
1847
fn_id : NodeId ,
1816
- async_node_id : Option < NodeId > ,
1817
1848
has_self : bool ,
1818
1849
inputs : impl Iterator < Item = ( Option < & ' ast Pat > , & ' ast Ty ) > + Clone ,
1819
1850
output_ty : & ' ast FnRetTy ,
1820
1851
) {
1821
1852
// Add each argument to the rib.
1822
- let parameter_rib = LifetimeRibKind :: AnonymousCreateParameter {
1823
- binder : fn_id,
1824
- report_in_path : async_node_id. is_some ( ) ,
1825
- } ;
1826
- let elision_lifetime =
1827
- self . with_lifetime_rib ( parameter_rib, |this| this. resolve_fn_params ( has_self, inputs) ) ;
1853
+ let elision_lifetime = self . resolve_fn_params ( has_self, inputs) ;
1828
1854
debug ! ( ?elision_lifetime) ;
1829
1855
1830
1856
let outer_failures = take ( & mut self . diagnostic_metadata . current_elision_failures ) ;
0 commit comments