Skip to content

Commit

Permalink
Unrolled build for rust-lang#120316
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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 rust-lang#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``
  • Loading branch information
rust-timer committed Jan 26, 2024
2 parents 5bd5d21 + bdc9ce0 commit 4ff2132
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 4ff2132

Please sign in to comment.