@@ -176,13 +176,8 @@ pub trait Visitor<'ast>: Sized {
176
176
fn visit_lifetime ( & mut self , lifetime : & ' ast Lifetime ) {
177
177
walk_lifetime ( self , lifetime)
178
178
}
179
- fn visit_mac ( & mut self , _mac : & ' ast MacCall ) {
180
- panic ! ( "visit_mac disabled by default" ) ;
181
- // N.B., see note about macros above.
182
- // if you really want a visitor that
183
- // works on macros, use this
184
- // definition in your trait impl:
185
- // visit::walk_mac(self, _mac)
179
+ fn visit_mac_call ( & mut self , mac : & ' ast MacCall ) {
180
+ walk_mac ( self , mac)
186
181
}
187
182
fn visit_mac_def ( & mut self , _mac : & ' ast MacroDef , _id : NodeId ) {
188
183
// Nothing to do
@@ -346,7 +341,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
346
341
visitor. visit_generics ( generics) ;
347
342
walk_list ! ( visitor, visit_param_bound, bounds) ;
348
343
}
349
- ItemKind :: MacCall ( ref mac) => visitor. visit_mac ( mac) ,
344
+ ItemKind :: MacCall ( ref mac) => visitor. visit_mac_call ( mac) ,
350
345
ItemKind :: MacroDef ( ref ts) => visitor. visit_mac_def ( ts, item. id ) ,
351
346
}
352
347
walk_list ! ( visitor, visit_attribute, & item. attrs) ;
@@ -414,7 +409,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
414
409
}
415
410
TyKind :: Typeof ( ref expression) => visitor. visit_anon_const ( expression) ,
416
411
TyKind :: Infer | TyKind :: ImplicitSelf | TyKind :: Err => { }
417
- TyKind :: MacCall ( ref mac) => visitor. visit_mac ( mac) ,
412
+ TyKind :: MacCall ( ref mac) => visitor. visit_mac_call ( mac) ,
418
413
TyKind :: Never | TyKind :: CVarArgs => { }
419
414
}
420
415
}
@@ -532,7 +527,7 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) {
532
527
PatKind :: Tuple ( ref elems) | PatKind :: Slice ( ref elems) | PatKind :: Or ( ref elems) => {
533
528
walk_list ! ( visitor, visit_pat, elems) ;
534
529
}
535
- PatKind :: MacCall ( ref mac) => visitor. visit_mac ( mac) ,
530
+ PatKind :: MacCall ( ref mac) => visitor. visit_mac_call ( mac) ,
536
531
}
537
532
}
538
533
@@ -557,7 +552,7 @@ pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a ForeignI
557
552
walk_list ! ( visitor, visit_ty, ty) ;
558
553
}
559
554
ForeignItemKind :: MacCall ( mac) => {
560
- visitor. visit_mac ( mac) ;
555
+ visitor. visit_mac_call ( mac) ;
561
556
}
562
557
}
563
558
}
@@ -662,7 +657,7 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem,
662
657
walk_list ! ( visitor, visit_ty, ty) ;
663
658
}
664
659
AssocItemKind :: MacCall ( mac) => {
665
- visitor. visit_mac ( mac) ;
660
+ visitor. visit_mac_call ( mac) ;
666
661
}
667
662
}
668
663
}
@@ -692,7 +687,7 @@ pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) {
692
687
StmtKind :: Empty => { }
693
688
StmtKind :: MacCall ( ref mac) => {
694
689
let MacCallStmt { ref mac, style : _, ref attrs } = * * mac;
695
- visitor. visit_mac ( mac) ;
690
+ visitor. visit_mac_call ( mac) ;
696
691
for attr in attrs. iter ( ) {
697
692
visitor. visit_attribute ( attr) ;
698
693
}
@@ -823,7 +818,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
823
818
ExprKind :: Ret ( ref optional_expression) => {
824
819
walk_list ! ( visitor, visit_expr, optional_expression) ;
825
820
}
826
- ExprKind :: MacCall ( ref mac) => visitor. visit_mac ( mac) ,
821
+ ExprKind :: MacCall ( ref mac) => visitor. visit_mac_call ( mac) ,
827
822
ExprKind :: Paren ( ref subexpression) => visitor. visit_expr ( subexpression) ,
828
823
ExprKind :: InlineAsm ( ref ia) => {
829
824
for ( op, _) in & ia. operands {
0 commit comments