diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-01-25 17:39:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-25 17:39:29 +0100 |
| commit | f7d3a45bb2c16b4b5a5a2a4170e764c1f45a6f94 (patch) | |
| tree | 7a4835c4a970146fc64ac66a993a46ff0cc6ca64 | |
| parent | 8750bec42a79e90b224fa98162731a02828aa893 (diff) | |
| parent | bdc9ce0d95a26eeec987d95c02c43616cf4227c1 (diff) | |
| download | rust-f7d3a45bb2c16b4b5a5a2a4170e764c1f45a6f94.tar.gz rust-f7d3a45bb2c16b4b5a5a2a4170e764c1f45a6f94.zip | |
Rollup merge of #120316 - GuillaumeGomez:fix-ast-visitor, r=compiler-errors
Don't call `walk_` functions directly if there is an equivalent `visit_` method I was working on https://github.com/rust-lang/rust/issues/77773 and realized in one of my experiments that the `visit_path` method was not always called whereas it should have. This fixes it. r? ``@davidtwco``
| -rw-r--r-- | compiler/rustc_ast/src/visit.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 89f50d3a0a7..8d084ee29a7 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -375,11 +375,11 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { } ItemKind::MacCall(mac) => visitor.visit_mac_call(mac), ItemKind::MacroDef(ts) => visitor.visit_mac_def(ts, item.id), - ItemKind::Delegation(box Delegation { id: _, qself, path, body }) => { + ItemKind::Delegation(box Delegation { id, qself, path, body }) => { if let Some(qself) = qself { visitor.visit_ty(&qself.ty); } - walk_path(visitor, path); + visitor.visit_path(path, *id); if let Some(body) = body { visitor.visit_block(body); } @@ -502,7 +502,7 @@ where } GenericArgs::Parenthesized(data) => { walk_list!(visitor, visit_ty, &data.inputs); - walk_fn_ret_ty(visitor, &data.output); + visitor.visit_fn_ret_ty(&data.output); } } } @@ -713,11 +713,11 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem, AssocItemKind::MacCall(mac) => { visitor.visit_mac_call(mac); } - AssocItemKind::Delegation(box Delegation { id: _, qself, path, body }) => { + AssocItemKind::Delegation(box Delegation { id, qself, path, body }) => { if let Some(qself) = qself { visitor.visit_ty(&qself.ty); } - walk_path(visitor, path); + visitor.visit_path(path, *id); if let Some(body) = body { visitor.visit_block(body); } |
