@@ -61,7 +61,17 @@ pub fn generics_of_fn(fk: &FnKind) -> Generics {
61
61
}
62
62
}
63
63
64
+ /// Each method of the Visitor trait is a hook to be potentially
65
+ /// overriden. Each method's default implementation recursively visits
66
+ /// the substructure of the input via the corresponding `walk` method;
67
+ /// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
68
+ ///
69
+ /// If you want to ensure that your code handles every variant
70
+ /// explicitly, you need to override each method. (And you also need
71
+ /// to monitor future changes to `Visitor` in case a new method with a
72
+ /// new default implementation gets introduced.)
64
73
pub trait Visitor < E : Clone > {
74
+
65
75
fn visit_ident ( & mut self , _sp : Span , _ident : Ident , _e : E ) {
66
76
/*! Visit the idents */
67
77
}
@@ -179,9 +189,9 @@ pub fn walk_local<E: Clone, V: Visitor<E>>(visitor: &mut V, local: &Local, env:
179
189
}
180
190
}
181
191
182
- fn walk_explicit_self < E : Clone , V : Visitor < E > > ( visitor : & mut V ,
183
- explicit_self : & ExplicitSelf ,
184
- env : E ) {
192
+ pub fn walk_explicit_self < E : Clone , V : Visitor < E > > ( visitor : & mut V ,
193
+ explicit_self : & ExplicitSelf ,
194
+ env : E ) {
185
195
match explicit_self. node {
186
196
SelfStatic | SelfValue | SelfUniq => { }
187
197
SelfRegion ( ref lifetime, _) => {
0 commit comments