@@ -425,14 +425,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> {
425
425
self . label_ribs . push ( Rib :: new ( rib_kind) ) ;
426
426
427
427
// Add each argument to the rib.
428
- let mut bindings_list = FxHashMap :: default ( ) ;
429
- for argument in & declaration. inputs {
430
- self . resolve_pattern ( & argument. pat , PatternSource :: FnParam , & mut bindings_list) ;
431
-
432
- self . visit_ty ( & argument. ty ) ;
428
+ self . resolve_params ( & declaration. inputs ) ;
433
429
434
- debug ! ( "(resolving function) recorded argument" ) ;
435
- }
436
430
visit:: walk_fn_ret_ty ( self , & declaration. output ) ;
437
431
438
432
// Resolve the function body, potentially inside the body of an async closure
@@ -1135,6 +1129,15 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1135
1129
}
1136
1130
}
1137
1131
1132
+ fn resolve_params ( & mut self , params : & [ Arg ] ) {
1133
+ let mut bindings_list = FxHashMap :: default ( ) ;
1134
+ for param in params {
1135
+ self . resolve_pattern ( & param. pat , PatternSource :: FnParam , & mut bindings_list) ;
1136
+ self . visit_ty ( & param. ty ) ;
1137
+ debug ! ( "(resolving function / closure) recorded parameter" ) ;
1138
+ }
1139
+ }
1140
+
1138
1141
fn resolve_local ( & mut self , local : & Local ) {
1139
1142
// Resolve the type.
1140
1143
walk_list ! ( self , visit_ty, & local. ty) ;
@@ -1860,20 +1863,12 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1860
1863
// `async |x| ...` gets desugared to `|x| future_from_generator(|| ...)`, so we need to
1861
1864
// resolve the arguments within the proper scopes so that usages of them inside the
1862
1865
// closure are detected as upvars rather than normal closure arg usages.
1863
- ExprKind :: Closure (
1864
- _, IsAsync :: Async { .. } , _,
1865
- ref fn_decl, ref body, _span,
1866
- ) => {
1867
- let rib_kind = NormalRibKind ;
1868
- self . ribs [ ValueNS ] . push ( Rib :: new ( rib_kind) ) ;
1866
+ ExprKind :: Closure ( _, IsAsync :: Async { .. } , _, ref fn_decl, ref body, _span) => {
1867
+ self . ribs [ ValueNS ] . push ( Rib :: new ( NormalRibKind ) ) ;
1869
1868
// Resolve arguments:
1870
- let mut bindings_list = FxHashMap :: default ( ) ;
1871
- for argument in & fn_decl. inputs {
1872
- self . resolve_pattern ( & argument. pat , PatternSource :: FnParam , & mut bindings_list) ;
1873
- self . visit_ty ( & argument. ty ) ;
1874
- }
1875
- // No need to resolve return type-- the outer closure return type is
1876
- // FunctionRetTy::Default
1869
+ self . resolve_params ( & fn_decl. inputs ) ;
1870
+ // No need to resolve return type --
1871
+ // the outer closure return type is `FunctionRetTy::Default`.
1877
1872
1878
1873
// Now resolve the inner closure
1879
1874
{
0 commit comments