diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-11-15 23:38:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-15 23:38:10 +0100 |
| commit | 325bc6c201eac2167eda1c21cd730e521d5a0274 (patch) | |
| tree | b94d39021bdd7b9fba372dc6eaef89bb17ff61c6 /compiler/rustc_ast/src/visit.rs | |
| parent | 1f83a4de1f41d407c753fa2a08d8c106ab29b691 (diff) | |
| parent | a7ac8bfc22b441004bfb96311677ea807f3a5613 (diff) | |
| download | rust-325bc6c201eac2167eda1c21cd730e521d5a0274.tar.gz rust-325bc6c201eac2167eda1c21cd730e521d5a0274.zip | |
Rollup merge of #132956 - maxcabrajac:coroutine_kind, r=petrochenkov
Add visit_coroutine_kind to ast::Visitor r? ``@petrochenkov`` related to #128974
Diffstat (limited to 'compiler/rustc_ast/src/visit.rs')
| -rw-r--r-- | compiler/rustc_ast/src/visit.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 58497d70a24..ef6f126f54c 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -268,8 +268,8 @@ pub trait Visitor<'ast>: Sized { fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FnRetTy) -> Self::Result { walk_fn_ret_ty(self, ret_ty) } - fn visit_fn_header(&mut self, _header: &'ast FnHeader) -> Self::Result { - Self::Result::output() + fn visit_fn_header(&mut self, header: &'ast FnHeader) -> Self::Result { + walk_fn_header(self, header) } fn visit_expr_field(&mut self, f: &'ast ExprField) -> Self::Result { walk_expr_field(self, f) @@ -292,6 +292,9 @@ pub trait Visitor<'ast>: Sized { fn visit_capture_by(&mut self, _capture_by: &'ast CaptureBy) -> Self::Result { Self::Result::output() } + fn visit_coroutine_kind(&mut self, _coroutine_kind: &'ast CoroutineKind) -> Self::Result { + Self::Result::output() + } } pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) -> V::Result { @@ -813,6 +816,12 @@ pub fn walk_fn_ret_ty<'a, V: Visitor<'a>>(visitor: &mut V, ret_ty: &'a FnRetTy) V::Result::output() } +pub fn walk_fn_header<'a, V: Visitor<'a>>(visitor: &mut V, fn_header: &'a FnHeader) -> V::Result { + let FnHeader { safety: _, coroutine_kind, constness: _, ext: _ } = fn_header; + visit_opt!(visitor, visit_coroutine_kind, coroutine_kind.as_ref()); + V::Result::output() +} + pub fn walk_fn_decl<'a, V: Visitor<'a>>( visitor: &mut V, FnDecl { inputs, output }: &'a FnDecl, @@ -830,8 +839,9 @@ pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>) -> V::Resu try_visit!(walk_fn_decl(visitor, decl)); visit_opt!(visitor, visit_block, body); } - FnKind::Closure(binder, _coroutine_kind, decl, body) => { + FnKind::Closure(binder, coroutine_kind, decl, body) => { try_visit!(visitor.visit_closure_binder(binder)); + visit_opt!(visitor, visit_coroutine_kind, coroutine_kind.as_ref()); try_visit!(walk_fn_decl(visitor, decl)); try_visit!(visitor.visit_expr(body)); } |
