Skip to content

Commit 56c3aa6

Browse files
committed
Unify walk_label
1 parent 6976e9e commit 56c3aa6

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

compiler/rustc_ast/src/visitors.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,15 @@ macro_rules! make_ast_visitor {
364364
try_v!(visit_span!(vis, span));
365365
return_result!(V)
366366
}
367+
368+
pub fn walk_label<$($lt,)? V: $trait$(<$lt>)?>(
369+
vis: &mut V,
370+
label: ref_t!(Label)
371+
) -> result!(V) {
372+
let Label { ident } = label;
373+
try_v!(vis.visit_ident(ident));
374+
return_result!(V)
375+
}
367376
}
368377
}
369378

@@ -509,13 +518,6 @@ pub mod visit {
509518
V::Result::output()
510519
}
511520

512-
pub fn walk_label<'a, V: Visitor<'a>>(
513-
visitor: &mut V,
514-
Label { ident }: &'a Label,
515-
) -> V::Result {
516-
visitor.visit_ident(ident)
517-
}
518-
519521
pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime) -> V::Result {
520522
let Lifetime { id: _, ident } = lifetime;
521523
visitor.visit_ident(ident)
@@ -2140,10 +2142,6 @@ pub mod mut_visit {
21402142
smallvec![param]
21412143
}
21422144

2143-
fn walk_label<T: MutVisitor>(vis: &mut T, Label { ident }: &mut Label) {
2144-
vis.visit_ident(ident);
2145-
}
2146-
21472145
fn walk_lifetime<T: MutVisitor>(vis: &mut T, Lifetime { id, ident }: &mut Lifetime) {
21482146
vis.visit_id(id);
21492147
vis.visit_ident(ident);

0 commit comments

Comments
 (0)