@@ -520,9 +520,16 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
520
520
}
521
521
fn visit_fn ( & mut self , fn_kind : FnKind < ' ast > , sp : Span , _: NodeId ) {
522
522
let rib_kind = match fn_kind {
523
- // Bail if there's no body.
524
- FnKind :: Fn ( .., None ) => return visit:: walk_fn ( self , fn_kind, sp) ,
525
- FnKind :: Fn ( FnCtxt :: Free | FnCtxt :: Foreign , ..) => FnItemRibKind ,
523
+ // Bail if the function is foreign, and thus cannot validly have
524
+ // a body, or if there's no body for some other reason.
525
+ FnKind :: Fn ( FnCtxt :: Foreign , _, sig, ..) | FnKind :: Fn ( _, _, sig, .., None ) => {
526
+ // We don't need to deal with patterns in parameters, because
527
+ // they are not possible for foreign or bodiless functions.
528
+ self . visit_fn_header ( & sig. header ) ;
529
+ visit:: walk_fn_decl ( self , & sig. decl ) ;
530
+ return ;
531
+ }
532
+ FnKind :: Fn ( FnCtxt :: Free , ..) => FnItemRibKind ,
526
533
FnKind :: Fn ( FnCtxt :: Assoc ( _) , ..) => NormalRibKind ,
527
534
FnKind :: Closure ( ..) => ClosureOrAsyncRibKind ,
528
535
} ;
0 commit comments