Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 09c2684

Browse files
committed
Add Visitor::visit_fn_decl
1 parent a8e75c5 commit 09c2684

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/rustc_ast/src/visit.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ pub trait Visitor<'ast>: Sized {
299299
fn visit_coroutine_kind(&mut self, _coroutine_kind: &'ast CoroutineKind) -> Self::Result {
300300
Self::Result::output()
301301
}
302+
fn visit_fn_decl(&mut self, fn_decl: &'ast FnDecl) -> Self::Result {
303+
walk_fn_decl(self, fn_decl)
304+
}
302305
}
303306

304307
pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) -> V::Result {
@@ -518,7 +521,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) -> V::Result {
518521
let BareFnTy { safety: _, ext: _, generic_params, decl, decl_span: _ } =
519522
&**function_declaration;
520523
walk_list!(visitor, visit_generic_param, generic_params);
521-
try_visit!(walk_fn_decl(visitor, decl));
524+
try_visit!(visitor.visit_fn_decl(decl));
522525
}
523526
TyKind::Path(maybe_qself, path) => {
524527
try_visit!(walk_qself(visitor, maybe_qself));
@@ -846,13 +849,13 @@ pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>) -> V::Resu
846849
// Identifier and visibility are visited as a part of the item.
847850
try_visit!(visitor.visit_fn_header(header));
848851
try_visit!(visitor.visit_generics(generics));
849-
try_visit!(walk_fn_decl(visitor, decl));
852+
try_visit!(visitor.visit_fn_decl(decl));
850853
visit_opt!(visitor, visit_block, body);
851854
}
852855
FnKind::Closure(binder, coroutine_kind, decl, body) => {
853856
try_visit!(visitor.visit_closure_binder(binder));
854857
visit_opt!(visitor, visit_coroutine_kind, coroutine_kind.as_ref());
855-
try_visit!(walk_fn_decl(visitor, decl));
858+
try_visit!(visitor.visit_fn_decl(decl));
856859
try_visit!(visitor.visit_expr(body));
857860
}
858861
}

0 commit comments

Comments
 (0)