@@ -910,22 +910,15 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
910
910
span,
911
911
|this| {
912
912
this. visit_generic_params ( & fn_ptr. generic_params , false ) ;
913
- this. with_lifetime_rib (
914
- LifetimeRibKind :: AnonymousCreateParameter {
915
- binder : ty. id ,
916
- report_in_path : false ,
917
- } ,
918
- |this| {
919
- this. resolve_fn_signature (
920
- ty. id ,
921
- false ,
922
- // We don't need to deal with patterns in parameters, because
923
- // they are not possible for foreign or bodiless functions.
924
- fn_ptr. decl . inputs . iter ( ) . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
925
- & fn_ptr. decl . output ,
926
- )
927
- } ,
928
- ) ;
913
+ this. resolve_fn_signature (
914
+ ty. id ,
915
+ false ,
916
+ // We don't need to deal with patterns in parameters, because
917
+ // they are not possible for foreign or bodiless functions.
918
+ fn_ptr. decl . inputs . iter ( ) . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
919
+ & fn_ptr. decl . output ,
920
+ false ,
921
+ )
929
922
} ,
930
923
)
931
924
}
@@ -1042,19 +1035,12 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
1042
1035
self . visit_fn_header ( & sig. header ) ;
1043
1036
self . visit_ident ( ident) ;
1044
1037
self . visit_generics ( generics) ;
1045
- self . with_lifetime_rib (
1046
- LifetimeRibKind :: AnonymousCreateParameter {
1047
- binder : fn_id,
1048
- report_in_path : false ,
1049
- } ,
1050
- |this| {
1051
- this. resolve_fn_signature (
1052
- fn_id,
1053
- sig. decl . has_self ( ) ,
1054
- sig. decl . inputs . iter ( ) . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
1055
- & sig. decl . output ,
1056
- ) ;
1057
- } ,
1038
+ self . resolve_fn_signature (
1039
+ fn_id,
1040
+ sig. decl . has_self ( ) ,
1041
+ sig. decl . inputs . iter ( ) . map ( |Param { ty, .. } | ( None , & * * ty) ) ,
1042
+ & sig. decl . output ,
1043
+ false ,
1058
1044
) ;
1059
1045
return ;
1060
1046
}
@@ -1080,22 +1066,15 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
1080
1066
. coroutine_kind
1081
1067
. map ( |coroutine_kind| coroutine_kind. return_id ( ) ) ;
1082
1068
1083
- this. with_lifetime_rib (
1084
- LifetimeRibKind :: AnonymousCreateParameter {
1085
- binder : fn_id,
1086
- report_in_path : coro_node_id. is_some ( ) ,
1087
- } ,
1088
- |this| {
1089
- this. resolve_fn_signature (
1090
- fn_id,
1091
- declaration. has_self ( ) ,
1092
- declaration
1093
- . inputs
1094
- . iter ( )
1095
- . map ( |Param { pat, ty, .. } | ( Some ( & * * pat) , & * * ty) ) ,
1096
- & declaration. output ,
1097
- ) ;
1098
- } ,
1069
+ this. resolve_fn_signature (
1070
+ fn_id,
1071
+ declaration. has_self ( ) ,
1072
+ declaration
1073
+ . inputs
1074
+ . iter ( )
1075
+ . map ( |Param { pat, ty, .. } | ( Some ( & * * pat) , & * * ty) ) ,
1076
+ & declaration. output ,
1077
+ coro_node_id. is_some ( ) ,
1099
1078
) ;
1100
1079
1101
1080
if let Some ( contract) = contract {
@@ -1307,19 +1286,12 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
1307
1286
kind : LifetimeBinderKind :: PolyTrait ,
1308
1287
..
1309
1288
} => {
1310
- self . with_lifetime_rib (
1311
- LifetimeRibKind :: AnonymousCreateParameter {
1312
- binder,
1313
- report_in_path : false ,
1314
- } ,
1315
- |this| {
1316
- this. resolve_fn_signature (
1317
- binder,
1318
- false ,
1319
- p_args. inputs . iter ( ) . map ( |ty| ( None , & * * ty) ) ,
1320
- & p_args. output ,
1321
- )
1322
- } ,
1289
+ self . resolve_fn_signature (
1290
+ binder,
1291
+ false ,
1292
+ p_args. inputs . iter ( ) . map ( |ty| ( None , & * * ty) ) ,
1293
+ & p_args. output ,
1294
+ false ,
1323
1295
) ;
1324
1296
break ;
1325
1297
}
@@ -2236,25 +2208,32 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2236
2208
has_self : bool ,
2237
2209
inputs : impl Iterator < Item = ( Option < & ' ast Pat > , & ' ast Ty ) > + Clone ,
2238
2210
output_ty : & ' ast FnRetTy ,
2211
+ report_elided_lifetimes_in_path : bool ,
2239
2212
) {
2240
- // Add each argument to the rib.
2241
- let elision_lifetime = self . resolve_fn_params ( has_self, inputs) ;
2242
- debug ! ( ?elision_lifetime) ;
2243
-
2244
- let outer_failures = take ( & mut self . diag_metadata . current_elision_failures ) ;
2245
- let output_rib = if let Ok ( res) = elision_lifetime. as_ref ( ) {
2246
- self . r . lifetime_elision_allowed . insert ( fn_id) ;
2247
- LifetimeRibKind :: Elided ( * res)
2248
- } else {
2249
- LifetimeRibKind :: ElisionFailure
2213
+ let rib = LifetimeRibKind :: AnonymousCreateParameter {
2214
+ binder : fn_id,
2215
+ report_in_path : report_elided_lifetimes_in_path,
2250
2216
} ;
2251
- self . with_lifetime_rib ( output_rib, |this| visit:: walk_fn_ret_ty ( this, output_ty) ) ;
2252
- let elision_failures =
2253
- replace ( & mut self . diag_metadata . current_elision_failures , outer_failures) ;
2254
- if !elision_failures. is_empty ( ) {
2255
- let Err ( failure_info) = elision_lifetime else { bug ! ( ) } ;
2256
- self . report_missing_lifetime_specifiers ( elision_failures, Some ( failure_info) ) ;
2257
- }
2217
+ self . with_lifetime_rib ( rib, |this| {
2218
+ // Add each argument to the rib.
2219
+ let elision_lifetime = this. resolve_fn_params ( has_self, inputs) ;
2220
+ debug ! ( ?elision_lifetime) ;
2221
+
2222
+ let outer_failures = take ( & mut this. diag_metadata . current_elision_failures ) ;
2223
+ let output_rib = if let Ok ( res) = elision_lifetime. as_ref ( ) {
2224
+ this. r . lifetime_elision_allowed . insert ( fn_id) ;
2225
+ LifetimeRibKind :: Elided ( * res)
2226
+ } else {
2227
+ LifetimeRibKind :: ElisionFailure
2228
+ } ;
2229
+ this. with_lifetime_rib ( output_rib, |this| visit:: walk_fn_ret_ty ( this, output_ty) ) ;
2230
+ let elision_failures =
2231
+ replace ( & mut this. diag_metadata . current_elision_failures , outer_failures) ;
2232
+ if !elision_failures. is_empty ( ) {
2233
+ let Err ( failure_info) = elision_lifetime else { bug ! ( ) } ;
2234
+ this. report_missing_lifetime_specifiers ( elision_failures, Some ( failure_info) ) ;
2235
+ }
2236
+ } ) ;
2258
2237
}
2259
2238
2260
2239
/// Resolve inside function parameters and parameter types.
0 commit comments