Skip to content

Commit 7517a4f

Browse files
committed
ast: Visit item components in "natural" order
1 parent 5be9fdd commit 7517a4f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/rustc_ast/src/mut_visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1248,11 +1248,11 @@ pub fn noop_flat_map_item<K: NoopVisitItemKind>(
12481248
visitor: &mut impl MutVisitor,
12491249
) -> SmallVec<[P<Item<K>>; 1]> {
12501250
let Item { ident, attrs, id, kind, vis, span, tokens } = item.deref_mut();
1251-
visitor.visit_ident(ident);
1252-
visit_attrs(attrs, visitor);
12531251
visitor.visit_id(id);
1254-
kind.noop_visit(visitor);
1252+
visit_attrs(attrs, visitor);
12551253
visitor.visit_vis(vis);
1254+
visitor.visit_ident(ident);
1255+
kind.noop_visit(visitor);
12561256
visitor.visit_span(span);
12571257
visit_lazy_tts(tokens, visitor);
12581258
smallvec![item]

compiler/rustc_ast/src/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -826,9 +826,9 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(
826826
ctxt: AssocCtxt,
827827
) -> V::Result {
828828
let &Item { id: _, span: _, ident, ref vis, ref attrs, ref kind, tokens: _ } = item;
829+
walk_list!(visitor, visit_attribute, attrs);
829830
try_visit!(visitor.visit_vis(vis));
830831
try_visit!(visitor.visit_ident(ident));
831-
walk_list!(visitor, visit_attribute, attrs);
832832
try_visit!(kind.walk(item, ctxt, visitor));
833833
V::Result::output()
834834
}

0 commit comments

Comments
 (0)