First version of syn_codegen to generate fold/visit/visit_mut implementations
diff --git a/src/fold.rs b/src/fold.rs
deleted file mode 100644
index 394b35b..0000000
--- a/src/fold.rs
+++ /dev/null
@@ -1,1351 +0,0 @@
-// Adapted from libsyntax.
-
-//! A Folder represents an AST->AST fold; it accepts an AST piece,
-//! and returns a piece of the same type.
-
-use super::*;
-
-use delimited::{Delimited, Element};
-
-/// AST->AST fold.
-///
-/// Each method of the Folder trait is a hook to be potentially overridden. Each
-/// method's default implementation recursively visits the substructure of the
-/// input via the `noop_fold` methods, which perform an "identity fold", that
-/// is, they return the same structure that they are given (for example the
-/// `fold_file` method by default calls `fold::noop_fold_file`).
-///
-/// If you want to ensure that your code handles every variant explicitly, you
-/// need to override each method and monitor future changes to `Folder` in case
-/// a new method with a new default implementation gets introduced.
-pub trait Folder {
- // Any additions to this trait should happen in form
- // of a call to a public `noop_*` function that only calls
- // out to the folder again, not other `noop_*` functions.
- //
- // This is a necessary API workaround to the problem of not
- // being able to call out to the super default method
- // in an overridden default method.
-
- fn fold_ident(&mut self, _ident: Ident) -> Ident {
- noop_fold_ident(self, _ident)
- }
- fn fold_derive_input(&mut self, derive_input: DeriveInput) -> DeriveInput {
- noop_fold_derive_input(self, derive_input)
- }
- fn fold_ty(&mut self, ty: Ty) -> Ty {
- noop_fold_ty(self, ty)
- }
- fn fold_generics(&mut self, generics: Generics) -> Generics {
- noop_fold_generics(self, generics)
- }
- fn fold_ty_param_bound(&mut self, bound: TyParamBound) -> TyParamBound {
- noop_fold_ty_param_bound(self, bound)
- }
- fn fold_poly_trait_ref(&mut self, trait_ref: PolyTraitRef) -> PolyTraitRef {
- noop_fold_poly_trait_ref(self, trait_ref)
- }
- fn fold_variant_data(&mut self, data: VariantData) -> VariantData {
- noop_fold_variant_data(self, data)
- }
- fn fold_field(&mut self, field: Field) -> Field {
- noop_fold_field(self, field)
- }
- fn fold_variant(&mut self, variant: Variant) -> Variant {
- noop_fold_variant(self, variant)
- }
- fn fold_lifetime(&mut self, _lifetime: Lifetime) -> Lifetime {
- noop_fold_lifetime(self, _lifetime)
- }
- fn fold_lifetime_def(&mut self, lifetime: LifetimeDef) -> LifetimeDef {
- noop_fold_lifetime_def(self, lifetime)
- }
- fn fold_path(&mut self, path: Path) -> Path {
- noop_fold_path(self, path)
- }
- fn fold_path_segment(&mut self, path_segment: PathSegment) -> PathSegment {
- noop_fold_path_segment(self, path_segment)
- }
- fn fold_path_parameters(&mut self, path_parameters: PathParameters) -> PathParameters {
- noop_fold_path_parameters(self, path_parameters)
- }
- fn fold_assoc_type_binding(&mut self, type_binding: TypeBinding) -> TypeBinding {
- noop_fold_assoc_type_binding(self, type_binding)
- }
- fn fold_attribute(&mut self, _attr: Attribute) -> Attribute {
- noop_fold_attribute(self, _attr)
- }
- fn fold_fn_ret_ty(&mut self, ret_ty: FunctionRetTy) -> FunctionRetTy {
- noop_fold_fn_ret_ty(self, ret_ty)
- }
- fn fold_lit(&mut self, _lit: Lit) -> Lit {
- noop_fold_lit(self, _lit)
- }
- fn fold_expr(&mut self, expr: Expr) -> Expr {
- noop_fold_expr(self, expr)
- }
-
- fn fold_mac(&mut self, mac: Mac) -> Mac {
- noop_fold_mac(self, mac)
- }
-
- #[cfg(feature = "full")]
- fn fold_file(&mut self, file: File) -> File {
- noop_fold_file(self, file)
- }
- #[cfg(feature = "full")]
- fn fold_item(&mut self, item: Item) -> Item {
- noop_fold_item(self, item)
- }
- #[cfg(feature = "full")]
- fn fold_foreign_item(&mut self, foreign_item: ForeignItem) -> ForeignItem {
- noop_fold_foreign_item(self, foreign_item)
- }
- #[cfg(feature = "full")]
- fn fold_pat(&mut self, pat: Pat) -> Pat {
- noop_fold_pat(self, pat)
- }
- #[cfg(feature = "full")]
- fn fold_fn_decl(&mut self, fn_decl: FnDecl) -> FnDecl {
- noop_fold_fn_decl(self, fn_decl)
- }
- #[cfg(feature = "full")]
- fn fold_trait_item(&mut self, trait_item: TraitItem) -> TraitItem {
- noop_fold_trait_item(self, trait_item)
- }
- #[cfg(feature = "full")]
- fn fold_impl_item(&mut self, impl_item: ImplItem) -> ImplItem {
- noop_fold_impl_item(self, impl_item)
- }
- #[cfg(feature = "full")]
- fn fold_method_sig(&mut self, method_sig: MethodSig) -> MethodSig {
- noop_fold_method_sig(self, method_sig)
- }
- #[cfg(feature = "full")]
- fn fold_stmt(&mut self, stmt: Stmt) -> Stmt {
- noop_fold_stmt(self, stmt)
- }
- #[cfg(feature = "full")]
- fn fold_block(&mut self, block: Block) -> Block {
- noop_fold_block(self, block)
- }
- #[cfg(feature = "full")]
- fn fold_local(&mut self, local: Local) -> Local {
- noop_fold_local(self, local)
- }
- #[cfg(feature = "full")]
- fn fold_view_path(&mut self, view_path: ViewPath) -> ViewPath {
- noop_fold_view_path(self, view_path)
- }
-}
-
-trait LiftOnce<T, U> {
- type Output;
- fn lift<F>(self, f: F) -> Self::Output where F: FnOnce(T) -> U;
-}
-
-impl<T, U> LiftOnce<T, U> for Box<T> {
- type Output = Box<U>;
- // Clippy false positive
- // https://github.com/Manishearth/rust-clippy/issues/1478
- #[cfg_attr(feature = "cargo-clippy", allow(boxed_local))]
- fn lift<F>(self, f: F) -> Box<U>
- where F: FnOnce(T) -> U
- {
- Box::new(f(*self))
- }
-}
-
-trait LiftMut<T, U> {
- type Output;
- fn lift<F>(self, f: F) -> Self::Output where F: FnMut(T) -> U;
-}
-
-impl<T, U> LiftMut<T, U> for Vec<T> {
- type Output = Vec<U>;
- fn lift<F>(self, f: F) -> Vec<U>
- where F: FnMut(T) -> U
- {
- self.into_iter().map(f).collect()
- }
-}
-
-impl<T, D, U> LiftMut<T, U> for Delimited<T, D> {
- type Output = Delimited<U, D>;
- fn lift<F>(self, mut f: F) -> Self::Output
- where F: FnMut(T) -> U
- {
- self.into_iter().map(|e| {
- match e {
- Element::Delimited(t, d) => Element::Delimited(f(t), d),
- Element::End(t) => Element::End(f(t))
- }
- }).collect()
- }
-}
-
-pub fn noop_fold_ident<F: ?Sized + Folder>(_: &mut F, _ident: Ident) -> Ident {
- _ident
-}
-
-pub fn noop_fold_derive_input<F: ?Sized + Folder>(folder: &mut F,
- DeriveInput{ ident,
- vis,
- attrs,
- generics,
-body }: DeriveInput) -> DeriveInput{
- use Body::*;
- DeriveInput {
- ident: folder.fold_ident(ident),
- vis: noop_fold_vis(folder, vis),
- attrs: attrs.lift(|a| folder.fold_attribute(a)),
- generics: folder.fold_generics(generics),
- body: match body {
- Enum(data) => {
- Enum(BodyEnum {
- variants: data.variants.lift(move |v| folder.fold_variant(v)),
- ..data
- })
- }
- Struct(data) => {
- Struct(BodyStruct {
- data: folder.fold_variant_data(data.data),
- ..data
- })
- }
- },
- }
-}
-
-pub fn noop_fold_ty<F: ?Sized + Folder>(folder: &mut F, ty: Ty) -> Ty {
- use ty::*;
- use Ty::*;
-
- match ty {
- Slice(t) => {
- Slice(TySlice {
- ty: t.ty.lift(|v| folder.fold_ty(v)),
- ..t
- })
- }
- Group(t) => {
- Group(TyGroup {
- ty: t.ty.lift(|v| folder.fold_ty(v)),
- ..t
- })
- }
- Paren(t) => {
- Paren(TyParen {
- ty: t.ty.lift(|v| folder.fold_ty(v)),
- ..t
- })
- }
- Ptr(t) => {
- let ty = *t.ty;
- let MutTy { ty, mutability } = ty;
- Ptr(TyPtr {
- ty: Box::new(MutTy {
- ty: folder.fold_ty(ty),
- mutability: mutability,
- }),
- ..t
- })
- }
- Rptr(t) => {
- let ty = *t.ty;
- let MutTy { ty, mutability } = ty;
- Rptr(TyRptr {
- lifetime: t.lifetime.map(|l| folder.fold_lifetime(l)),
- ty: Box::new(MutTy {
- ty: folder.fold_ty(ty),
- mutability: mutability,
- }),
- ..t
- })
- }
- Never(t) => Never(t),
- Infer(t) => Infer(t),
- Tup(t) => {
- Tup(TyTup {
- tys: t.tys.lift(|x| folder.fold_ty(x)),
- ..t
- })
- }
- BareFn(t) => {
- let ty = *t.ty;
- BareFn(TyBareFn {
- ty: Box::new(BareFnTy {
- lifetimes: ty.lifetimes.map(|l| {
- noop_fold_bound_lifetimes(folder, l)
- }),
- inputs: ty.inputs.lift(|v| {
- BareFnArg {
- name: v.name.map(|n| {
- (match n.0 {
- BareFnArgName::Named(n) => {
- BareFnArgName::Named(folder.fold_ident(n))
- }
- other => other,
- }, n.1)
- }),
- ty: folder.fold_ty(v.ty),
- }
- }),
- output: folder.fold_fn_ret_ty(ty.output),
- ..ty
- }),
- })
- }
- Path(t) => {
- Path(TyPath {
- qself: t.qself.map(|v| noop_fold_qself(folder, v)),
- path: folder.fold_path(t.path),
- })
- }
- Array(t) => {
- Array(TyArray {
- ty: t.ty.lift(|v| folder.fold_ty(v)),
- amt: folder.fold_expr(t.amt),
- ..t
- })
- }
- TraitObject(t) => {
- TraitObject(TyTraitObject {
- bounds: t.bounds.lift(|v| folder.fold_ty_param_bound(v)),
- })
- }
- ImplTrait(t) => {
- ImplTrait(TyImplTrait {
- bounds: t.bounds.lift(|v| folder.fold_ty_param_bound(v)),
- ..t
- })
- }
- Mac(mac) => Mac(folder.fold_mac(mac)),
- }
-}
-
-#[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))] // clippy lies
-fn noop_fold_qself<F: ?Sized + Folder>(folder: &mut F, qself: QSelf) -> QSelf {
- QSelf {
- ty: Box::new(folder.fold_ty(*(qself.ty))),
- ..qself
- }
-}
-
-pub fn noop_fold_generics<F: ?Sized + Folder>(folder: &mut F,
- generics: Generics)
--> Generics{
- use WherePredicate::*;
- Generics {
- lifetimes: generics.lifetimes.lift(|l| folder.fold_lifetime_def(l)),
- ty_params: generics.ty_params.lift(|ty| {
- TyParam {
- attrs: ty.attrs.lift(|a| folder.fold_attribute(a)),
- ident: folder.fold_ident(ty.ident),
- bounds: ty.bounds.lift(|ty_pb| folder.fold_ty_param_bound(ty_pb)),
- default: ty.default.map(|v| folder.fold_ty(v)),
- ..ty
- }
- }),
- where_clause: WhereClause {
- predicates: generics.where_clause.predicates.lift(|p| {
- match p {
- BoundPredicate(bound_predicate) => {
- BoundPredicate(WhereBoundPredicate {
- bound_lifetimes: bound_predicate.bound_lifetimes
- .map(|l| noop_fold_bound_lifetimes(folder, l)),
- bounded_ty: folder.fold_ty(bound_predicate.bounded_ty),
- bounds: bound_predicate.bounds
- .lift(|ty_pb| folder.fold_ty_param_bound(ty_pb)),
- ..bound_predicate
- })
- }
- RegionPredicate(region_predicate) => {
- RegionPredicate(WhereRegionPredicate {
- lifetime: folder.fold_lifetime(region_predicate.lifetime),
- bounds: region_predicate.bounds
- .lift(|b| folder.fold_lifetime(b)),
- ..region_predicate
- })
- }
- EqPredicate(eq_predicate) => {
- EqPredicate(WhereEqPredicate {
- lhs_ty: folder.fold_ty(eq_predicate.lhs_ty),
- rhs_ty: folder.fold_ty(eq_predicate.rhs_ty),
- ..eq_predicate
- })
- }
- }
- }),
- ..generics.where_clause
- },
- ..generics
- }
-}
-
-pub fn noop_fold_ty_param_bound<F: ?Sized + Folder>(folder: &mut F,
- bound: TyParamBound)
- -> TyParamBound {
- use TyParamBound::*;
- match bound {
- Trait(ty, modifier) => Trait(folder.fold_poly_trait_ref(ty), modifier),
- Region(lifetime) => Region(folder.fold_lifetime(lifetime)),
- }
-}
-
-pub fn noop_fold_poly_trait_ref<F: ?Sized + Folder>(folder: &mut F,
- trait_ref: PolyTraitRef)
- -> PolyTraitRef {
- PolyTraitRef {
- bound_lifetimes: trait_ref.bound_lifetimes.map(|bl| {
- noop_fold_bound_lifetimes(folder, bl)
- }),
- trait_ref: folder.fold_path(trait_ref.trait_ref),
- }
-}
-
-pub fn noop_fold_variant_data<F: ?Sized + Folder>(folder: &mut F,
- data: VariantData)
- -> VariantData {
- use VariantData::*;
- match data {
- Struct(fields, t) => Struct(fields.lift(|f| folder.fold_field(f)), t),
- Tuple(fields, t) => Tuple(fields.lift(|f| folder.fold_field(f)), t),
- Unit => Unit,
- }
-}
-
-pub fn noop_fold_field<F: ?Sized + Folder>(folder: &mut F, field: Field) -> Field {
- Field {
- ident: field.ident.map(|i| folder.fold_ident(i)),
- vis: noop_fold_vis(folder, field.vis),
- attrs: field.attrs.lift(|a| folder.fold_attribute(a)),
- ty: folder.fold_ty(field.ty),
- ..field
- }
-}
-
-pub fn noop_fold_variant<F: ?Sized + Folder>(folder: &mut F,
- variant: Variant)
- -> Variant
-{
- Variant {
- ident: folder.fold_ident(variant.ident),
- attrs: variant.attrs.lift(|v| folder.fold_attribute(v)),
- data: folder.fold_variant_data(variant.data),
- discriminant: variant.discriminant.map(|ce| folder.fold_expr(ce)),
- ..variant
- }
-}
-
-pub fn noop_fold_lifetime<F: ?Sized + Folder>(_: &mut F, _lifetime: Lifetime) -> Lifetime {
- _lifetime
-}
-
-pub fn noop_fold_bound_lifetimes<F: ?Sized + Folder>(folder: &mut F,
- b: BoundLifetimes)
- -> BoundLifetimes
-{
- BoundLifetimes {
- lifetimes: b.lifetimes.lift(|l| folder.fold_lifetime_def(l)),
- ..b
- }
-}
-
-pub fn noop_fold_lifetime_def<F: ?Sized + Folder>(folder: &mut F,
- def: LifetimeDef)
- -> LifetimeDef
-{
- LifetimeDef {
- attrs: def.attrs.lift(|x| folder.fold_attribute(x)),
- lifetime: folder.fold_lifetime(def.lifetime),
- bounds: def.bounds.lift(|l| folder.fold_lifetime(l)),
- ..def
- }
-}
-
-pub fn noop_fold_path<F: ?Sized + Folder>(folder: &mut F, path: Path) -> Path {
- Path {
- segments: path.segments.lift(|s| folder.fold_path_segment(s)),
- ..path
- }
-}
-
-pub fn noop_fold_path_segment<F: ?Sized + Folder>(folder: &mut F,
- seg: PathSegment)
- -> PathSegment {
- PathSegment {
- ident: folder.fold_ident(seg.ident),
- parameters: folder.fold_path_parameters(seg.parameters),
- }
-}
-
-pub fn noop_fold_path_parameters<F: ?Sized + Folder>(folder: &mut F,
- path_parameters: PathParameters)
- -> PathParameters {
- use PathParameters::*;
- match path_parameters {
- None => None,
- AngleBracketed(d) => {
- AngleBracketed(AngleBracketedParameterData {
- lifetimes: d.lifetimes.lift(|l| folder.fold_lifetime(l)),
- types: d.types.lift(|ty| folder.fold_ty(ty)),
- bindings: d.bindings.lift(|tb| folder.fold_assoc_type_binding(tb)),
- ..d
- })
- }
- Parenthesized(d) => {
- Parenthesized(ParenthesizedParameterData {
- inputs: d.inputs.lift(|i| folder.fold_ty(i)),
- output: folder.fold_fn_ret_ty(d.output),
- ..d
- })
- }
- }
-}
-
-pub fn noop_fold_assoc_type_binding<F: ?Sized + Folder>(folder: &mut F,
- binding: TypeBinding)
- -> TypeBinding
-{
- TypeBinding {
- ident: folder.fold_ident(binding.ident),
- ty: folder.fold_ty(binding.ty),
- ..binding
- }
-}
-
-pub fn noop_fold_attribute<F: ?Sized + Folder>(_: &mut F, attr: Attribute) -> Attribute {
- attr
-}
-
-pub fn noop_fold_fn_ret_ty<F: ?Sized + Folder>(folder: &mut F,
- ret_ty: FunctionRetTy)
- -> FunctionRetTy {
- use FunctionRetTy::*;
- match ret_ty {
- Default => Default,
- Ty(ty, t) => Ty(folder.fold_ty(ty), t),
- }
-}
-
-pub fn noop_fold_lit<F: ?Sized + Folder>(_: &mut F, _lit: Lit) -> Lit {
- _lit
-}
-
-pub fn noop_fold_tt<F: ?Sized + Folder>(folder: &mut F, tt: TokenTree) -> TokenTree {
- use proc_macro2::{TokenNode, TokenTree as TokenTree2};
- match tt.0.kind {
- TokenNode::Term(sym) => {
- // XXX: Do we want to fold over idents
- TokenTree(TokenTree2 {
- span: tt.0.span,
- kind: TokenNode::Term(sym),
- })
- }
- TokenNode::Op(..) => tt,
- TokenNode::Literal(lit) => {
- folder.fold_lit(Lit {
- value: LitKind::Other(lit),
- span: Span(tt.0.span),
- }).into_token_tree()
- }
- TokenNode::Group(delim, stream) => {
- let stream = stream.into_iter().map(|tt| {
- noop_fold_tt(folder, TokenTree(tt)).0
- }).collect();
- TokenTree(TokenTree2 {
- span: tt.0.span,
- kind: TokenNode::Group(delim, stream),
- })
- }
- }
-}
-
-pub fn noop_fold_mac<F: ?Sized + Folder>(folder: &mut F, mac: Mac) -> Mac {
- Mac {
- path: folder.fold_path(mac.path),
- tokens: mac.tokens.lift(|tt| noop_fold_tt(folder, tt)),
- ..mac
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_file<F: ?Sized + Folder>(folder: &mut F,
- file: File)
- -> File {
- File {
- attrs: file.attrs.lift(|a| folder.fold_attribute(a)),
- items: file.items.lift(|i| folder.fold_item(i)),
- ..file
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_block<F: ?Sized + Folder>(folder: &mut F, block: Block) -> Block {
- Block {
- stmts: block.stmts.lift(|s| folder.fold_stmt(s)),
- ..block
- }
-}
-
-fn noop_fold_vis<F: ?Sized + Folder>(folder: &mut F, vis: Visibility) -> Visibility {
- use Visibility::*;
- match vis {
- Crate(t) => Crate(t),
- Inherited(i) => Inherited(i),
- Public(p) => Public(p),
- Restricted(data) => {
- Restricted(VisRestricted {
- path: data.path.lift(|p| folder.fold_path(p)),
- ..data
- })
- }
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_item<F: ?Sized + Folder>(folder: &mut F,
- Item { attrs, node }: Item)
- -> Item {
- use item::*;
- use ItemKind::*;
- Item {
- attrs: attrs.lift(|a| folder.fold_attribute(a)),
- node: match node {
- ExternCrate(i) => {
- ExternCrate(ItemExternCrate {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- rename: i.rename.map(|(_as, id)| (_as, folder.fold_ident(id))),
- ..i
- })
- }
- Use(i) => {
- Use(ItemUse {
- vis: noop_fold_vis(folder, i.vis),
- path: Box::new(folder.fold_view_path(*i.path)),
- ..i
- })
- }
- Static(i) => {
- Static(ItemStatic {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- ty: Box::new(folder.fold_ty(*i.ty)),
- expr: i.expr.lift(|e| folder.fold_expr(e)),
- ..i
- })
- }
- Const(i) => {
- Const(ItemConst {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- ty: i.ty.lift(|ty| folder.fold_ty(ty)),
- expr: i.expr.lift(|e| folder.fold_expr(e)),
- ..i
- })
- }
- Fn(i) => {
- Fn(ItemFn {
- vis: noop_fold_vis(folder, i.vis),
- decl: i.decl.lift(|v| folder.fold_fn_decl(v)),
- block: i.block.lift(|v| folder.fold_block(v)),
- ..i
- })
- }
- Mod(i) => {
- Mod(ItemMod {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- content: i.content.map(|(brace, items)| {
- (brace, items.lift(|i| folder.fold_item(i)))
- }),
- ..i
- })
- }
- ForeignMod(i) => {
- ForeignMod(ItemForeignMod {
- items: i.items.lift(|foreign_item| {
- folder.fold_foreign_item(foreign_item)
- }),
- ..i
- })
- }
- Ty(i) => {
- Ty(ItemTy {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- ty: i.ty.lift(|ty| folder.fold_ty(ty)),
- generics: folder.fold_generics(i.generics),
- ..i
- })
- }
- Enum(i) => {
- Enum(ItemEnum {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- variants: i.variants.lift(|v| folder.fold_variant(v)),
- generics: folder.fold_generics(i.generics),
- ..i
- })
- }
- Struct(i) => {
- Struct(ItemStruct {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- data: folder.fold_variant_data(i.data),
- generics: folder.fold_generics(i.generics),
- ..i
- })
- }
- Union(i) => {
- Union(ItemUnion {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- data: folder.fold_variant_data(i.data),
- generics: folder.fold_generics(i.generics),
- ..i
- })
- }
- Trait(i) => {
- Trait(ItemTrait {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- generics: folder.fold_generics(i.generics),
- supertraits: i.supertraits.lift(|typb| folder.fold_ty_param_bound(typb)),
- items: i.items.lift(|ti| folder.fold_trait_item(ti)),
- ..i
- })
- }
- DefaultImpl(i) => {
- DefaultImpl(ItemDefaultImpl {
- path: folder.fold_path(i.path),
- ..i
- })
- }
- Impl(i) => {
- Impl(ItemImpl {
- generics: folder.fold_generics(i.generics),
- trait_: i.trait_.map(|(polarity, p, _for)|
- (polarity, folder.fold_path(p), _for)),
- self_ty: i.self_ty.lift(|ty| folder.fold_ty(ty)),
- items: i.items.lift(|i| folder.fold_impl_item(i)),
- ..i
- })
- }
- Mac(mac) => Mac(folder.fold_mac(mac)),
- },
- }
-}
-
-pub fn noop_fold_expr<F: ?Sized + Folder>(folder: &mut F, Expr { node, attrs }: Expr) -> Expr {
- use expr::*;
- use expr::ExprKind::*;
-
- Expr {
- node: match node {
- #[cfg(feature = "full")]
- Box(e) => {
- Box(ExprBox {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- InPlace(e) => {
- InPlace(ExprInPlace {
- place: e.place.lift(|e| folder.fold_expr(e)),
- value: e.value.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Array(e) => {
- Array(ExprArray {
- exprs: e.exprs.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- Call(e) => {
- Call(ExprCall {
- func: e.func.lift(|e| folder.fold_expr(e)),
- args: e.args.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- MethodCall(e) => {
- MethodCall(ExprMethodCall {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- method: folder.fold_ident(e.method),
- typarams: e.typarams.lift(|t| folder.fold_ty(t)),
- args: e.args.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Tup(e) => {
- Tup(ExprTup {
- args: e.args.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- Binary(e) => {
- Binary(ExprBinary {
- left: e.left.lift(|e| folder.fold_expr(e)),
- right: e.right.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- Unary(e) => {
- Unary(ExprUnary {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- Lit(lit) => Lit(folder.fold_lit(lit)),
- Cast(e) => {
- Cast(ExprCast {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ty: e.ty.lift(|t| folder.fold_ty(t)),
- ..e
- })
- }
- Type(e) => {
- Type(ExprType {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ty: e.ty.lift(|t| folder.fold_ty(t)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- If(e) => {
- If(ExprIf {
- cond: e.cond.lift(|e| folder.fold_expr(e)),
- if_true: folder.fold_block(e.if_true),
- if_false: e.if_false.map(|v| v.lift(|e| folder.fold_expr(e))),
- ..e
- })
- }
- #[cfg(feature = "full")]
- IfLet(e) => {
- IfLet(ExprIfLet {
- pat: e.pat.lift(|p| folder.fold_pat(p)),
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- if_true: folder.fold_block(e.if_true),
- if_false: e.if_false.map(|v| v.lift(|e| folder.fold_expr(e))),
- ..e
- })
- }
- #[cfg(feature = "full")]
- While(e) => {
- While(ExprWhile {
- cond: e.cond.lift(|e| folder.fold_expr(e)),
- body: folder.fold_block(e.body),
- label: e.label.map(|i| folder.fold_lifetime(i)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- WhileLet(e) => {
- WhileLet(ExprWhileLet {
- pat: e.pat.lift(|p| folder.fold_pat(p)),
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- body: folder.fold_block(e.body),
- label: e.label.map(|i| folder.fold_lifetime(i)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- ForLoop(e) => {
- ForLoop(ExprForLoop {
- pat: e.pat.lift(|p| folder.fold_pat(p)),
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- body: folder.fold_block(e.body),
- label: e.label.map(|i| folder.fold_lifetime(i)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Loop(e) => {
- Loop(ExprLoop {
- body: folder.fold_block(e.body),
- label: e.label.map(|i| folder.fold_lifetime(i)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Match(e) => {
- Match(ExprMatch {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- arms: e.arms.lift(|a: Arm| {
- Arm {
- attrs: a.attrs.lift(|a| folder.fold_attribute(a)),
- pats: a.pats.lift(|p| folder.fold_pat(p)),
- guard: a.guard.map(|v| v.lift(|e| folder.fold_expr(e))),
- body: a.body.lift(|e| folder.fold_expr(e)),
- ..a
- }
- }),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Catch(e) => {
- Catch(ExprCatch {
- block: folder.fold_block(e.block),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Yield(e) => {
- Yield(ExprYield {
- expr: e.expr.map(|e| e.lift(|e| folder.fold_expr(e))),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Closure(e) => {
- Closure(ExprClosure {
- decl: e.decl.lift(|v| folder.fold_fn_decl(v)),
- body: e.body.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Block(e) => {
- Block(ExprBlock {
- block: folder.fold_block(e.block),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Assign(e) => {
- Assign(ExprAssign {
- left: e.left.lift(|e| folder.fold_expr(e)),
- right: e.right.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- AssignOp(e) => {
- AssignOp(ExprAssignOp {
- left: e.left.lift(|e| folder.fold_expr(e)),
- right: e.right.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Field(e) => {
- Field(ExprField {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- field: folder.fold_ident(e.field),
- ..e
- })
- }
- #[cfg(feature = "full")]
- TupField(e) => {
- TupField(ExprTupField {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- Index(e) => {
- Index(ExprIndex {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- index: e.index.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Range(e) => {
- Range(ExprRange {
- from: e.from.map(|v| v.lift(|e| folder.fold_expr(e))),
- to: e.to.map(|v| v.lift(|e| folder.fold_expr(e))),
- ..e
- })
- }
- Path(e) => {
- Path(ExprPath {
- qself: e.qself.map(|v| noop_fold_qself(folder, v)),
- path: folder.fold_path(e.path),
- })
- }
- #[cfg(feature = "full")]
- AddrOf(e) => {
- AddrOf(ExprAddrOf {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Break(e) => {
- Break(ExprBreak {
- label: e.label.map(|i| folder.fold_lifetime(i)),
- expr: e.expr.map(|v| v.lift(|e| folder.fold_expr(e))),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Continue(e) => {
- Continue(ExprContinue {
- label: e.label.map(|i| folder.fold_lifetime(i)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Ret(e) => {
- Ret(ExprRet {
- expr: e.expr.map(|v| v.lift(|e| folder.fold_expr(e))),
- ..e
- })
- }
- Mac(mac) => Mac(folder.fold_mac(mac)),
- #[cfg(feature = "full")]
- Struct(e) => {
- Struct(ExprStruct {
- path: folder.fold_path(e.path),
- fields: e.fields.lift(|field: FieldValue| {
- FieldValue {
- ident: folder.fold_ident(field.ident),
- expr: folder.fold_expr(field.expr),
- attrs: field.attrs.lift(|v| folder.fold_attribute(v)),
- ..field
- }
- }),
- rest: e.rest.map(|v| v.lift(|e| folder.fold_expr(e))),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Repeat(e) => {
- Repeat(ExprRepeat {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- amt: e.amt.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- Paren(e) => {
- Paren(ExprParen {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- Group(e) => {
- Group(ExprGroup {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(feature = "full")]
- Try(e) => {
- Try(ExprTry {
- expr: e.expr.lift(|e| folder.fold_expr(e)),
- ..e
- })
- }
- #[cfg(not(feature = "full"))]
- _ => unreachable!(),
- },
- attrs: attrs.into_iter().map(|a| folder.fold_attribute(a)).collect(),
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_foreign_item<F: ?Sized + Folder>(folder: &mut F,
- item: ForeignItem)
--> ForeignItem{
- use item::*;
-
- ForeignItem {
- ident: folder.fold_ident(item.ident),
- attrs: item.attrs.into_iter().map(|a| folder.fold_attribute(a)).collect(),
- node: match item.node {
- ForeignItemKind::Fn(item) => {
- ForeignItemKind::Fn(ForeignItemFn {
- decl: item.decl.lift(|v| folder.fold_fn_decl(v)),
- })
- }
- ForeignItemKind::Static(item) => {
- ForeignItemKind::Static(ForeignItemStatic {
- ty: item.ty.lift(|v| folder.fold_ty(v)),
- ..item
- })
- }
- },
- vis: noop_fold_vis(folder, item.vis),
- ..item
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_pat<F: ?Sized + Folder>(folder: &mut F, pat: Pat) -> Pat {
- use Pat::*;
- match pat {
- Wild(b) => Wild(b),
- Ident(p) => {
- Ident(PatIdent {
- ident: folder.fold_ident(p.ident),
- subpat: p.subpat.map(|p| p.lift(|p| folder.fold_pat(p))),
- ..p
- })
- }
- Struct(p) => {
- Struct(PatStruct {
- path: folder.fold_path(p.path),
- fields: p.fields.lift(|field: FieldPat| {
- FieldPat {
- ident: folder.fold_ident(field.ident),
- pat: field.pat.lift(|p| folder.fold_pat(p)),
- attrs: field.attrs.lift(|a| folder.fold_attribute(a)),
- ..field
- }
- }),
- ..p
- })
- }
- TupleStruct(p) => {
- TupleStruct(PatTupleStruct {
- path: folder.fold_path(p.path),
- pat: PatTuple {
- pats: p.pat.pats.lift(|p| folder.fold_pat(p)),
- ..p.pat
- },
- })
- }
- Path(p) => {
- Path(PatPath {
- qself: p.qself.map(|v| noop_fold_qself(folder, v)),
- path: folder.fold_path(p.path),
- })
- }
- Tuple(p) => {
- Tuple(PatTuple {
- pats: p.pats.lift(|p| folder.fold_pat(p)),
- ..p
- })
- }
- Box(p) => {
- Box(PatBox {
- pat: p.pat.lift(|p| folder.fold_pat(p)),
- ..p
- })
- }
- Ref(p) => {
- Ref(PatRef {
- pat: p.pat.lift(|p| folder.fold_pat(p)),
- ..p
- })
- }
- Lit(p) => {
- Lit(PatLit {
- expr: p.expr.lift(|e| folder.fold_expr(e)),
- })
- }
- Range(p) => {
- Range(PatRange {
- hi: p.hi.lift(|e| folder.fold_expr(e)),
- lo: p.lo.lift(|e| folder.fold_expr(e)),
- ..p
- })
- }
- Slice(p) => {
- Slice(PatSlice {
- front: p.front.lift(|p| folder.fold_pat(p)),
- middle: p.middle.map(|v| v.lift(|p| folder.fold_pat(p))),
- back: p.back.lift(|p| folder.fold_pat(p)),
- ..p
- })
- }
- Mac(mac) => Mac(folder.fold_mac(mac)),
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_fn_decl<F: ?Sized + Folder>(folder: &mut F, decl: FnDecl)
- -> FnDecl
-{
- FnDecl {
- inputs: decl.inputs.lift(|a| {
- use item::*;
- use FnArg::*;
- match a {
- SelfRef(a) => {
- SelfRef(ArgSelfRef {
- lifetime: a.lifetime.map(|v| folder.fold_lifetime(v)),
- ..a
- })
- }
- SelfValue(a) => SelfValue(a),
- Captured(a) => {
- Captured(ArgCaptured {
- pat: folder.fold_pat(a.pat),
- ty: folder.fold_ty(a.ty),
- ..a
- })
- }
- Ignored(ty) => Ignored(folder.fold_ty(ty)),
- }
- }),
- output: folder.fold_fn_ret_ty(decl.output),
- generics: folder.fold_generics(decl.generics),
- ..decl
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_trait_item<F: ?Sized + Folder>(folder: &mut F,
- item: TraitItem)
- -> TraitItem {
- use item::*;
- use TraitItemKind::*;
- TraitItem {
- attrs: item.attrs.lift(|v| folder.fold_attribute(v)),
- node: match item.node {
- Const(i) => {
- Const(TraitItemConst {
- ident: folder.fold_ident(i.ident),
- ty: folder.fold_ty(i.ty),
- default: i.default.map(|(eq, v)| (eq, folder.fold_expr(v))),
- ..i
- })
- }
- Method(i) => {
- Method(TraitItemMethod {
- sig: folder.fold_method_sig(i.sig),
- default: i.default.map(|v| folder.fold_block(v)),
- ..i
- })
- }
- Type(i) => {
- Type(TraitItemType {
- ident: folder.fold_ident(i.ident),
- bounds: i.bounds.lift(|v| folder.fold_ty_param_bound(v)),
- default: i.default.map(|(eq, v)| (eq, folder.fold_ty(v))),
- ..i
- })
- }
- Macro(mac) => Macro(folder.fold_mac(mac)),
- },
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_impl_item<F: ?Sized + Folder>(folder: &mut F, item: ImplItem)
- -> ImplItem
-{
- use item::*;
- use ImplItemKind::*;
-
- ImplItem {
- attrs: item.attrs.lift(|v| folder.fold_attribute(v)),
- node: match item.node {
- Const(i) => {
- Const(ImplItemConst {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- ty: folder.fold_ty(i.ty),
- expr: folder.fold_expr(i.expr),
- ..i
- })
- }
- Method(i) => {
- Method(ImplItemMethod {
- vis: noop_fold_vis(folder, i.vis),
- sig: folder.fold_method_sig(i.sig),
- block: folder.fold_block(i.block),
- ..i
- })
- }
- Type(i) => {
- Type(ImplItemType {
- vis: noop_fold_vis(folder, i.vis),
- ident: folder.fold_ident(i.ident),
- ty: folder.fold_ty(i.ty),
- ..i
- })
- }
- Macro(mac) => Macro(folder.fold_mac(mac)),
- },
- ..item
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_method_sig<F: ?Sized + Folder>(folder: &mut F, sig: MethodSig)
- -> MethodSig
-{
- MethodSig {
- ident: folder.fold_ident(sig.ident),
- decl: folder.fold_fn_decl(sig.decl),
- ..sig
- }
-
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_stmt<F: ?Sized + Folder>(folder: &mut F, stmt: Stmt) -> Stmt {
- use Stmt::*;
- match stmt {
- Local(local) => Local(local.lift(|l| folder.fold_local(l))),
- Item(item) => Item(item.lift(|v| folder.fold_item(v))),
- Expr(expr) => Expr(expr.lift(|v| folder.fold_expr(v))),
- Semi(expr, t) => Semi(expr.lift(|v| folder.fold_expr(v)), t),
- Mac(mac_stmt) => {
- Mac(mac_stmt.lift(|(mac, style, attrs)| {
- (folder.fold_mac(mac),
- style,
- attrs.lift(|a| folder.fold_attribute(a)))
- }))
- }
- }
-
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_local<F: ?Sized + Folder>(folder: &mut F, local: Local)
- -> Local
-{
- Local {
- pat: local.pat.lift(|v| folder.fold_pat(v)),
- ty: local.ty.map(|v| v.lift(|t| folder.fold_ty(t))),
- init: local.init.map(|v| v.lift(|e| folder.fold_expr(e))),
- attrs: local.attrs.lift(|a| folder.fold_attribute(a)),
- ..local
- }
-}
-
-#[cfg(feature = "full")]
-pub fn noop_fold_view_path<F: ?Sized + Folder>(folder: &mut F, view_path: ViewPath) -> ViewPath {
- use item::*;
- use ViewPath::*;
- match view_path {
- Simple(p) => {
- Simple(PathSimple {
- path: folder.fold_path(p.path),
- rename: p.rename.map(|i| folder.fold_ident(i)),
- ..p
- })
- }
- Glob(p) => {
- Glob(PathGlob {
- path: folder.fold_path(p.path),
- ..p
- })
- }
- List(p) => {
- List(PathList {
- path: folder.fold_path(p.path),
- items: p.items.lift(|item: PathListItem| {
- PathListItem {
- name: folder.fold_ident(item.name),
- rename: item.rename.map(|i| folder.fold_ident(i)),
- ..item
- }
- }),
- ..p
- })
- }
- }
-}
diff --git a/src/gen/fold.rs b/src/gen/fold.rs
new file mode 100644
index 0000000..326bf4c
--- /dev/null
+++ b/src/gen/fold.rs
@@ -0,0 +1,2666 @@
+
+// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
+
+//! A Folder represents an AST->AST fold; it accepts an AST piece,
+//! and returns a piece of the same type.
+
+// Unreachable code is generated sometimes without the full feature.
+#![allow(unreachable_code)]
+
+use super::*;
+use synom::delimited::Delimited;
+
+trait FoldHelper {
+ type Item;
+ fn lift<F>(self, f: F) -> Self where F: FnMut(Self::Item) -> Self::Item;
+}
+
+impl<T> FoldHelper for Vec<T> {
+ type Item = T;
+ fn lift<F>(self, f: F) -> Self where F: FnMut(Self::Item) -> Self::Item {
+ self.into_iter().map(f).collect()
+ }
+}
+
+impl<T, U> FoldHelper for Delimited<T, U> {
+ type Item = T;
+ fn lift<F>(self, mut f: F) -> Self where F: FnMut(Self::Item) -> Self::Item {
+ self.into_iter().map(|elem| {
+ let (t, u) = elem.into_tuple();
+ (f(t), u)
+ }).collect::<Vec<(T, Option<U>)>>().into()
+ }
+}
+
+/// AST->AST fold.
+///
+/// Each method of the Folder trait is a hook to be potentially overridden. Each
+/// method's default implementation recursively visits the substructure of the
+/// input via the `walk` functions, which perform an "identity fold", that
+/// is, they return the same structure that they are given (for example the
+/// `fold_file` method by default calls `fold::walk_file`).
+///
+/// If you want to ensure that your code handles every variant
+/// explicitly, you need to override each method. (And you also need
+/// to monitor future changes to `Folder` in case a new method with a
+/// new default implementation gets introduced.)
+pub trait Folder {
+
+fn fold_abi(&mut self, i: Abi) -> Abi { walk_abi(self, i) }
+
+fn fold_abi_kind(&mut self, i: AbiKind) -> AbiKind { walk_abi_kind(self, i) }
+
+fn fold_angle_bracketed_parameter_data(&mut self, i: AngleBracketedParameterData) -> AngleBracketedParameterData { walk_angle_bracketed_parameter_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured { walk_arg_captured(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf { walk_arg_self(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef { walk_arg_self_ref(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_arm(&mut self, i: Arm) -> Arm { walk_arm(self, i) }
+
+fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle { walk_attr_style(self, i) }
+
+fn fold_attribute(&mut self, i: Attribute) -> Attribute { walk_attribute(self, i) }
+
+fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg { walk_bare_fn_arg(self, i) }
+
+fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName { walk_bare_fn_arg_name(self, i) }
+
+fn fold_bare_fn_ty(&mut self, i: BareFnTy) -> BareFnTy { walk_bare_fn_ty(self, i) }
+
+fn fold_bin_op(&mut self, i: BinOp) -> BinOp { walk_bin_op(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_binding_mode(&mut self, i: BindingMode) -> BindingMode { walk_binding_mode(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_block(&mut self, i: Block) -> Block { walk_block(self, i) }
+
+fn fold_body(&mut self, i: Body) -> Body { walk_body(self, i) }
+
+fn fold_body_enum(&mut self, i: BodyEnum) -> BodyEnum { walk_body_enum(self, i) }
+
+fn fold_body_struct(&mut self, i: BodyStruct) -> BodyStruct { walk_body_struct(self, i) }
+
+fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes { walk_bound_lifetimes(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_capture_by(&mut self, i: CaptureBy) -> CaptureBy { walk_capture_by(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_constness(&mut self, i: Constness) -> Constness { walk_constness(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_defaultness(&mut self, i: Defaultness) -> Defaultness { walk_defaultness(self, i) }
+
+fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput { walk_derive_input(self, i) }
+
+fn fold_expr(&mut self, i: Expr) -> Expr { walk_expr(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_addr_of(&mut self, i: ExprAddrOf) -> ExprAddrOf { walk_expr_addr_of(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray { walk_expr_array(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign { walk_expr_assign(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp { walk_expr_assign_op(self, i) }
+
+fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary { walk_expr_binary(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock { walk_expr_block(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox { walk_expr_box(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak { walk_expr_break(self, i) }
+
+fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall { walk_expr_call(self, i) }
+
+fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast { walk_expr_cast(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_catch(&mut self, i: ExprCatch) -> ExprCatch { walk_expr_catch(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure { walk_expr_closure(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue { walk_expr_continue(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_field(&mut self, i: ExprField) -> ExprField { walk_expr_field(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop { walk_expr_for_loop(self, i) }
+
+fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup { walk_expr_group(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf { walk_expr_if(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet { walk_expr_if_let(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace { walk_expr_in_place(self, i) }
+
+fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex { walk_expr_index(self, i) }
+
+fn fold_expr_kind(&mut self, i: ExprKind) -> ExprKind { walk_expr_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop { walk_expr_loop(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch { walk_expr_match(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall { walk_expr_method_call(self, i) }
+
+fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen { walk_expr_paren(self, i) }
+
+fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath { walk_expr_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange { walk_expr_range(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat { walk_expr_repeat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_ret(&mut self, i: ExprRet) -> ExprRet { walk_expr_ret(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct { walk_expr_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry { walk_expr_try(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_tup(&mut self, i: ExprTup) -> ExprTup { walk_expr_tup(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_tup_field(&mut self, i: ExprTupField) -> ExprTupField { walk_expr_tup_field(self, i) }
+
+fn fold_expr_type(&mut self, i: ExprType) -> ExprType { walk_expr_type(self, i) }
+
+fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary { walk_expr_unary(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile { walk_expr_while(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet { walk_expr_while_let(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield { walk_expr_yield(self, i) }
+
+fn fold_field(&mut self, i: Field) -> Field { walk_field(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat { walk_field_pat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_field_value(&mut self, i: FieldValue) -> FieldValue { walk_field_value(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_file(&mut self, i: File) -> File { walk_file(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_fn_arg(&mut self, i: FnArg) -> FnArg { walk_fn_arg(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl { walk_fn_decl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem { walk_foreign_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn { walk_foreign_item_fn(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_foreign_item_kind(&mut self, i: ForeignItemKind) -> ForeignItemKind { walk_foreign_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic { walk_foreign_item_static(self, i) }
+
+fn fold_function_ret_ty(&mut self, i: FunctionRetTy) -> FunctionRetTy { walk_function_ret_ty(self, i) }
+
+fn fold_generics(&mut self, i: Generics) -> Generics { walk_generics(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem { walk_impl_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst { walk_impl_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_impl_item_kind(&mut self, i: ImplItemKind) -> ImplItemKind { walk_impl_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod { walk_impl_item_method(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType { walk_impl_item_type(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_impl_polarity(&mut self, i: ImplPolarity) -> ImplPolarity { walk_impl_polarity(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_in_place_kind(&mut self, i: InPlaceKind) -> InPlaceKind { walk_in_place_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item(&mut self, i: Item) -> Item { walk_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_const(&mut self, i: ItemConst) -> ItemConst { walk_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_default_impl(&mut self, i: ItemDefaultImpl) -> ItemDefaultImpl { walk_item_default_impl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum { walk_item_enum(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate { walk_item_extern_crate(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn { walk_item_fn(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod { walk_item_foreign_mod(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl { walk_item_impl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_kind(&mut self, i: ItemKind) -> ItemKind { walk_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod { walk_item_mod(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic { walk_item_static(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct { walk_item_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait { walk_item_trait(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_ty(&mut self, i: ItemTy) -> ItemTy { walk_item_ty(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion { walk_item_union(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_item_use(&mut self, i: ItemUse) -> ItemUse { walk_item_use(self, i) }
+
+fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef { walk_lifetime_def(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_local(&mut self, i: Local) -> Local { walk_local(self, i) }
+
+fn fold_mac(&mut self, i: Mac) -> Mac { walk_mac(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_mac_stmt_style(&mut self, i: MacStmtStyle) -> MacStmtStyle { walk_mac_stmt_style(self, i) }
+
+fn fold_meta_item(&mut self, i: MetaItem) -> MetaItem { walk_meta_item(self, i) }
+
+fn fold_meta_item_list(&mut self, i: MetaItemList) -> MetaItemList { walk_meta_item_list(self, i) }
+
+fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue { walk_meta_name_value(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig { walk_method_sig(self, i) }
+
+fn fold_mut_ty(&mut self, i: MutTy) -> MutTy { walk_mut_ty(self, i) }
+
+fn fold_mutability(&mut self, i: Mutability) -> Mutability { walk_mutability(self, i) }
+
+fn fold_nested_meta_item(&mut self, i: NestedMetaItem) -> NestedMetaItem { walk_nested_meta_item(self, i) }
+
+fn fold_parenthesized_parameter_data(&mut self, i: ParenthesizedParameterData) -> ParenthesizedParameterData { walk_parenthesized_parameter_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat(&mut self, i: Pat) -> Pat { walk_pat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_box(&mut self, i: PatBox) -> PatBox { walk_pat_box(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent { walk_pat_ident(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_lit(&mut self, i: PatLit) -> PatLit { walk_pat_lit(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_path(&mut self, i: PatPath) -> PatPath { walk_pat_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_range(&mut self, i: PatRange) -> PatRange { walk_pat_range(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_ref(&mut self, i: PatRef) -> PatRef { walk_pat_ref(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice { walk_pat_slice(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct { walk_pat_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple { walk_pat_tuple(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct { walk_pat_tuple_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_pat_wild(&mut self, i: PatWild) -> PatWild { walk_pat_wild(self, i) }
+
+fn fold_path(&mut self, i: Path) -> Path { walk_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_path_glob(&mut self, i: PathGlob) -> PathGlob { walk_path_glob(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_path_list(&mut self, i: PathList) -> PathList { walk_path_list(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_path_list_item(&mut self, i: PathListItem) -> PathListItem { walk_path_list_item(self, i) }
+
+fn fold_path_parameters(&mut self, i: PathParameters) -> PathParameters { walk_path_parameters(self, i) }
+
+fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment { walk_path_segment(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_path_simple(&mut self, i: PathSimple) -> PathSimple { walk_path_simple(self, i) }
+
+fn fold_poly_trait_ref(&mut self, i: PolyTraitRef) -> PolyTraitRef { walk_poly_trait_ref(self, i) }
+
+fn fold_qself(&mut self, i: QSelf) -> QSelf { walk_qself(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits { walk_range_limits(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_stmt(&mut self, i: Stmt) -> Stmt { walk_stmt(self, i) }
+
+fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier { walk_trait_bound_modifier(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem { walk_trait_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst { walk_trait_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_trait_item_kind(&mut self, i: TraitItemKind) -> TraitItemKind { walk_trait_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod { walk_trait_item_method(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType { walk_trait_item_type(self, i) }
+
+fn fold_ty(&mut self, i: Ty) -> Ty { walk_ty(self, i) }
+
+fn fold_ty_array(&mut self, i: TyArray) -> TyArray { walk_ty_array(self, i) }
+
+fn fold_ty_bare_fn(&mut self, i: TyBareFn) -> TyBareFn { walk_ty_bare_fn(self, i) }
+
+fn fold_ty_group(&mut self, i: TyGroup) -> TyGroup { walk_ty_group(self, i) }
+
+fn fold_ty_impl_trait(&mut self, i: TyImplTrait) -> TyImplTrait { walk_ty_impl_trait(self, i) }
+
+fn fold_ty_infer(&mut self, i: TyInfer) -> TyInfer { walk_ty_infer(self, i) }
+
+fn fold_ty_never(&mut self, i: TyNever) -> TyNever { walk_ty_never(self, i) }
+
+fn fold_ty_param(&mut self, i: TyParam) -> TyParam { walk_ty_param(self, i) }
+
+fn fold_ty_param_bound(&mut self, i: TyParamBound) -> TyParamBound { walk_ty_param_bound(self, i) }
+
+fn fold_ty_paren(&mut self, i: TyParen) -> TyParen { walk_ty_paren(self, i) }
+
+fn fold_ty_path(&mut self, i: TyPath) -> TyPath { walk_ty_path(self, i) }
+
+fn fold_ty_ptr(&mut self, i: TyPtr) -> TyPtr { walk_ty_ptr(self, i) }
+
+fn fold_ty_rptr(&mut self, i: TyRptr) -> TyRptr { walk_ty_rptr(self, i) }
+
+fn fold_ty_slice(&mut self, i: TySlice) -> TySlice { walk_ty_slice(self, i) }
+
+fn fold_ty_trait_object(&mut self, i: TyTraitObject) -> TyTraitObject { walk_ty_trait_object(self, i) }
+
+fn fold_ty_tup(&mut self, i: TyTup) -> TyTup { walk_ty_tup(self, i) }
+
+fn fold_type_binding(&mut self, i: TypeBinding) -> TypeBinding { walk_type_binding(self, i) }
+
+fn fold_un_op(&mut self, i: UnOp) -> UnOp { walk_un_op(self, i) }
+
+fn fold_unsafety(&mut self, i: Unsafety) -> Unsafety { walk_unsafety(self, i) }
+
+fn fold_variant(&mut self, i: Variant) -> Variant { walk_variant(self, i) }
+
+fn fold_variant_data(&mut self, i: VariantData) -> VariantData { walk_variant_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn fold_view_path(&mut self, i: ViewPath) -> ViewPath { walk_view_path(self, i) }
+
+fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate { walk_vis_crate(self, i) }
+
+fn fold_vis_inherited(&mut self, i: VisInherited) -> VisInherited { walk_vis_inherited(self, i) }
+
+fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic { walk_vis_public(self, i) }
+
+fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted { walk_vis_restricted(self, i) }
+
+fn fold_visibility(&mut self, i: Visibility) -> Visibility { walk_visibility(self, i) }
+
+fn fold_where_bound_predicate(&mut self, i: WhereBoundPredicate) -> WhereBoundPredicate { walk_where_bound_predicate(self, i) }
+
+fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause { walk_where_clause(self, i) }
+
+fn fold_where_eq_predicate(&mut self, i: WhereEqPredicate) -> WhereEqPredicate { walk_where_eq_predicate(self, i) }
+
+fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate { walk_where_predicate(self, i) }
+
+fn fold_where_region_predicate(&mut self, i: WhereRegionPredicate) -> WhereRegionPredicate { walk_where_region_predicate(self, i) }
+
+}
+
+
+pub fn walk_abi<V: Folder + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
+ Abi {
+ extern_token: _i . extern_token,
+ kind: _visitor.fold_abi_kind(_i . kind),
+ }
+}
+
+pub fn walk_abi_kind<V: Folder + ?Sized>(_visitor: &mut V, _i: AbiKind) -> AbiKind {
+ use ::AbiKind::*;
+ match _i {
+ Named(_binding_0, ) => {
+ Named (
+ _binding_0,
+ )
+ }
+ Default => { Default }
+ }
+}
+
+pub fn walk_angle_bracketed_parameter_data<V: Folder + ?Sized>(_visitor: &mut V, _i: AngleBracketedParameterData) -> AngleBracketedParameterData {
+ AngleBracketedParameterData {
+ turbofish: _i . turbofish,
+ lt_token: _i . lt_token,
+ lifetimes: _i . lifetimes,
+ types: FoldHelper::lift(_i . types, |it| { _visitor.fold_ty(it) }),
+ bindings: FoldHelper::lift(_i . bindings, |it| { _visitor.fold_type_binding(it) }),
+ gt_token: _i . gt_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_captured<V: Folder + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
+ ArgCaptured {
+ pat: _visitor.fold_pat(_i . pat),
+ colon_token: _i . colon_token,
+ ty: _visitor.fold_ty(_i . ty),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_self<V: Folder + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
+ ArgSelf {
+ mutbl: _visitor.fold_mutability(_i . mutbl),
+ self_token: _i . self_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_self_ref<V: Folder + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
+ ArgSelfRef {
+ and_token: _i . and_token,
+ self_token: _i . self_token,
+ lifetime: _i . lifetime,
+ mutbl: _visitor.fold_mutability(_i . mutbl),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arm<V: Folder + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
+ Arm {
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ pats: FoldHelper::lift(_i . pats, |it| { _visitor.fold_pat(it) }),
+ if_token: _i . if_token,
+ guard: _i . guard,
+ rocket_token: _i . rocket_token,
+ body: Box::new(_visitor.fold_expr(* _i . body)),
+ comma: _i . comma,
+ }
+}
+
+pub fn walk_attr_style<V: Folder + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
+ use ::AttrStyle::*;
+ match _i {
+ Outer => { Outer }
+ Inner(_binding_0, ) => {
+ Inner (
+ _binding_0,
+ )
+ }
+ }
+}
+
+pub fn walk_attribute<V: Folder + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
+ Attribute {
+ style: _visitor.fold_attr_style(_i . style),
+ pound_token: _i . pound_token,
+ bracket_token: _i . bracket_token,
+ path: _visitor.fold_path(_i . path),
+ tts: _i . tts,
+ is_sugared_doc: _i . is_sugared_doc,
+ }
+}
+
+pub fn walk_bare_fn_arg<V: Folder + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
+ BareFnArg {
+ name: _i . name,
+ ty: _visitor.fold_ty(_i . ty),
+ }
+}
+
+pub fn walk_bare_fn_arg_name<V: Folder + ?Sized>(_visitor: &mut V, _i: BareFnArgName) -> BareFnArgName {
+ use ::BareFnArgName::*;
+ match _i {
+ Named(_binding_0, ) => {
+ Named (
+ _binding_0,
+ )
+ }
+ Wild(_binding_0, ) => {
+ Wild (
+ _binding_0,
+ )
+ }
+ }
+}
+
+pub fn walk_bare_fn_ty<V: Folder + ?Sized>(_visitor: &mut V, _i: BareFnTy) -> BareFnTy {
+ BareFnTy {
+ lifetimes: _i . lifetimes,
+ unsafety: _visitor.fold_unsafety(_i . unsafety),
+ abi: _i . abi,
+ fn_token: _i . fn_token,
+ paren_token: _i . paren_token,
+ inputs: FoldHelper::lift(_i . inputs, |it| { _visitor.fold_bare_fn_arg(it) }),
+ variadic: _i . variadic,
+ output: _visitor.fold_function_ret_ty(_i . output),
+ }
+}
+
+pub fn walk_bin_op<V: Folder + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
+ use ::BinOp::*;
+ match _i {
+ Add(_binding_0, ) => {
+ Add (
+ _binding_0,
+ )
+ }
+ Sub(_binding_0, ) => {
+ Sub (
+ _binding_0,
+ )
+ }
+ Mul(_binding_0, ) => {
+ Mul (
+ _binding_0,
+ )
+ }
+ Div(_binding_0, ) => {
+ Div (
+ _binding_0,
+ )
+ }
+ Rem(_binding_0, ) => {
+ Rem (
+ _binding_0,
+ )
+ }
+ And(_binding_0, ) => {
+ And (
+ _binding_0,
+ )
+ }
+ Or(_binding_0, ) => {
+ Or (
+ _binding_0,
+ )
+ }
+ BitXor(_binding_0, ) => {
+ BitXor (
+ _binding_0,
+ )
+ }
+ BitAnd(_binding_0, ) => {
+ BitAnd (
+ _binding_0,
+ )
+ }
+ BitOr(_binding_0, ) => {
+ BitOr (
+ _binding_0,
+ )
+ }
+ Shl(_binding_0, ) => {
+ Shl (
+ _binding_0,
+ )
+ }
+ Shr(_binding_0, ) => {
+ Shr (
+ _binding_0,
+ )
+ }
+ Eq(_binding_0, ) => {
+ Eq (
+ _binding_0,
+ )
+ }
+ Lt(_binding_0, ) => {
+ Lt (
+ _binding_0,
+ )
+ }
+ Le(_binding_0, ) => {
+ Le (
+ _binding_0,
+ )
+ }
+ Ne(_binding_0, ) => {
+ Ne (
+ _binding_0,
+ )
+ }
+ Ge(_binding_0, ) => {
+ Ge (
+ _binding_0,
+ )
+ }
+ Gt(_binding_0, ) => {
+ Gt (
+ _binding_0,
+ )
+ }
+ AddEq(_binding_0, ) => {
+ AddEq (
+ _binding_0,
+ )
+ }
+ SubEq(_binding_0, ) => {
+ SubEq (
+ _binding_0,
+ )
+ }
+ MulEq(_binding_0, ) => {
+ MulEq (
+ _binding_0,
+ )
+ }
+ DivEq(_binding_0, ) => {
+ DivEq (
+ _binding_0,
+ )
+ }
+ RemEq(_binding_0, ) => {
+ RemEq (
+ _binding_0,
+ )
+ }
+ BitXorEq(_binding_0, ) => {
+ BitXorEq (
+ _binding_0,
+ )
+ }
+ BitAndEq(_binding_0, ) => {
+ BitAndEq (
+ _binding_0,
+ )
+ }
+ BitOrEq(_binding_0, ) => {
+ BitOrEq (
+ _binding_0,
+ )
+ }
+ ShlEq(_binding_0, ) => {
+ ShlEq (
+ _binding_0,
+ )
+ }
+ ShrEq(_binding_0, ) => {
+ ShrEq (
+ _binding_0,
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_binding_mode<V: Folder + ?Sized>(_visitor: &mut V, _i: BindingMode) -> BindingMode {
+ use ::BindingMode::*;
+ match _i {
+ ByRef(_binding_0, _binding_1, ) => {
+ ByRef (
+ _binding_0,
+ _visitor.fold_mutability(_binding_1),
+ )
+ }
+ ByValue(_binding_0, ) => {
+ ByValue (
+ _visitor.fold_mutability(_binding_0),
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_block<V: Folder + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
+ Block {
+ brace_token: _i . brace_token,
+ stmts: FoldHelper::lift(_i . stmts, |it| { _visitor.fold_stmt(it) }),
+ }
+}
+
+pub fn walk_body<V: Folder + ?Sized>(_visitor: &mut V, _i: Body) -> Body {
+ use ::Body::*;
+ match _i {
+ Enum(_binding_0, ) => {
+ Enum (
+ _visitor.fold_body_enum(_binding_0),
+ )
+ }
+ Struct(_binding_0, ) => {
+ Struct (
+ _visitor.fold_body_struct(_binding_0),
+ )
+ }
+ }
+}
+
+pub fn walk_body_enum<V: Folder + ?Sized>(_visitor: &mut V, _i: BodyEnum) -> BodyEnum {
+ BodyEnum {
+ enum_token: _i . enum_token,
+ brace_token: _i . brace_token,
+ variants: FoldHelper::lift(_i . variants, |it| { _visitor.fold_variant(it) }),
+ }
+}
+
+pub fn walk_body_struct<V: Folder + ?Sized>(_visitor: &mut V, _i: BodyStruct) -> BodyStruct {
+ BodyStruct {
+ data: _visitor.fold_variant_data(_i . data),
+ struct_token: _i . struct_token,
+ semi_token: _i . semi_token,
+ }
+}
+
+pub fn walk_bound_lifetimes<V: Folder + ?Sized>(_visitor: &mut V, _i: BoundLifetimes) -> BoundLifetimes {
+ BoundLifetimes {
+ for_token: _i . for_token,
+ lt_token: _i . lt_token,
+ lifetimes: FoldHelper::lift(_i . lifetimes, |it| { _visitor.fold_lifetime_def(it) }),
+ gt_token: _i . gt_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_capture_by<V: Folder + ?Sized>(_visitor: &mut V, _i: CaptureBy) -> CaptureBy {
+ use ::CaptureBy::*;
+ match _i {
+ Value(_binding_0, ) => {
+ Value (
+ _binding_0,
+ )
+ }
+ Ref => { Ref }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_constness<V: Folder + ?Sized>(_visitor: &mut V, _i: Constness) -> Constness {
+ use ::Constness::*;
+ match _i {
+ Const(_binding_0, ) => {
+ Const (
+ _binding_0,
+ )
+ }
+ NotConst => { NotConst }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_defaultness<V: Folder + ?Sized>(_visitor: &mut V, _i: Defaultness) -> Defaultness {
+ use ::Defaultness::*;
+ match _i {
+ Default(_binding_0, ) => {
+ Default (
+ _binding_0,
+ )
+ }
+ Final => { Final }
+ }
+}
+
+pub fn walk_derive_input<V: Folder + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
+ DeriveInput {
+ ident: _i . ident,
+ vis: _visitor.fold_visibility(_i . vis),
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ generics: _visitor.fold_generics(_i . generics),
+ body: _visitor.fold_body(_i . body),
+ }
+}
+
+pub fn walk_expr<V: Folder + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
+ Expr {
+ node: _visitor.fold_expr_kind(_i . node),
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_addr_of<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprAddrOf) -> ExprAddrOf {
+ ExprAddrOf {
+ and_token: _i . and_token,
+ mutbl: _visitor.fold_mutability(_i . mutbl),
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_array<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
+ ExprArray {
+ exprs: FoldHelper::lift(_i . exprs, |it| { _visitor.fold_expr(it) }),
+ bracket_token: _i . bracket_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_assign<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
+ ExprAssign {
+ left: Box::new(_visitor.fold_expr(* _i . left)),
+ right: Box::new(_visitor.fold_expr(* _i . right)),
+ eq_token: _i . eq_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_assign_op<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
+ ExprAssignOp {
+ op: _visitor.fold_bin_op(_i . op),
+ left: Box::new(_visitor.fold_expr(* _i . left)),
+ right: Box::new(_visitor.fold_expr(* _i . right)),
+ }
+}
+
+pub fn walk_expr_binary<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
+ ExprBinary {
+ op: _visitor.fold_bin_op(_i . op),
+ left: Box::new(_visitor.fold_expr(* _i . left)),
+ right: Box::new(_visitor.fold_expr(* _i . right)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_block<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
+ ExprBlock {
+ unsafety: _visitor.fold_unsafety(_i . unsafety),
+ block: _visitor.fold_block(_i . block),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_box<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
+ ExprBox {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ box_token: _i . box_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_break<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
+ ExprBreak {
+ label: _i . label,
+ expr: _i . expr,
+ break_token: _i . break_token,
+ }
+}
+
+pub fn walk_expr_call<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
+ ExprCall {
+ func: Box::new(_visitor.fold_expr(* _i . func)),
+ args: FoldHelper::lift(_i . args, |it| { _visitor.fold_expr(it) }),
+ paren_token: _i . paren_token,
+ }
+}
+
+pub fn walk_expr_cast<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
+ ExprCast {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ as_token: _i . as_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_catch<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprCatch) -> ExprCatch {
+ ExprCatch {
+ do_token: _i . do_token,
+ catch_token: _i . catch_token,
+ block: _visitor.fold_block(_i . block),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_closure<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
+ ExprClosure {
+ capture: _visitor.fold_capture_by(_i . capture),
+ decl: Box::new(_visitor.fold_fn_decl(* _i . decl)),
+ body: Box::new(_visitor.fold_expr(* _i . body)),
+ or1_token: _i . or1_token,
+ or2_token: _i . or2_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_continue<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
+ ExprContinue {
+ label: _i . label,
+ continue_token: _i . continue_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_field<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
+ ExprField {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ field: _i . field,
+ dot_token: _i . dot_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_for_loop<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
+ ExprForLoop {
+ pat: Box::new(_visitor.fold_pat(* _i . pat)),
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ body: _visitor.fold_block(_i . body),
+ label: _i . label,
+ for_token: _i . for_token,
+ colon_token: _i . colon_token,
+ in_token: _i . in_token,
+ }
+}
+
+pub fn walk_expr_group<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
+ ExprGroup {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ group_token: _i . group_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_if<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
+ ExprIf {
+ cond: Box::new(_visitor.fold_expr(* _i . cond)),
+ if_true: _visitor.fold_block(_i . if_true),
+ if_false: _i . if_false,
+ if_token: _i . if_token,
+ else_token: _i . else_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_if_let<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
+ ExprIfLet {
+ pat: Box::new(_visitor.fold_pat(* _i . pat)),
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ if_true: _visitor.fold_block(_i . if_true),
+ if_false: _i . if_false,
+ if_token: _i . if_token,
+ let_token: _i . let_token,
+ eq_token: _i . eq_token,
+ else_token: _i . else_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_in_place<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
+ ExprInPlace {
+ place: Box::new(_visitor.fold_expr(* _i . place)),
+ kind: _visitor.fold_in_place_kind(_i . kind),
+ value: Box::new(_visitor.fold_expr(* _i . value)),
+ }
+}
+
+pub fn walk_expr_index<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
+ ExprIndex {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ index: Box::new(_visitor.fold_expr(* _i . index)),
+ bracket_token: _i . bracket_token,
+ }
+}
+
+pub fn walk_expr_kind<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprKind) -> ExprKind {
+ use ::ExprKind::*;
+ match _i {
+ Box(_binding_0, ) => {
+ Box (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_box(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ InPlace(_binding_0, ) => {
+ InPlace (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_in_place(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Array(_binding_0, ) => {
+ Array (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_array(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Call(_binding_0, ) => {
+ Call (
+ _visitor.fold_expr_call(_binding_0),
+ )
+ }
+ MethodCall(_binding_0, ) => {
+ MethodCall (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_method_call(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Tup(_binding_0, ) => {
+ Tup (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_tup(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Binary(_binding_0, ) => {
+ Binary (
+ _visitor.fold_expr_binary(_binding_0),
+ )
+ }
+ Unary(_binding_0, ) => {
+ Unary (
+ _visitor.fold_expr_unary(_binding_0),
+ )
+ }
+ Lit(_binding_0, ) => {
+ Lit (
+ _binding_0,
+ )
+ }
+ Cast(_binding_0, ) => {
+ Cast (
+ _visitor.fold_expr_cast(_binding_0),
+ )
+ }
+ Type(_binding_0, ) => {
+ Type (
+ _visitor.fold_expr_type(_binding_0),
+ )
+ }
+ If(_binding_0, ) => {
+ If (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_if(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ IfLet(_binding_0, ) => {
+ IfLet (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_if_let(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ While(_binding_0, ) => {
+ While (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_while(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ WhileLet(_binding_0, ) => {
+ WhileLet (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_while_let(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ ForLoop(_binding_0, ) => {
+ ForLoop (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_for_loop(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Loop(_binding_0, ) => {
+ Loop (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_loop(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Match(_binding_0, ) => {
+ Match (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_match(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Closure(_binding_0, ) => {
+ Closure (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_closure(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Block(_binding_0, ) => {
+ Block (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_block(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Assign(_binding_0, ) => {
+ Assign (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_assign(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ AssignOp(_binding_0, ) => {
+ AssignOp (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_assign_op(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Field(_binding_0, ) => {
+ Field (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_field(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ TupField(_binding_0, ) => {
+ TupField (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_tup_field(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Index(_binding_0, ) => {
+ Index (
+ _visitor.fold_expr_index(_binding_0),
+ )
+ }
+ Range(_binding_0, ) => {
+ Range (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_range(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Path(_binding_0, ) => {
+ Path (
+ _visitor.fold_expr_path(_binding_0),
+ )
+ }
+ AddrOf(_binding_0, ) => {
+ AddrOf (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_addr_of(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Break(_binding_0, ) => {
+ Break (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_break(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Continue(_binding_0, ) => {
+ Continue (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_continue(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Ret(_binding_0, ) => {
+ Ret (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_ret(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Mac(_binding_0, ) => {
+ Mac (
+ _visitor.fold_mac(_binding_0),
+ )
+ }
+ Struct(_binding_0, ) => {
+ Struct (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_struct(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Repeat(_binding_0, ) => {
+ Repeat (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_repeat(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Paren(_binding_0, ) => {
+ Paren (
+ _visitor.fold_expr_paren(_binding_0),
+ )
+ }
+ Group(_binding_0, ) => {
+ Group (
+ _visitor.fold_expr_group(_binding_0),
+ )
+ }
+ Try(_binding_0, ) => {
+ Try (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_try(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Catch(_binding_0, ) => {
+ Catch (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_catch(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ Yield(_binding_0, ) => {
+ Yield (
+ { #[cfg(feature = "full")] { _visitor.fold_expr_yield(_binding_0) } #[cfg(not(feature = "full"))] unreachable!() },
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_loop<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
+ ExprLoop {
+ body: _visitor.fold_block(_i . body),
+ label: _i . label,
+ loop_token: _i . loop_token,
+ colon_token: _i . colon_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_match<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
+ ExprMatch {
+ match_token: _i . match_token,
+ brace_token: _i . brace_token,
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ arms: FoldHelper::lift(_i . arms, |it| { _visitor.fold_arm(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_method_call<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprMethodCall) -> ExprMethodCall {
+ ExprMethodCall {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ method: _i . method,
+ typarams: FoldHelper::lift(_i . typarams, |it| { _visitor.fold_ty(it) }),
+ args: FoldHelper::lift(_i . args, |it| { _visitor.fold_expr(it) }),
+ paren_token: _i . paren_token,
+ dot_token: _i . dot_token,
+ lt_token: _i . lt_token,
+ colon2_token: _i . colon2_token,
+ gt_token: _i . gt_token,
+ }
+}
+
+pub fn walk_expr_paren<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
+ ExprParen {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ paren_token: _i . paren_token,
+ }
+}
+
+pub fn walk_expr_path<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
+ ExprPath {
+ qself: _i . qself,
+ path: _visitor.fold_path(_i . path),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_range<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
+ ExprRange {
+ from: _i . from,
+ to: _i . to,
+ limits: _visitor.fold_range_limits(_i . limits),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_repeat<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
+ ExprRepeat {
+ bracket_token: _i . bracket_token,
+ semi_token: _i . semi_token,
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ amt: Box::new(_visitor.fold_expr(* _i . amt)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_ret<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprRet) -> ExprRet {
+ ExprRet {
+ expr: _i . expr,
+ return_token: _i . return_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_struct<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
+ ExprStruct {
+ path: _visitor.fold_path(_i . path),
+ fields: FoldHelper::lift(_i . fields, |it| { _visitor.fold_field_value(it) }),
+ rest: _i . rest,
+ dot2_token: _i . dot2_token,
+ brace_token: _i . brace_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_try<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
+ ExprTry {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ question_token: _i . question_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_tup<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprTup) -> ExprTup {
+ ExprTup {
+ args: FoldHelper::lift(_i . args, |it| { _visitor.fold_expr(it) }),
+ paren_token: _i . paren_token,
+ lone_comma: _i . lone_comma,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_tup_field<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprTupField) -> ExprTupField {
+ ExprTupField {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ field: _i . field,
+ dot_token: _i . dot_token,
+ }
+}
+
+pub fn walk_expr_type<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
+ ExprType {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ colon_token: _i . colon_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ }
+}
+
+pub fn walk_expr_unary<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
+ ExprUnary {
+ op: _visitor.fold_un_op(_i . op),
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_while<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
+ ExprWhile {
+ cond: Box::new(_visitor.fold_expr(* _i . cond)),
+ body: _visitor.fold_block(_i . body),
+ label: _i . label,
+ colon_token: _i . colon_token,
+ while_token: _i . while_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_while_let<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
+ ExprWhileLet {
+ pat: Box::new(_visitor.fold_pat(* _i . pat)),
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ body: _visitor.fold_block(_i . body),
+ label: _i . label,
+ colon_token: _i . colon_token,
+ while_token: _i . while_token,
+ let_token: _i . let_token,
+ eq_token: _i . eq_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_yield<V: Folder + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
+ ExprYield {
+ yield_token: _i . yield_token,
+ expr: _i . expr,
+ }
+}
+
+pub fn walk_field<V: Folder + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
+ Field {
+ ident: _i . ident,
+ vis: _visitor.fold_visibility(_i . vis),
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ ty: _visitor.fold_ty(_i . ty),
+ colon_token: _i . colon_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_field_pat<V: Folder + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
+ FieldPat {
+ ident: _i . ident,
+ pat: Box::new(_visitor.fold_pat(* _i . pat)),
+ is_shorthand: _i . is_shorthand,
+ colon_token: _i . colon_token,
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_field_value<V: Folder + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
+ FieldValue {
+ ident: _i . ident,
+ expr: _visitor.fold_expr(_i . expr),
+ is_shorthand: _i . is_shorthand,
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ colon_token: _i . colon_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_file<V: Folder + ?Sized>(_visitor: &mut V, _i: File) -> File {
+ File {
+ shebang: _i . shebang,
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ items: FoldHelper::lift(_i . items, |it| { _visitor.fold_item(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_fn_arg<V: Folder + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
+ use ::FnArg::*;
+ match _i {
+ SelfRef(_binding_0, ) => {
+ SelfRef (
+ _visitor.fold_arg_self_ref(_binding_0),
+ )
+ }
+ SelfValue(_binding_0, ) => {
+ SelfValue (
+ _visitor.fold_arg_self(_binding_0),
+ )
+ }
+ Captured(_binding_0, ) => {
+ Captured (
+ _visitor.fold_arg_captured(_binding_0),
+ )
+ }
+ Ignored(_binding_0, ) => {
+ Ignored (
+ _visitor.fold_ty(_binding_0),
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_fn_decl<V: Folder + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
+ FnDecl {
+ fn_token: _i . fn_token,
+ paren_token: _i . paren_token,
+ inputs: FoldHelper::lift(_i . inputs, |it| { _visitor.fold_fn_arg(it) }),
+ output: _visitor.fold_function_ret_ty(_i . output),
+ generics: _visitor.fold_generics(_i . generics),
+ variadic: _i . variadic,
+ dot_tokens: _i . dot_tokens,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item<V: Folder + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
+ ForeignItem {
+ ident: _i . ident,
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ node: _visitor.fold_foreign_item_kind(_i . node),
+ vis: _visitor.fold_visibility(_i . vis),
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_fn<V: Folder + ?Sized>(_visitor: &mut V, _i: ForeignItemFn) -> ForeignItemFn {
+ ForeignItemFn {
+ decl: Box::new(_visitor.fold_fn_decl(* _i . decl)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_kind<V: Folder + ?Sized>(_visitor: &mut V, _i: ForeignItemKind) -> ForeignItemKind {
+ use ::ForeignItemKind::*;
+ match _i {
+ Fn(_binding_0, ) => {
+ Fn (
+ _visitor.fold_foreign_item_fn(_binding_0),
+ )
+ }
+ Static(_binding_0, ) => {
+ Static (
+ _visitor.fold_foreign_item_static(_binding_0),
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_static<V: Folder + ?Sized>(_visitor: &mut V, _i: ForeignItemStatic) -> ForeignItemStatic {
+ ForeignItemStatic {
+ static_token: _i . static_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ colon_token: _i . colon_token,
+ mutbl: _visitor.fold_mutability(_i . mutbl),
+ }
+}
+
+pub fn walk_function_ret_ty<V: Folder + ?Sized>(_visitor: &mut V, _i: FunctionRetTy) -> FunctionRetTy {
+ use ::FunctionRetTy::*;
+ match _i {
+ Default => { Default }
+ Ty(_binding_0, _binding_1, ) => {
+ Ty (
+ _visitor.fold_ty(_binding_0),
+ _binding_1,
+ )
+ }
+ }
+}
+
+pub fn walk_generics<V: Folder + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
+ Generics {
+ lt_token: _i . lt_token,
+ gt_token: _i . gt_token,
+ lifetimes: FoldHelper::lift(_i . lifetimes, |it| { _visitor.fold_lifetime_def(it) }),
+ ty_params: FoldHelper::lift(_i . ty_params, |it| { _visitor.fold_ty_param(it) }),
+ where_clause: _visitor.fold_where_clause(_i . where_clause),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item<V: Folder + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
+ ImplItem {
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ node: _visitor.fold_impl_item_kind(_i . node),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_const<V: Folder + ?Sized>(_visitor: &mut V, _i: ImplItemConst) -> ImplItemConst {
+ ImplItemConst {
+ vis: _visitor.fold_visibility(_i . vis),
+ defaultness: _visitor.fold_defaultness(_i . defaultness),
+ const_token: _i . const_token,
+ ident: _i . ident,
+ colon_token: _i . colon_token,
+ ty: _visitor.fold_ty(_i . ty),
+ eq_token: _i . eq_token,
+ expr: _visitor.fold_expr(_i . expr),
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_kind<V: Folder + ?Sized>(_visitor: &mut V, _i: ImplItemKind) -> ImplItemKind {
+ use ::ImplItemKind::*;
+ match _i {
+ Const(_binding_0, ) => {
+ Const (
+ _visitor.fold_impl_item_const(_binding_0),
+ )
+ }
+ Method(_binding_0, ) => {
+ Method (
+ _visitor.fold_impl_item_method(_binding_0),
+ )
+ }
+ Type(_binding_0, ) => {
+ Type (
+ _visitor.fold_impl_item_type(_binding_0),
+ )
+ }
+ Macro(_binding_0, ) => {
+ Macro (
+ _visitor.fold_mac(_binding_0),
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_method<V: Folder + ?Sized>(_visitor: &mut V, _i: ImplItemMethod) -> ImplItemMethod {
+ ImplItemMethod {
+ vis: _visitor.fold_visibility(_i . vis),
+ defaultness: _visitor.fold_defaultness(_i . defaultness),
+ sig: _visitor.fold_method_sig(_i . sig),
+ block: _visitor.fold_block(_i . block),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_type<V: Folder + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
+ ImplItemType {
+ vis: _visitor.fold_visibility(_i . vis),
+ defaultness: _visitor.fold_defaultness(_i . defaultness),
+ type_token: _i . type_token,
+ ident: _i . ident,
+ eq_token: _i . eq_token,
+ ty: _visitor.fold_ty(_i . ty),
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_polarity<V: Folder + ?Sized>(_visitor: &mut V, _i: ImplPolarity) -> ImplPolarity {
+ use ::ImplPolarity::*;
+ match _i {
+ Positive => { Positive }
+ Negative(_binding_0, ) => {
+ Negative (
+ _binding_0,
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_in_place_kind<V: Folder + ?Sized>(_visitor: &mut V, _i: InPlaceKind) -> InPlaceKind {
+ use ::InPlaceKind::*;
+ match _i {
+ Arrow(_binding_0, ) => {
+ Arrow (
+ _binding_0,
+ )
+ }
+ In(_binding_0, ) => {
+ In (
+ _binding_0,
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item<V: Folder + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
+ Item {
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ node: _visitor.fold_item_kind(_i . node),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_const<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
+ ItemConst {
+ vis: _visitor.fold_visibility(_i . vis),
+ const_token: _i . const_token,
+ ident: _i . ident,
+ colon_token: _i . colon_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ eq_token: _i . eq_token,
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_default_impl<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemDefaultImpl) -> ItemDefaultImpl {
+ ItemDefaultImpl {
+ unsafety: _visitor.fold_unsafety(_i . unsafety),
+ impl_token: _i . impl_token,
+ path: _visitor.fold_path(_i . path),
+ for_token: _i . for_token,
+ dot2_token: _i . dot2_token,
+ brace_token: _i . brace_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_enum<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
+ ItemEnum {
+ vis: _visitor.fold_visibility(_i . vis),
+ enum_token: _i . enum_token,
+ ident: _i . ident,
+ generics: _visitor.fold_generics(_i . generics),
+ brace_token: _i . brace_token,
+ variants: FoldHelper::lift(_i . variants, |it| { _visitor.fold_variant(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_extern_crate<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemExternCrate) -> ItemExternCrate {
+ ItemExternCrate {
+ vis: _visitor.fold_visibility(_i . vis),
+ extern_token: _i . extern_token,
+ crate_token: _i . crate_token,
+ ident: _i . ident,
+ rename: _i . rename,
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_fn<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
+ ItemFn {
+ vis: _visitor.fold_visibility(_i . vis),
+ constness: _visitor.fold_constness(_i . constness),
+ unsafety: _visitor.fold_unsafety(_i . unsafety),
+ abi: _i . abi,
+ decl: Box::new(_visitor.fold_fn_decl(* _i . decl)),
+ ident: _i . ident,
+ block: Box::new(_visitor.fold_block(* _i . block)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_foreign_mod<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemForeignMod) -> ItemForeignMod {
+ ItemForeignMod {
+ abi: _visitor.fold_abi(_i . abi),
+ brace_token: _i . brace_token,
+ items: FoldHelper::lift(_i . items, |it| { _visitor.fold_foreign_item(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_impl<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
+ ItemImpl {
+ defaultness: _visitor.fold_defaultness(_i . defaultness),
+ unsafety: _visitor.fold_unsafety(_i . unsafety),
+ impl_token: _i . impl_token,
+ generics: _visitor.fold_generics(_i . generics),
+ trait_: _i . trait_,
+ self_ty: Box::new(_visitor.fold_ty(* _i . self_ty)),
+ brace_token: _i . brace_token,
+ items: FoldHelper::lift(_i . items, |it| { _visitor.fold_impl_item(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_kind<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemKind) -> ItemKind {
+ use ::ItemKind::*;
+ match _i {
+ ExternCrate(_binding_0, ) => {
+ ExternCrate (
+ _visitor.fold_item_extern_crate(_binding_0),
+ )
+ }
+ Use(_binding_0, ) => {
+ Use (
+ _visitor.fold_item_use(_binding_0),
+ )
+ }
+ Static(_binding_0, ) => {
+ Static (
+ _visitor.fold_item_static(_binding_0),
+ )
+ }
+ Const(_binding_0, ) => {
+ Const (
+ _visitor.fold_item_const(_binding_0),
+ )
+ }
+ Fn(_binding_0, ) => {
+ Fn (
+ _visitor.fold_item_fn(_binding_0),
+ )
+ }
+ Mod(_binding_0, ) => {
+ Mod (
+ _visitor.fold_item_mod(_binding_0),
+ )
+ }
+ ForeignMod(_binding_0, ) => {
+ ForeignMod (
+ _visitor.fold_item_foreign_mod(_binding_0),
+ )
+ }
+ Ty(_binding_0, ) => {
+ Ty (
+ _visitor.fold_item_ty(_binding_0),
+ )
+ }
+ Enum(_binding_0, ) => {
+ Enum (
+ _visitor.fold_item_enum(_binding_0),
+ )
+ }
+ Struct(_binding_0, ) => {
+ Struct (
+ _visitor.fold_item_struct(_binding_0),
+ )
+ }
+ Union(_binding_0, ) => {
+ Union (
+ _visitor.fold_item_union(_binding_0),
+ )
+ }
+ Trait(_binding_0, ) => {
+ Trait (
+ _visitor.fold_item_trait(_binding_0),
+ )
+ }
+ DefaultImpl(_binding_0, ) => {
+ DefaultImpl (
+ _visitor.fold_item_default_impl(_binding_0),
+ )
+ }
+ Impl(_binding_0, ) => {
+ Impl (
+ _visitor.fold_item_impl(_binding_0),
+ )
+ }
+ Mac(_binding_0, ) => {
+ Mac (
+ _visitor.fold_mac(_binding_0),
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_mod<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
+ ItemMod {
+ vis: _visitor.fold_visibility(_i . vis),
+ mod_token: _i . mod_token,
+ ident: _i . ident,
+ content: _i . content,
+ semi: _i . semi,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_static<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
+ ItemStatic {
+ vis: _visitor.fold_visibility(_i . vis),
+ static_token: _i . static_token,
+ mutbl: _visitor.fold_mutability(_i . mutbl),
+ ident: _i . ident,
+ colon_token: _i . colon_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ eq_token: _i . eq_token,
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_struct<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
+ ItemStruct {
+ vis: _visitor.fold_visibility(_i . vis),
+ struct_token: _i . struct_token,
+ ident: _i . ident,
+ generics: _visitor.fold_generics(_i . generics),
+ data: _visitor.fold_variant_data(_i . data),
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_trait<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
+ ItemTrait {
+ vis: _visitor.fold_visibility(_i . vis),
+ unsafety: _visitor.fold_unsafety(_i . unsafety),
+ trait_token: _i . trait_token,
+ ident: _i . ident,
+ generics: _visitor.fold_generics(_i . generics),
+ colon_token: _i . colon_token,
+ supertraits: FoldHelper::lift(_i . supertraits, |it| { _visitor.fold_ty_param_bound(it) }),
+ brace_token: _i . brace_token,
+ items: FoldHelper::lift(_i . items, |it| { _visitor.fold_trait_item(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_ty<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemTy) -> ItemTy {
+ ItemTy {
+ vis: _visitor.fold_visibility(_i . vis),
+ type_token: _i . type_token,
+ ident: _i . ident,
+ generics: _visitor.fold_generics(_i . generics),
+ eq_token: _i . eq_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_union<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
+ ItemUnion {
+ vis: _visitor.fold_visibility(_i . vis),
+ union_token: _i . union_token,
+ ident: _i . ident,
+ generics: _visitor.fold_generics(_i . generics),
+ data: _visitor.fold_variant_data(_i . data),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_use<V: Folder + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
+ ItemUse {
+ vis: _visitor.fold_visibility(_i . vis),
+ use_token: _i . use_token,
+ path: Box::new(_visitor.fold_view_path(* _i . path)),
+ semi_token: _i . semi_token,
+ }
+}
+
+pub fn walk_lifetime_def<V: Folder + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
+ LifetimeDef {
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ lifetime: _i . lifetime,
+ colon_token: _i . colon_token,
+ bounds: _i . bounds,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_local<V: Folder + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
+ Local {
+ let_token: _i . let_token,
+ colon_token: _i . colon_token,
+ eq_token: _i . eq_token,
+ semi_token: _i . semi_token,
+ pat: Box::new(_visitor.fold_pat(* _i . pat)),
+ ty: _i . ty,
+ init: _i . init,
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ }
+}
+
+pub fn walk_mac<V: Folder + ?Sized>(_visitor: &mut V, _i: Mac) -> Mac {
+ Mac {
+ path: _visitor.fold_path(_i . path),
+ bang_token: _i . bang_token,
+ ident: _i . ident,
+ tokens: _i . tokens,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_mac_stmt_style<V: Folder + ?Sized>(_visitor: &mut V, _i: MacStmtStyle) -> MacStmtStyle {
+ use ::MacStmtStyle::*;
+ match _i {
+ Semicolon(_binding_0, ) => {
+ Semicolon (
+ _binding_0,
+ )
+ }
+ Braces => { Braces }
+ NoBraces => { NoBraces }
+ }
+}
+
+pub fn walk_meta_item<V: Folder + ?Sized>(_visitor: &mut V, _i: MetaItem) -> MetaItem {
+ use ::MetaItem::*;
+ match _i {
+ Term(_binding_0, ) => {
+ Term (
+ _binding_0,
+ )
+ }
+ List(_binding_0, ) => {
+ List (
+ _visitor.fold_meta_item_list(_binding_0),
+ )
+ }
+ NameValue(_binding_0, ) => {
+ NameValue (
+ _visitor.fold_meta_name_value(_binding_0),
+ )
+ }
+ }
+}
+
+pub fn walk_meta_item_list<V: Folder + ?Sized>(_visitor: &mut V, _i: MetaItemList) -> MetaItemList {
+ MetaItemList {
+ ident: _i . ident,
+ paren_token: _i . paren_token,
+ nested: FoldHelper::lift(_i . nested, |it| { _visitor.fold_nested_meta_item(it) }),
+ }
+}
+
+pub fn walk_meta_name_value<V: Folder + ?Sized>(_visitor: &mut V, _i: MetaNameValue) -> MetaNameValue {
+ MetaNameValue {
+ ident: _i . ident,
+ eq_token: _i . eq_token,
+ lit: _i . lit,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_method_sig<V: Folder + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
+ MethodSig {
+ constness: _visitor.fold_constness(_i . constness),
+ unsafety: _visitor.fold_unsafety(_i . unsafety),
+ abi: _i . abi,
+ ident: _i . ident,
+ decl: _visitor.fold_fn_decl(_i . decl),
+ }
+}
+
+pub fn walk_mut_ty<V: Folder + ?Sized>(_visitor: &mut V, _i: MutTy) -> MutTy {
+ MutTy {
+ ty: _visitor.fold_ty(_i . ty),
+ mutability: _visitor.fold_mutability(_i . mutability),
+ }
+}
+
+pub fn walk_mutability<V: Folder + ?Sized>(_visitor: &mut V, _i: Mutability) -> Mutability {
+ use ::Mutability::*;
+ match _i {
+ Mutable(_binding_0, ) => {
+ Mutable (
+ _binding_0,
+ )
+ }
+ Immutable => { Immutable }
+ }
+}
+
+pub fn walk_nested_meta_item<V: Folder + ?Sized>(_visitor: &mut V, _i: NestedMetaItem) -> NestedMetaItem {
+ use ::NestedMetaItem::*;
+ match _i {
+ MetaItem(_binding_0, ) => {
+ MetaItem (
+ _visitor.fold_meta_item(_binding_0),
+ )
+ }
+ Literal(_binding_0, ) => {
+ Literal (
+ _binding_0,
+ )
+ }
+ }
+}
+
+pub fn walk_parenthesized_parameter_data<V: Folder + ?Sized>(_visitor: &mut V, _i: ParenthesizedParameterData) -> ParenthesizedParameterData {
+ ParenthesizedParameterData {
+ paren_token: _i . paren_token,
+ inputs: FoldHelper::lift(_i . inputs, |it| { _visitor.fold_ty(it) }),
+ output: _visitor.fold_function_ret_ty(_i . output),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat<V: Folder + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
+ use ::Pat::*;
+ match _i {
+ Wild(_binding_0, ) => {
+ Wild (
+ _visitor.fold_pat_wild(_binding_0),
+ )
+ }
+ Ident(_binding_0, ) => {
+ Ident (
+ _visitor.fold_pat_ident(_binding_0),
+ )
+ }
+ Struct(_binding_0, ) => {
+ Struct (
+ _visitor.fold_pat_struct(_binding_0),
+ )
+ }
+ TupleStruct(_binding_0, ) => {
+ TupleStruct (
+ _visitor.fold_pat_tuple_struct(_binding_0),
+ )
+ }
+ Path(_binding_0, ) => {
+ Path (
+ _visitor.fold_pat_path(_binding_0),
+ )
+ }
+ Tuple(_binding_0, ) => {
+ Tuple (
+ _visitor.fold_pat_tuple(_binding_0),
+ )
+ }
+ Box(_binding_0, ) => {
+ Box (
+ _visitor.fold_pat_box(_binding_0),
+ )
+ }
+ Ref(_binding_0, ) => {
+ Ref (
+ _visitor.fold_pat_ref(_binding_0),
+ )
+ }
+ Lit(_binding_0, ) => {
+ Lit (
+ _visitor.fold_pat_lit(_binding_0),
+ )
+ }
+ Range(_binding_0, ) => {
+ Range (
+ _visitor.fold_pat_range(_binding_0),
+ )
+ }
+ Slice(_binding_0, ) => {
+ Slice (
+ _visitor.fold_pat_slice(_binding_0),
+ )
+ }
+ Mac(_binding_0, ) => {
+ Mac (
+ _visitor.fold_mac(_binding_0),
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_box<V: Folder + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
+ PatBox {
+ pat: Box::new(_visitor.fold_pat(* _i . pat)),
+ box_token: _i . box_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_ident<V: Folder + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
+ PatIdent {
+ mode: _visitor.fold_binding_mode(_i . mode),
+ ident: _i . ident,
+ subpat: _i . subpat,
+ at_token: _i . at_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_lit<V: Folder + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
+ PatLit {
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_path<V: Folder + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
+ PatPath {
+ qself: _i . qself,
+ path: _visitor.fold_path(_i . path),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_range<V: Folder + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
+ PatRange {
+ lo: Box::new(_visitor.fold_expr(* _i . lo)),
+ hi: Box::new(_visitor.fold_expr(* _i . hi)),
+ limits: _visitor.fold_range_limits(_i . limits),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_ref<V: Folder + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
+ PatRef {
+ pat: Box::new(_visitor.fold_pat(* _i . pat)),
+ mutbl: _visitor.fold_mutability(_i . mutbl),
+ and_token: _i . and_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_slice<V: Folder + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
+ PatSlice {
+ front: FoldHelper::lift(_i . front, |it| { _visitor.fold_pat(it) }),
+ middle: _i . middle,
+ back: FoldHelper::lift(_i . back, |it| { _visitor.fold_pat(it) }),
+ dot2_token: _i . dot2_token,
+ comma_token: _i . comma_token,
+ bracket_token: _i . bracket_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_struct<V: Folder + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
+ PatStruct {
+ path: _visitor.fold_path(_i . path),
+ fields: FoldHelper::lift(_i . fields, |it| { _visitor.fold_field_pat(it) }),
+ brace_token: _i . brace_token,
+ dot2_token: _i . dot2_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_tuple<V: Folder + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
+ PatTuple {
+ pats: FoldHelper::lift(_i . pats, |it| { _visitor.fold_pat(it) }),
+ dots_pos: _i . dots_pos,
+ paren_token: _i . paren_token,
+ dot2_token: _i . dot2_token,
+ comma_token: _i . comma_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_tuple_struct<V: Folder + ?Sized>(_visitor: &mut V, _i: PatTupleStruct) -> PatTupleStruct {
+ PatTupleStruct {
+ path: _visitor.fold_path(_i . path),
+ pat: _visitor.fold_pat_tuple(_i . pat),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_wild<V: Folder + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
+ PatWild {
+ underscore_token: _i . underscore_token,
+ }
+}
+
+pub fn walk_path<V: Folder + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
+ Path {
+ leading_colon: _i . leading_colon,
+ segments: FoldHelper::lift(_i . segments, |it| { _visitor.fold_path_segment(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_glob<V: Folder + ?Sized>(_visitor: &mut V, _i: PathGlob) -> PathGlob {
+ PathGlob {
+ path: _visitor.fold_path(_i . path),
+ colon2_token: _i . colon2_token,
+ star_token: _i . star_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_list<V: Folder + ?Sized>(_visitor: &mut V, _i: PathList) -> PathList {
+ PathList {
+ path: _visitor.fold_path(_i . path),
+ colon2_token: _i . colon2_token,
+ brace_token: _i . brace_token,
+ items: FoldHelper::lift(_i . items, |it| { _visitor.fold_path_list_item(it) }),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_list_item<V: Folder + ?Sized>(_visitor: &mut V, _i: PathListItem) -> PathListItem {
+ PathListItem {
+ name: _i . name,
+ rename: _i . rename,
+ as_token: _i . as_token,
+ }
+}
+
+pub fn walk_path_parameters<V: Folder + ?Sized>(_visitor: &mut V, _i: PathParameters) -> PathParameters {
+ use ::PathParameters::*;
+ match _i {
+ None => { None }
+ AngleBracketed(_binding_0, ) => {
+ AngleBracketed (
+ _visitor.fold_angle_bracketed_parameter_data(_binding_0),
+ )
+ }
+ Parenthesized(_binding_0, ) => {
+ Parenthesized (
+ _visitor.fold_parenthesized_parameter_data(_binding_0),
+ )
+ }
+ }
+}
+
+pub fn walk_path_segment<V: Folder + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
+ PathSegment {
+ ident: _i . ident,
+ parameters: _visitor.fold_path_parameters(_i . parameters),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_simple<V: Folder + ?Sized>(_visitor: &mut V, _i: PathSimple) -> PathSimple {
+ PathSimple {
+ path: _visitor.fold_path(_i . path),
+ as_token: _i . as_token,
+ rename: _i . rename,
+ }
+}
+
+pub fn walk_poly_trait_ref<V: Folder + ?Sized>(_visitor: &mut V, _i: PolyTraitRef) -> PolyTraitRef {
+ PolyTraitRef {
+ bound_lifetimes: _i . bound_lifetimes,
+ trait_ref: _visitor.fold_path(_i . trait_ref),
+ }
+}
+
+pub fn walk_qself<V: Folder + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
+ QSelf {
+ lt_token: _i . lt_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ position: _i . position,
+ as_token: _i . as_token,
+ gt_token: _i . gt_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_range_limits<V: Folder + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
+ use ::RangeLimits::*;
+ match _i {
+ HalfOpen(_binding_0, ) => {
+ HalfOpen (
+ _binding_0,
+ )
+ }
+ Closed(_binding_0, ) => {
+ Closed (
+ _binding_0,
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_stmt<V: Folder + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
+ use ::Stmt::*;
+ match _i {
+ Local(_binding_0, ) => {
+ Local (
+ Box::new(_visitor.fold_local(* _binding_0)),
+ )
+ }
+ Item(_binding_0, ) => {
+ Item (
+ Box::new(_visitor.fold_item(* _binding_0)),
+ )
+ }
+ Expr(_binding_0, ) => {
+ Expr (
+ Box::new(_visitor.fold_expr(* _binding_0)),
+ )
+ }
+ Semi(_binding_0, _binding_1, ) => {
+ Semi (
+ Box::new(_visitor.fold_expr(* _binding_0)),
+ _binding_1,
+ )
+ }
+ Mac(_binding_0, ) => {
+ Mac (
+ _binding_0,
+ )
+ }
+ }
+}
+
+pub fn walk_trait_bound_modifier<V: Folder + ?Sized>(_visitor: &mut V, _i: TraitBoundModifier) -> TraitBoundModifier {
+ use ::TraitBoundModifier::*;
+ match _i {
+ None => { None }
+ Maybe(_binding_0, ) => {
+ Maybe (
+ _binding_0,
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item<V: Folder + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
+ TraitItem {
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ node: _visitor.fold_trait_item_kind(_i . node),
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_const<V: Folder + ?Sized>(_visitor: &mut V, _i: TraitItemConst) -> TraitItemConst {
+ TraitItemConst {
+ const_token: _i . const_token,
+ ident: _i . ident,
+ colon_token: _i . colon_token,
+ ty: _visitor.fold_ty(_i . ty),
+ default: _i . default,
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_kind<V: Folder + ?Sized>(_visitor: &mut V, _i: TraitItemKind) -> TraitItemKind {
+ use ::TraitItemKind::*;
+ match _i {
+ Const(_binding_0, ) => {
+ Const (
+ _visitor.fold_trait_item_const(_binding_0),
+ )
+ }
+ Method(_binding_0, ) => {
+ Method (
+ _visitor.fold_trait_item_method(_binding_0),
+ )
+ }
+ Type(_binding_0, ) => {
+ Type (
+ _visitor.fold_trait_item_type(_binding_0),
+ )
+ }
+ Macro(_binding_0, ) => {
+ Macro (
+ _visitor.fold_mac(_binding_0),
+ )
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_method<V: Folder + ?Sized>(_visitor: &mut V, _i: TraitItemMethod) -> TraitItemMethod {
+ TraitItemMethod {
+ sig: _visitor.fold_method_sig(_i . sig),
+ default: _i . default,
+ semi_token: _i . semi_token,
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_type<V: Folder + ?Sized>(_visitor: &mut V, _i: TraitItemType) -> TraitItemType {
+ TraitItemType {
+ type_token: _i . type_token,
+ ident: _i . ident,
+ colon_token: _i . colon_token,
+ bounds: FoldHelper::lift(_i . bounds, |it| { _visitor.fold_ty_param_bound(it) }),
+ default: _i . default,
+ semi_token: _i . semi_token,
+ }
+}
+
+pub fn walk_ty<V: Folder + ?Sized>(_visitor: &mut V, _i: Ty) -> Ty {
+ use ::Ty::*;
+ match _i {
+ Slice(_binding_0, ) => {
+ Slice (
+ _visitor.fold_ty_slice(_binding_0),
+ )
+ }
+ Array(_binding_0, ) => {
+ Array (
+ _visitor.fold_ty_array(_binding_0),
+ )
+ }
+ Ptr(_binding_0, ) => {
+ Ptr (
+ _visitor.fold_ty_ptr(_binding_0),
+ )
+ }
+ Rptr(_binding_0, ) => {
+ Rptr (
+ _visitor.fold_ty_rptr(_binding_0),
+ )
+ }
+ BareFn(_binding_0, ) => {
+ BareFn (
+ _visitor.fold_ty_bare_fn(_binding_0),
+ )
+ }
+ Never(_binding_0, ) => {
+ Never (
+ _visitor.fold_ty_never(_binding_0),
+ )
+ }
+ Tup(_binding_0, ) => {
+ Tup (
+ _visitor.fold_ty_tup(_binding_0),
+ )
+ }
+ Path(_binding_0, ) => {
+ Path (
+ _visitor.fold_ty_path(_binding_0),
+ )
+ }
+ TraitObject(_binding_0, ) => {
+ TraitObject (
+ _visitor.fold_ty_trait_object(_binding_0),
+ )
+ }
+ ImplTrait(_binding_0, ) => {
+ ImplTrait (
+ _visitor.fold_ty_impl_trait(_binding_0),
+ )
+ }
+ Paren(_binding_0, ) => {
+ Paren (
+ _visitor.fold_ty_paren(_binding_0),
+ )
+ }
+ Group(_binding_0, ) => {
+ Group (
+ _visitor.fold_ty_group(_binding_0),
+ )
+ }
+ Infer(_binding_0, ) => {
+ Infer (
+ _visitor.fold_ty_infer(_binding_0),
+ )
+ }
+ Mac(_binding_0, ) => {
+ Mac (
+ _visitor.fold_mac(_binding_0),
+ )
+ }
+ }
+}
+
+pub fn walk_ty_array<V: Folder + ?Sized>(_visitor: &mut V, _i: TyArray) -> TyArray {
+ TyArray {
+ bracket_token: _i . bracket_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ semi_token: _i . semi_token,
+ amt: _visitor.fold_expr(_i . amt),
+ }
+}
+
+pub fn walk_ty_bare_fn<V: Folder + ?Sized>(_visitor: &mut V, _i: TyBareFn) -> TyBareFn {
+ TyBareFn {
+ ty: Box::new(_visitor.fold_bare_fn_ty(* _i . ty)),
+ }
+}
+
+pub fn walk_ty_group<V: Folder + ?Sized>(_visitor: &mut V, _i: TyGroup) -> TyGroup {
+ TyGroup {
+ group_token: _i . group_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ }
+}
+
+pub fn walk_ty_impl_trait<V: Folder + ?Sized>(_visitor: &mut V, _i: TyImplTrait) -> TyImplTrait {
+ TyImplTrait {
+ impl_token: _i . impl_token,
+ bounds: FoldHelper::lift(_i . bounds, |it| { _visitor.fold_ty_param_bound(it) }),
+ }
+}
+
+pub fn walk_ty_infer<V: Folder + ?Sized>(_visitor: &mut V, _i: TyInfer) -> TyInfer {
+ TyInfer {
+ underscore_token: _i . underscore_token,
+ }
+}
+
+pub fn walk_ty_never<V: Folder + ?Sized>(_visitor: &mut V, _i: TyNever) -> TyNever {
+ TyNever {
+ bang_token: _i . bang_token,
+ }
+}
+
+pub fn walk_ty_param<V: Folder + ?Sized>(_visitor: &mut V, _i: TyParam) -> TyParam {
+ TyParam {
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ ident: _i . ident,
+ colon_token: _i . colon_token,
+ bounds: FoldHelper::lift(_i . bounds, |it| { _visitor.fold_ty_param_bound(it) }),
+ eq_token: _i . eq_token,
+ default: _i . default,
+ }
+}
+
+pub fn walk_ty_param_bound<V: Folder + ?Sized>(_visitor: &mut V, _i: TyParamBound) -> TyParamBound {
+ use ::TyParamBound::*;
+ match _i {
+ Trait(_binding_0, _binding_1, ) => {
+ Trait (
+ _visitor.fold_poly_trait_ref(_binding_0),
+ _visitor.fold_trait_bound_modifier(_binding_1),
+ )
+ }
+ Region(_binding_0, ) => {
+ Region (
+ _binding_0,
+ )
+ }
+ }
+}
+
+pub fn walk_ty_paren<V: Folder + ?Sized>(_visitor: &mut V, _i: TyParen) -> TyParen {
+ TyParen {
+ paren_token: _i . paren_token,
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ }
+}
+
+pub fn walk_ty_path<V: Folder + ?Sized>(_visitor: &mut V, _i: TyPath) -> TyPath {
+ TyPath {
+ qself: _i . qself,
+ path: _visitor.fold_path(_i . path),
+ }
+}
+
+pub fn walk_ty_ptr<V: Folder + ?Sized>(_visitor: &mut V, _i: TyPtr) -> TyPtr {
+ TyPtr {
+ star_token: _i . star_token,
+ const_token: _i . const_token,
+ ty: Box::new(_visitor.fold_mut_ty(* _i . ty)),
+ }
+}
+
+pub fn walk_ty_rptr<V: Folder + ?Sized>(_visitor: &mut V, _i: TyRptr) -> TyRptr {
+ TyRptr {
+ and_token: _i . and_token,
+ lifetime: _i . lifetime,
+ ty: Box::new(_visitor.fold_mut_ty(* _i . ty)),
+ }
+}
+
+pub fn walk_ty_slice<V: Folder + ?Sized>(_visitor: &mut V, _i: TySlice) -> TySlice {
+ TySlice {
+ ty: Box::new(_visitor.fold_ty(* _i . ty)),
+ bracket_token: _i . bracket_token,
+ }
+}
+
+pub fn walk_ty_trait_object<V: Folder + ?Sized>(_visitor: &mut V, _i: TyTraitObject) -> TyTraitObject {
+ TyTraitObject {
+ bounds: FoldHelper::lift(_i . bounds, |it| { _visitor.fold_ty_param_bound(it) }),
+ }
+}
+
+pub fn walk_ty_tup<V: Folder + ?Sized>(_visitor: &mut V, _i: TyTup) -> TyTup {
+ TyTup {
+ paren_token: _i . paren_token,
+ tys: FoldHelper::lift(_i . tys, |it| { _visitor.fold_ty(it) }),
+ lone_comma: _i . lone_comma,
+ }
+}
+
+pub fn walk_type_binding<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeBinding) -> TypeBinding {
+ TypeBinding {
+ ident: _i . ident,
+ eq_token: _i . eq_token,
+ ty: _visitor.fold_ty(_i . ty),
+ }
+}
+
+pub fn walk_un_op<V: Folder + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
+ use ::UnOp::*;
+ match _i {
+ Deref(_binding_0, ) => {
+ Deref (
+ _binding_0,
+ )
+ }
+ Not(_binding_0, ) => {
+ Not (
+ _binding_0,
+ )
+ }
+ Neg(_binding_0, ) => {
+ Neg (
+ _binding_0,
+ )
+ }
+ }
+}
+
+pub fn walk_unsafety<V: Folder + ?Sized>(_visitor: &mut V, _i: Unsafety) -> Unsafety {
+ use ::Unsafety::*;
+ match _i {
+ Unsafe(_binding_0, ) => {
+ Unsafe (
+ _binding_0,
+ )
+ }
+ Normal => { Normal }
+ }
+}
+
+pub fn walk_variant<V: Folder + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
+ Variant {
+ ident: _i . ident,
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ data: _visitor.fold_variant_data(_i . data),
+ discriminant: _i . discriminant,
+ eq_token: _i . eq_token,
+ }
+}
+
+pub fn walk_variant_data<V: Folder + ?Sized>(_visitor: &mut V, _i: VariantData) -> VariantData {
+ use ::VariantData::*;
+ match _i {
+ Struct(_binding_0, _binding_1, ) => {
+ Struct (
+ FoldHelper::lift(_binding_0, |it| { _visitor.fold_field(it) }),
+ _binding_1,
+ )
+ }
+ Tuple(_binding_0, _binding_1, ) => {
+ Tuple (
+ FoldHelper::lift(_binding_0, |it| { _visitor.fold_field(it) }),
+ _binding_1,
+ )
+ }
+ Unit => { Unit }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_view_path<V: Folder + ?Sized>(_visitor: &mut V, _i: ViewPath) -> ViewPath {
+ use ::ViewPath::*;
+ match _i {
+ Simple(_binding_0, ) => {
+ Simple (
+ _visitor.fold_path_simple(_binding_0),
+ )
+ }
+ Glob(_binding_0, ) => {
+ Glob (
+ _visitor.fold_path_glob(_binding_0),
+ )
+ }
+ List(_binding_0, ) => {
+ List (
+ _visitor.fold_path_list(_binding_0),
+ )
+ }
+ }
+}
+
+pub fn walk_vis_crate<V: Folder + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
+ VisCrate {
+ pub_token: _i . pub_token,
+ paren_token: _i . paren_token,
+ crate_token: _i . crate_token,
+ }
+}
+
+pub fn walk_vis_inherited<V: Folder + ?Sized>(_visitor: &mut V, _i: VisInherited) -> VisInherited {
+ VisInherited {
+ }
+}
+
+pub fn walk_vis_public<V: Folder + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
+ VisPublic {
+ pub_token: _i . pub_token,
+ }
+}
+
+pub fn walk_vis_restricted<V: Folder + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
+ VisRestricted {
+ pub_token: _i . pub_token,
+ paren_token: _i . paren_token,
+ in_token: _i . in_token,
+ path: Box::new(_visitor.fold_path(* _i . path)),
+ }
+}
+
+pub fn walk_visibility<V: Folder + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
+ use ::Visibility::*;
+ match _i {
+ Public(_binding_0, ) => {
+ Public (
+ _visitor.fold_vis_public(_binding_0),
+ )
+ }
+ Crate(_binding_0, ) => {
+ Crate (
+ _visitor.fold_vis_crate(_binding_0),
+ )
+ }
+ Restricted(_binding_0, ) => {
+ Restricted (
+ _visitor.fold_vis_restricted(_binding_0),
+ )
+ }
+ Inherited(_binding_0, ) => {
+ Inherited (
+ _visitor.fold_vis_inherited(_binding_0),
+ )
+ }
+ }
+}
+
+pub fn walk_where_bound_predicate<V: Folder + ?Sized>(_visitor: &mut V, _i: WhereBoundPredicate) -> WhereBoundPredicate {
+ WhereBoundPredicate {
+ bound_lifetimes: _i . bound_lifetimes,
+ bounded_ty: _visitor.fold_ty(_i . bounded_ty),
+ colon_token: _i . colon_token,
+ bounds: FoldHelper::lift(_i . bounds, |it| { _visitor.fold_ty_param_bound(it) }),
+ }
+}
+
+pub fn walk_where_clause<V: Folder + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
+ WhereClause {
+ where_token: _i . where_token,
+ predicates: FoldHelper::lift(_i . predicates, |it| { _visitor.fold_where_predicate(it) }),
+ }
+}
+
+pub fn walk_where_eq_predicate<V: Folder + ?Sized>(_visitor: &mut V, _i: WhereEqPredicate) -> WhereEqPredicate {
+ WhereEqPredicate {
+ lhs_ty: _visitor.fold_ty(_i . lhs_ty),
+ eq_token: _i . eq_token,
+ rhs_ty: _visitor.fold_ty(_i . rhs_ty),
+ }
+}
+
+pub fn walk_where_predicate<V: Folder + ?Sized>(_visitor: &mut V, _i: WherePredicate) -> WherePredicate {
+ use ::WherePredicate::*;
+ match _i {
+ BoundPredicate(_binding_0, ) => {
+ BoundPredicate (
+ _visitor.fold_where_bound_predicate(_binding_0),
+ )
+ }
+ RegionPredicate(_binding_0, ) => {
+ RegionPredicate (
+ _visitor.fold_where_region_predicate(_binding_0),
+ )
+ }
+ EqPredicate(_binding_0, ) => {
+ EqPredicate (
+ _visitor.fold_where_eq_predicate(_binding_0),
+ )
+ }
+ }
+}
+
+pub fn walk_where_region_predicate<V: Folder + ?Sized>(_visitor: &mut V, _i: WhereRegionPredicate) -> WhereRegionPredicate {
+ WhereRegionPredicate {
+ lifetime: _i . lifetime,
+ colon_token: _i . colon_token,
+ bounds: _i . bounds,
+ }
+}
+
diff --git a/src/gen/visit.rs b/src/gen/visit.rs
new file mode 100644
index 0000000..f932995
--- /dev/null
+++ b/src/gen/visit.rs
@@ -0,0 +1,2025 @@
+
+// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
+
+//! AST walker. Each overridden visit method has full control over what
+//! happens with its node, it can do its own traversal of the node's children,
+//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
+//! deeper traversal by doing nothing.
+
+use super::*;
+
+/// Each method of the Visitor trait is a hook to be potentially
+/// overridden. Each method's default implementation recursively visits
+/// the substructure of the input via the corresponding `walk` method;
+/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
+///
+/// If you want to ensure that your code handles every variant
+/// explicitly, you need to override each method. (And you also need
+/// to monitor future changes to `Visitor` in case a new method with a
+/// new default implementation gets introduced.)
+pub trait Visitor {
+
+fn visit_abi(&mut self, i: &Abi) { walk_abi(self, i) }
+
+fn visit_abi_kind(&mut self, i: &AbiKind) { walk_abi_kind(self, i) }
+
+fn visit_angle_bracketed_parameter_data(&mut self, i: &AngleBracketedParameterData) { walk_angle_bracketed_parameter_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arg_captured(&mut self, i: &ArgCaptured) { walk_arg_captured(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arg_self(&mut self, i: &ArgSelf) { walk_arg_self(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arg_self_ref(&mut self, i: &ArgSelfRef) { walk_arg_self_ref(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arm(&mut self, i: &Arm) { walk_arm(self, i) }
+
+fn visit_attr_style(&mut self, i: &AttrStyle) { walk_attr_style(self, i) }
+
+fn visit_attribute(&mut self, i: &Attribute) { walk_attribute(self, i) }
+
+fn visit_bare_fn_arg(&mut self, i: &BareFnArg) { walk_bare_fn_arg(self, i) }
+
+fn visit_bare_fn_arg_name(&mut self, i: &BareFnArgName) { walk_bare_fn_arg_name(self, i) }
+
+fn visit_bare_fn_ty(&mut self, i: &BareFnTy) { walk_bare_fn_ty(self, i) }
+
+fn visit_bin_op(&mut self, i: &BinOp) { walk_bin_op(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_binding_mode(&mut self, i: &BindingMode) { walk_binding_mode(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_block(&mut self, i: &Block) { walk_block(self, i) }
+
+fn visit_body(&mut self, i: &Body) { walk_body(self, i) }
+
+fn visit_body_enum(&mut self, i: &BodyEnum) { walk_body_enum(self, i) }
+
+fn visit_body_struct(&mut self, i: &BodyStruct) { walk_body_struct(self, i) }
+
+fn visit_bound_lifetimes(&mut self, i: &BoundLifetimes) { walk_bound_lifetimes(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_capture_by(&mut self, i: &CaptureBy) { walk_capture_by(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_constness(&mut self, i: &Constness) { walk_constness(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_defaultness(&mut self, i: &Defaultness) { walk_defaultness(self, i) }
+
+fn visit_derive_input(&mut self, i: &DeriveInput) { walk_derive_input(self, i) }
+
+fn visit_expr(&mut self, i: &Expr) { walk_expr(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_addr_of(&mut self, i: &ExprAddrOf) { walk_expr_addr_of(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_array(&mut self, i: &ExprArray) { walk_expr_array(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_assign(&mut self, i: &ExprAssign) { walk_expr_assign(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_assign_op(&mut self, i: &ExprAssignOp) { walk_expr_assign_op(self, i) }
+
+fn visit_expr_binary(&mut self, i: &ExprBinary) { walk_expr_binary(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_block(&mut self, i: &ExprBlock) { walk_expr_block(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_box(&mut self, i: &ExprBox) { walk_expr_box(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_break(&mut self, i: &ExprBreak) { walk_expr_break(self, i) }
+
+fn visit_expr_call(&mut self, i: &ExprCall) { walk_expr_call(self, i) }
+
+fn visit_expr_cast(&mut self, i: &ExprCast) { walk_expr_cast(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_catch(&mut self, i: &ExprCatch) { walk_expr_catch(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_closure(&mut self, i: &ExprClosure) { walk_expr_closure(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_continue(&mut self, i: &ExprContinue) { walk_expr_continue(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_field(&mut self, i: &ExprField) { walk_expr_field(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_for_loop(&mut self, i: &ExprForLoop) { walk_expr_for_loop(self, i) }
+
+fn visit_expr_group(&mut self, i: &ExprGroup) { walk_expr_group(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_if(&mut self, i: &ExprIf) { walk_expr_if(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_if_let(&mut self, i: &ExprIfLet) { walk_expr_if_let(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_in_place(&mut self, i: &ExprInPlace) { walk_expr_in_place(self, i) }
+
+fn visit_expr_index(&mut self, i: &ExprIndex) { walk_expr_index(self, i) }
+
+fn visit_expr_kind(&mut self, i: &ExprKind) { walk_expr_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_loop(&mut self, i: &ExprLoop) { walk_expr_loop(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_match(&mut self, i: &ExprMatch) { walk_expr_match(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_method_call(&mut self, i: &ExprMethodCall) { walk_expr_method_call(self, i) }
+
+fn visit_expr_paren(&mut self, i: &ExprParen) { walk_expr_paren(self, i) }
+
+fn visit_expr_path(&mut self, i: &ExprPath) { walk_expr_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_range(&mut self, i: &ExprRange) { walk_expr_range(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_repeat(&mut self, i: &ExprRepeat) { walk_expr_repeat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_ret(&mut self, i: &ExprRet) { walk_expr_ret(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_struct(&mut self, i: &ExprStruct) { walk_expr_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_try(&mut self, i: &ExprTry) { walk_expr_try(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_tup(&mut self, i: &ExprTup) { walk_expr_tup(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_tup_field(&mut self, i: &ExprTupField) { walk_expr_tup_field(self, i) }
+
+fn visit_expr_type(&mut self, i: &ExprType) { walk_expr_type(self, i) }
+
+fn visit_expr_unary(&mut self, i: &ExprUnary) { walk_expr_unary(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_while(&mut self, i: &ExprWhile) { walk_expr_while(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_while_let(&mut self, i: &ExprWhileLet) { walk_expr_while_let(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_yield(&mut self, i: &ExprYield) { walk_expr_yield(self, i) }
+
+fn visit_field(&mut self, i: &Field) { walk_field(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_field_pat(&mut self, i: &FieldPat) { walk_field_pat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_field_value(&mut self, i: &FieldValue) { walk_field_value(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_file(&mut self, i: &File) { walk_file(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_fn_arg(&mut self, i: &FnArg) { walk_fn_arg(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_fn_decl(&mut self, i: &FnDecl) { walk_fn_decl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item(&mut self, i: &ForeignItem) { walk_foreign_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item_fn(&mut self, i: &ForeignItemFn) { walk_foreign_item_fn(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item_kind(&mut self, i: &ForeignItemKind) { walk_foreign_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item_static(&mut self, i: &ForeignItemStatic) { walk_foreign_item_static(self, i) }
+
+fn visit_function_ret_ty(&mut self, i: &FunctionRetTy) { walk_function_ret_ty(self, i) }
+
+fn visit_generics(&mut self, i: &Generics) { walk_generics(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item(&mut self, i: &ImplItem) { walk_impl_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_const(&mut self, i: &ImplItemConst) { walk_impl_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_kind(&mut self, i: &ImplItemKind) { walk_impl_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_method(&mut self, i: &ImplItemMethod) { walk_impl_item_method(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_type(&mut self, i: &ImplItemType) { walk_impl_item_type(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_polarity(&mut self, i: &ImplPolarity) { walk_impl_polarity(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_in_place_kind(&mut self, i: &InPlaceKind) { walk_in_place_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item(&mut self, i: &Item) { walk_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_const(&mut self, i: &ItemConst) { walk_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_default_impl(&mut self, i: &ItemDefaultImpl) { walk_item_default_impl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_enum(&mut self, i: &ItemEnum) { walk_item_enum(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_extern_crate(&mut self, i: &ItemExternCrate) { walk_item_extern_crate(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_fn(&mut self, i: &ItemFn) { walk_item_fn(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_foreign_mod(&mut self, i: &ItemForeignMod) { walk_item_foreign_mod(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_impl(&mut self, i: &ItemImpl) { walk_item_impl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_kind(&mut self, i: &ItemKind) { walk_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_mod(&mut self, i: &ItemMod) { walk_item_mod(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_static(&mut self, i: &ItemStatic) { walk_item_static(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_struct(&mut self, i: &ItemStruct) { walk_item_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_trait(&mut self, i: &ItemTrait) { walk_item_trait(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_ty(&mut self, i: &ItemTy) { walk_item_ty(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_union(&mut self, i: &ItemUnion) { walk_item_union(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_use(&mut self, i: &ItemUse) { walk_item_use(self, i) }
+
+fn visit_lifetime_def(&mut self, i: &LifetimeDef) { walk_lifetime_def(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_local(&mut self, i: &Local) { walk_local(self, i) }
+
+fn visit_mac(&mut self, i: &Mac) { walk_mac(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_mac_stmt_style(&mut self, i: &MacStmtStyle) { walk_mac_stmt_style(self, i) }
+
+fn visit_meta_item(&mut self, i: &MetaItem) { walk_meta_item(self, i) }
+
+fn visit_meta_item_list(&mut self, i: &MetaItemList) { walk_meta_item_list(self, i) }
+
+fn visit_meta_name_value(&mut self, i: &MetaNameValue) { walk_meta_name_value(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_method_sig(&mut self, i: &MethodSig) { walk_method_sig(self, i) }
+
+fn visit_mut_ty(&mut self, i: &MutTy) { walk_mut_ty(self, i) }
+
+fn visit_mutability(&mut self, i: &Mutability) { walk_mutability(self, i) }
+
+fn visit_nested_meta_item(&mut self, i: &NestedMetaItem) { walk_nested_meta_item(self, i) }
+
+fn visit_parenthesized_parameter_data(&mut self, i: &ParenthesizedParameterData) { walk_parenthesized_parameter_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat(&mut self, i: &Pat) { walk_pat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_box(&mut self, i: &PatBox) { walk_pat_box(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_ident(&mut self, i: &PatIdent) { walk_pat_ident(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_lit(&mut self, i: &PatLit) { walk_pat_lit(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_path(&mut self, i: &PatPath) { walk_pat_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_range(&mut self, i: &PatRange) { walk_pat_range(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_ref(&mut self, i: &PatRef) { walk_pat_ref(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_slice(&mut self, i: &PatSlice) { walk_pat_slice(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_struct(&mut self, i: &PatStruct) { walk_pat_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_tuple(&mut self, i: &PatTuple) { walk_pat_tuple(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_tuple_struct(&mut self, i: &PatTupleStruct) { walk_pat_tuple_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_wild(&mut self, i: &PatWild) { walk_pat_wild(self, i) }
+
+fn visit_path(&mut self, i: &Path) { walk_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_glob(&mut self, i: &PathGlob) { walk_path_glob(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_list(&mut self, i: &PathList) { walk_path_list(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_list_item(&mut self, i: &PathListItem) { walk_path_list_item(self, i) }
+
+fn visit_path_parameters(&mut self, i: &PathParameters) { walk_path_parameters(self, i) }
+
+fn visit_path_segment(&mut self, i: &PathSegment) { walk_path_segment(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_simple(&mut self, i: &PathSimple) { walk_path_simple(self, i) }
+
+fn visit_poly_trait_ref(&mut self, i: &PolyTraitRef) { walk_poly_trait_ref(self, i) }
+
+fn visit_qself(&mut self, i: &QSelf) { walk_qself(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_range_limits(&mut self, i: &RangeLimits) { walk_range_limits(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_stmt(&mut self, i: &Stmt) { walk_stmt(self, i) }
+
+fn visit_trait_bound_modifier(&mut self, i: &TraitBoundModifier) { walk_trait_bound_modifier(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item(&mut self, i: &TraitItem) { walk_trait_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_const(&mut self, i: &TraitItemConst) { walk_trait_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_kind(&mut self, i: &TraitItemKind) { walk_trait_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_method(&mut self, i: &TraitItemMethod) { walk_trait_item_method(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_type(&mut self, i: &TraitItemType) { walk_trait_item_type(self, i) }
+
+fn visit_ty(&mut self, i: &Ty) { walk_ty(self, i) }
+
+fn visit_ty_array(&mut self, i: &TyArray) { walk_ty_array(self, i) }
+
+fn visit_ty_bare_fn(&mut self, i: &TyBareFn) { walk_ty_bare_fn(self, i) }
+
+fn visit_ty_group(&mut self, i: &TyGroup) { walk_ty_group(self, i) }
+
+fn visit_ty_impl_trait(&mut self, i: &TyImplTrait) { walk_ty_impl_trait(self, i) }
+
+fn visit_ty_infer(&mut self, i: &TyInfer) { walk_ty_infer(self, i) }
+
+fn visit_ty_never(&mut self, i: &TyNever) { walk_ty_never(self, i) }
+
+fn visit_ty_param(&mut self, i: &TyParam) { walk_ty_param(self, i) }
+
+fn visit_ty_param_bound(&mut self, i: &TyParamBound) { walk_ty_param_bound(self, i) }
+
+fn visit_ty_paren(&mut self, i: &TyParen) { walk_ty_paren(self, i) }
+
+fn visit_ty_path(&mut self, i: &TyPath) { walk_ty_path(self, i) }
+
+fn visit_ty_ptr(&mut self, i: &TyPtr) { walk_ty_ptr(self, i) }
+
+fn visit_ty_rptr(&mut self, i: &TyRptr) { walk_ty_rptr(self, i) }
+
+fn visit_ty_slice(&mut self, i: &TySlice) { walk_ty_slice(self, i) }
+
+fn visit_ty_trait_object(&mut self, i: &TyTraitObject) { walk_ty_trait_object(self, i) }
+
+fn visit_ty_tup(&mut self, i: &TyTup) { walk_ty_tup(self, i) }
+
+fn visit_type_binding(&mut self, i: &TypeBinding) { walk_type_binding(self, i) }
+
+fn visit_un_op(&mut self, i: &UnOp) { walk_un_op(self, i) }
+
+fn visit_unsafety(&mut self, i: &Unsafety) { walk_unsafety(self, i) }
+
+fn visit_variant(&mut self, i: &Variant) { walk_variant(self, i) }
+
+fn visit_variant_data(&mut self, i: &VariantData) { walk_variant_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_view_path(&mut self, i: &ViewPath) { walk_view_path(self, i) }
+
+fn visit_vis_crate(&mut self, i: &VisCrate) { walk_vis_crate(self, i) }
+
+fn visit_vis_inherited(&mut self, i: &VisInherited) { walk_vis_inherited(self, i) }
+
+fn visit_vis_public(&mut self, i: &VisPublic) { walk_vis_public(self, i) }
+
+fn visit_vis_restricted(&mut self, i: &VisRestricted) { walk_vis_restricted(self, i) }
+
+fn visit_visibility(&mut self, i: &Visibility) { walk_visibility(self, i) }
+
+fn visit_where_bound_predicate(&mut self, i: &WhereBoundPredicate) { walk_where_bound_predicate(self, i) }
+
+fn visit_where_clause(&mut self, i: &WhereClause) { walk_where_clause(self, i) }
+
+fn visit_where_eq_predicate(&mut self, i: &WhereEqPredicate) { walk_where_eq_predicate(self, i) }
+
+fn visit_where_predicate(&mut self, i: &WherePredicate) { walk_where_predicate(self, i) }
+
+fn visit_where_region_predicate(&mut self, i: &WhereRegionPredicate) { walk_where_region_predicate(self, i) }
+
+}
+
+
+pub fn walk_abi<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Abi) {
+ // Skipped field _i . extern_token;
+ _visitor.visit_abi_kind(&_i . kind);
+}
+
+pub fn walk_abi_kind<V: Visitor + ?Sized>(_visitor: &mut V, _i: &AbiKind) {
+ use ::AbiKind::*;
+ match *_i {
+ Named(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Default => { }
+ }
+}
+
+pub fn walk_angle_bracketed_parameter_data<V: Visitor + ?Sized>(_visitor: &mut V, _i: &AngleBracketedParameterData) {
+ // Skipped field _i . turbofish;
+ // Skipped field _i . lt_token;
+ // Skipped field _i . lifetimes;
+ for el in (_i . types).iter() { let it = el.item(); _visitor.visit_ty(&it) };
+ for el in (_i . bindings).iter() { let it = el.item(); _visitor.visit_type_binding(&it) };
+ // Skipped field _i . gt_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_captured<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ArgCaptured) {
+ _visitor.visit_pat(&_i . pat);
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&_i . ty);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_self<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ArgSelf) {
+ _visitor.visit_mutability(&_i . mutbl);
+ // Skipped field _i . self_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_self_ref<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ArgSelfRef) {
+ // Skipped field _i . and_token;
+ // Skipped field _i . self_token;
+ // Skipped field _i . lifetime;
+ _visitor.visit_mutability(&_i . mutbl);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arm<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Arm) {
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ for el in (_i . pats).iter() { let it = el.item(); _visitor.visit_pat(&it) };
+ // Skipped field _i . if_token;
+ // Skipped field _i . guard;
+ // Skipped field _i . rocket_token;
+ _visitor.visit_expr(&_i . body);
+ // Skipped field _i . comma;
+}
+
+pub fn walk_attr_style<V: Visitor + ?Sized>(_visitor: &mut V, _i: &AttrStyle) {
+ use ::AttrStyle::*;
+ match *_i {
+ Outer => { }
+ Inner(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_attribute<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Attribute) {
+ _visitor.visit_attr_style(&_i . style);
+ // Skipped field _i . pound_token;
+ // Skipped field _i . bracket_token;
+ _visitor.visit_path(&_i . path);
+ // Skipped field _i . tts;
+ // Skipped field _i . is_sugared_doc;
+}
+
+pub fn walk_bare_fn_arg<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BareFnArg) {
+ // Skipped field _i . name;
+ _visitor.visit_ty(&_i . ty);
+}
+
+pub fn walk_bare_fn_arg_name<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BareFnArgName) {
+ use ::BareFnArgName::*;
+ match *_i {
+ Named(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Wild(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_bare_fn_ty<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BareFnTy) {
+ // Skipped field _i . lifetimes;
+ _visitor.visit_unsafety(&_i . unsafety);
+ // Skipped field _i . abi;
+ // Skipped field _i . fn_token;
+ // Skipped field _i . paren_token;
+ for el in (_i . inputs).iter() { let it = el.item(); _visitor.visit_bare_fn_arg(&it) };
+ // Skipped field _i . variadic;
+ _visitor.visit_function_ret_ty(&_i . output);
+}
+
+pub fn walk_bin_op<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BinOp) {
+ use ::BinOp::*;
+ match *_i {
+ Add(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Sub(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Mul(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Div(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Rem(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ And(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Or(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitXor(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitAnd(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitOr(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Shl(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Shr(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Eq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Lt(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Le(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Ne(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Ge(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Gt(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ AddEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ SubEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ MulEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ DivEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ RemEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitXorEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitAndEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitOrEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ ShlEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ ShrEq(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_binding_mode<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BindingMode) {
+ use ::BindingMode::*;
+ match *_i {
+ ByRef(ref _binding_0, ref _binding_1, ) => {
+ // Skipped field * _binding_0;
+ _visitor.visit_mutability(&* _binding_1);
+ }
+ ByValue(ref _binding_0, ) => {
+ _visitor.visit_mutability(&* _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_block<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Block) {
+ // Skipped field _i . brace_token;
+ for it in (_i . stmts).iter() { _visitor.visit_stmt(&it) };
+}
+
+pub fn walk_body<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Body) {
+ use ::Body::*;
+ match *_i {
+ Enum(ref _binding_0, ) => {
+ _visitor.visit_body_enum(&* _binding_0);
+ }
+ Struct(ref _binding_0, ) => {
+ _visitor.visit_body_struct(&* _binding_0);
+ }
+ }
+}
+
+pub fn walk_body_enum<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BodyEnum) {
+ // Skipped field _i . enum_token;
+ // Skipped field _i . brace_token;
+ for el in (_i . variants).iter() { let it = el.item(); _visitor.visit_variant(&it) };
+}
+
+pub fn walk_body_struct<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BodyStruct) {
+ _visitor.visit_variant_data(&_i . data);
+ // Skipped field _i . struct_token;
+ // Skipped field _i . semi_token;
+}
+
+pub fn walk_bound_lifetimes<V: Visitor + ?Sized>(_visitor: &mut V, _i: &BoundLifetimes) {
+ // Skipped field _i . for_token;
+ // Skipped field _i . lt_token;
+ for el in (_i . lifetimes).iter() { let it = el.item(); _visitor.visit_lifetime_def(&it) };
+ // Skipped field _i . gt_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_capture_by<V: Visitor + ?Sized>(_visitor: &mut V, _i: &CaptureBy) {
+ use ::CaptureBy::*;
+ match *_i {
+ Value(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Ref => { }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_constness<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Constness) {
+ use ::Constness::*;
+ match *_i {
+ Const(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ NotConst => { }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_defaultness<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Defaultness) {
+ use ::Defaultness::*;
+ match *_i {
+ Default(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Final => { }
+ }
+}
+
+pub fn walk_derive_input<V: Visitor + ?Sized>(_visitor: &mut V, _i: &DeriveInput) {
+ // Skipped field _i . ident;
+ _visitor.visit_visibility(&_i . vis);
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ _visitor.visit_generics(&_i . generics);
+ _visitor.visit_body(&_i . body);
+}
+
+pub fn walk_expr<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Expr) {
+ _visitor.visit_expr_kind(&_i . node);
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_addr_of<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprAddrOf) {
+ // Skipped field _i . and_token;
+ _visitor.visit_mutability(&_i . mutbl);
+ _visitor.visit_expr(&_i . expr);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_array<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprArray) {
+ for el in (_i . exprs).iter() { let it = el.item(); _visitor.visit_expr(&it) };
+ // Skipped field _i . bracket_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_assign<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprAssign) {
+ _visitor.visit_expr(&_i . left);
+ _visitor.visit_expr(&_i . right);
+ // Skipped field _i . eq_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_assign_op<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprAssignOp) {
+ _visitor.visit_bin_op(&_i . op);
+ _visitor.visit_expr(&_i . left);
+ _visitor.visit_expr(&_i . right);
+}
+
+pub fn walk_expr_binary<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprBinary) {
+ _visitor.visit_bin_op(&_i . op);
+ _visitor.visit_expr(&_i . left);
+ _visitor.visit_expr(&_i . right);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_block<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprBlock) {
+ _visitor.visit_unsafety(&_i . unsafety);
+ _visitor.visit_block(&_i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_box<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprBox) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . box_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_break<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprBreak) {
+ // Skipped field _i . label;
+ // Skipped field _i . expr;
+ // Skipped field _i . break_token;
+}
+
+pub fn walk_expr_call<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprCall) {
+ _visitor.visit_expr(&_i . func);
+ for el in (_i . args).iter() { let it = el.item(); _visitor.visit_expr(&it) };
+ // Skipped field _i . paren_token;
+}
+
+pub fn walk_expr_cast<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprCast) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . as_token;
+ _visitor.visit_ty(&_i . ty);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_catch<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprCatch) {
+ // Skipped field _i . do_token;
+ // Skipped field _i . catch_token;
+ _visitor.visit_block(&_i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_closure<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprClosure) {
+ _visitor.visit_capture_by(&_i . capture);
+ _visitor.visit_fn_decl(&_i . decl);
+ _visitor.visit_expr(&_i . body);
+ // Skipped field _i . or1_token;
+ // Skipped field _i . or2_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_continue<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprContinue) {
+ // Skipped field _i . label;
+ // Skipped field _i . continue_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_field<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprField) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . field;
+ // Skipped field _i . dot_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_for_loop<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprForLoop) {
+ _visitor.visit_pat(&_i . pat);
+ _visitor.visit_expr(&_i . expr);
+ _visitor.visit_block(&_i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . for_token;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . in_token;
+}
+
+pub fn walk_expr_group<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprGroup) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . group_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_if<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprIf) {
+ _visitor.visit_expr(&_i . cond);
+ _visitor.visit_block(&_i . if_true);
+ // Skipped field _i . if_false;
+ // Skipped field _i . if_token;
+ // Skipped field _i . else_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_if_let<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprIfLet) {
+ _visitor.visit_pat(&_i . pat);
+ _visitor.visit_expr(&_i . expr);
+ _visitor.visit_block(&_i . if_true);
+ // Skipped field _i . if_false;
+ // Skipped field _i . if_token;
+ // Skipped field _i . let_token;
+ // Skipped field _i . eq_token;
+ // Skipped field _i . else_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_in_place<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprInPlace) {
+ _visitor.visit_expr(&_i . place);
+ _visitor.visit_in_place_kind(&_i . kind);
+ _visitor.visit_expr(&_i . value);
+}
+
+pub fn walk_expr_index<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprIndex) {
+ _visitor.visit_expr(&_i . expr);
+ _visitor.visit_expr(&_i . index);
+ // Skipped field _i . bracket_token;
+}
+
+pub fn walk_expr_kind<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprKind) {
+ use ::ExprKind::*;
+ match *_i {
+ Box(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_box(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ InPlace(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_in_place(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Array(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_array(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Call(ref _binding_0, ) => {
+ _visitor.visit_expr_call(&* _binding_0);
+ }
+ MethodCall(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_method_call(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Tup(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_tup(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Binary(ref _binding_0, ) => {
+ _visitor.visit_expr_binary(&* _binding_0);
+ }
+ Unary(ref _binding_0, ) => {
+ _visitor.visit_expr_unary(&* _binding_0);
+ }
+ Lit(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Cast(ref _binding_0, ) => {
+ _visitor.visit_expr_cast(&* _binding_0);
+ }
+ Type(ref _binding_0, ) => {
+ _visitor.visit_expr_type(&* _binding_0);
+ }
+ If(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_if(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ IfLet(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_if_let(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ While(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_while(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ WhileLet(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_while_let(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ ForLoop(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_for_loop(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Loop(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_loop(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Match(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_match(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Closure(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_closure(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Block(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_block(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Assign(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_assign(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ AssignOp(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_assign_op(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Field(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_field(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ TupField(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_tup_field(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Index(ref _binding_0, ) => {
+ _visitor.visit_expr_index(&* _binding_0);
+ }
+ Range(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_range(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Path(ref _binding_0, ) => {
+ _visitor.visit_expr_path(&* _binding_0);
+ }
+ AddrOf(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_addr_of(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Break(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_break(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Continue(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_continue(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Ret(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_ret(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Mac(ref _binding_0, ) => {
+ _visitor.visit_mac(&* _binding_0);
+ }
+ Struct(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_struct(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Repeat(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_repeat(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Paren(ref _binding_0, ) => {
+ _visitor.visit_expr_paren(&* _binding_0);
+ }
+ Group(ref _binding_0, ) => {
+ _visitor.visit_expr_group(&* _binding_0);
+ }
+ Try(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_try(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Catch(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_catch(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Yield(ref _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_yield(&* _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_loop<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprLoop) {
+ _visitor.visit_block(&_i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . loop_token;
+ // Skipped field _i . colon_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_match<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprMatch) {
+ // Skipped field _i . match_token;
+ // Skipped field _i . brace_token;
+ _visitor.visit_expr(&_i . expr);
+ for it in (_i . arms).iter() { _visitor.visit_arm(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_method_call<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprMethodCall) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . method;
+ for el in (_i . typarams).iter() { let it = el.item(); _visitor.visit_ty(&it) };
+ for el in (_i . args).iter() { let it = el.item(); _visitor.visit_expr(&it) };
+ // Skipped field _i . paren_token;
+ // Skipped field _i . dot_token;
+ // Skipped field _i . lt_token;
+ // Skipped field _i . colon2_token;
+ // Skipped field _i . gt_token;
+}
+
+pub fn walk_expr_paren<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprParen) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . paren_token;
+}
+
+pub fn walk_expr_path<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprPath) {
+ // Skipped field _i . qself;
+ _visitor.visit_path(&_i . path);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_range<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprRange) {
+ // Skipped field _i . from;
+ // Skipped field _i . to;
+ _visitor.visit_range_limits(&_i . limits);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_repeat<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprRepeat) {
+ // Skipped field _i . bracket_token;
+ // Skipped field _i . semi_token;
+ _visitor.visit_expr(&_i . expr);
+ _visitor.visit_expr(&_i . amt);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_ret<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprRet) {
+ // Skipped field _i . expr;
+ // Skipped field _i . return_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_struct<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprStruct) {
+ _visitor.visit_path(&_i . path);
+ for el in (_i . fields).iter() { let it = el.item(); _visitor.visit_field_value(&it) };
+ // Skipped field _i . rest;
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . brace_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_try<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprTry) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . question_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_tup<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprTup) {
+ for el in (_i . args).iter() { let it = el.item(); _visitor.visit_expr(&it) };
+ // Skipped field _i . paren_token;
+ // Skipped field _i . lone_comma;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_tup_field<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprTupField) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . field;
+ // Skipped field _i . dot_token;
+}
+
+pub fn walk_expr_type<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprType) {
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&_i . ty);
+}
+
+pub fn walk_expr_unary<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprUnary) {
+ _visitor.visit_un_op(&_i . op);
+ _visitor.visit_expr(&_i . expr);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_while<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprWhile) {
+ _visitor.visit_expr(&_i . cond);
+ _visitor.visit_block(&_i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . while_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_while_let<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprWhileLet) {
+ _visitor.visit_pat(&_i . pat);
+ _visitor.visit_expr(&_i . expr);
+ _visitor.visit_block(&_i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . while_token;
+ // Skipped field _i . let_token;
+ // Skipped field _i . eq_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_yield<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ExprYield) {
+ // Skipped field _i . yield_token;
+ // Skipped field _i . expr;
+}
+
+pub fn walk_field<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Field) {
+ // Skipped field _i . ident;
+ _visitor.visit_visibility(&_i . vis);
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . colon_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_field_pat<V: Visitor + ?Sized>(_visitor: &mut V, _i: &FieldPat) {
+ // Skipped field _i . ident;
+ _visitor.visit_pat(&_i . pat);
+ // Skipped field _i . is_shorthand;
+ // Skipped field _i . colon_token;
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_field_value<V: Visitor + ?Sized>(_visitor: &mut V, _i: &FieldValue) {
+ // Skipped field _i . ident;
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . is_shorthand;
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ // Skipped field _i . colon_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_file<V: Visitor + ?Sized>(_visitor: &mut V, _i: &File) {
+ // Skipped field _i . shebang;
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ for it in (_i . items).iter() { _visitor.visit_item(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_fn_arg<V: Visitor + ?Sized>(_visitor: &mut V, _i: &FnArg) {
+ use ::FnArg::*;
+ match *_i {
+ SelfRef(ref _binding_0, ) => {
+ _visitor.visit_arg_self_ref(&* _binding_0);
+ }
+ SelfValue(ref _binding_0, ) => {
+ _visitor.visit_arg_self(&* _binding_0);
+ }
+ Captured(ref _binding_0, ) => {
+ _visitor.visit_arg_captured(&* _binding_0);
+ }
+ Ignored(ref _binding_0, ) => {
+ _visitor.visit_ty(&* _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_fn_decl<V: Visitor + ?Sized>(_visitor: &mut V, _i: &FnDecl) {
+ // Skipped field _i . fn_token;
+ // Skipped field _i . paren_token;
+ for el in (_i . inputs).iter() { let it = el.item(); _visitor.visit_fn_arg(&it) };
+ _visitor.visit_function_ret_ty(&_i . output);
+ _visitor.visit_generics(&_i . generics);
+ // Skipped field _i . variadic;
+ // Skipped field _i . dot_tokens;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ForeignItem) {
+ // Skipped field _i . ident;
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ _visitor.visit_foreign_item_kind(&_i . node);
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_fn<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ForeignItemFn) {
+ _visitor.visit_fn_decl(&_i . decl);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_kind<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ForeignItemKind) {
+ use ::ForeignItemKind::*;
+ match *_i {
+ Fn(ref _binding_0, ) => {
+ _visitor.visit_foreign_item_fn(&* _binding_0);
+ }
+ Static(ref _binding_0, ) => {
+ _visitor.visit_foreign_item_static(&* _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_static<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ForeignItemStatic) {
+ // Skipped field _i . static_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . colon_token;
+ _visitor.visit_mutability(&_i . mutbl);
+}
+
+pub fn walk_function_ret_ty<V: Visitor + ?Sized>(_visitor: &mut V, _i: &FunctionRetTy) {
+ use ::FunctionRetTy::*;
+ match *_i {
+ Default => { }
+ Ty(ref _binding_0, ref _binding_1, ) => {
+ _visitor.visit_ty(&* _binding_0);
+ // Skipped field * _binding_1;
+ }
+ }
+}
+
+pub fn walk_generics<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Generics) {
+ // Skipped field _i . lt_token;
+ // Skipped field _i . gt_token;
+ for el in (_i . lifetimes).iter() { let it = el.item(); _visitor.visit_lifetime_def(&it) };
+ for el in (_i . ty_params).iter() { let it = el.item(); _visitor.visit_ty_param(&it) };
+ _visitor.visit_where_clause(&_i . where_clause);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ImplItem) {
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ _visitor.visit_impl_item_kind(&_i . node);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_const<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ImplItemConst) {
+ _visitor.visit_visibility(&_i . vis);
+ _visitor.visit_defaultness(&_i . defaultness);
+ // Skipped field _i . const_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_kind<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ImplItemKind) {
+ use ::ImplItemKind::*;
+ match *_i {
+ Const(ref _binding_0, ) => {
+ _visitor.visit_impl_item_const(&* _binding_0);
+ }
+ Method(ref _binding_0, ) => {
+ _visitor.visit_impl_item_method(&* _binding_0);
+ }
+ Type(ref _binding_0, ) => {
+ _visitor.visit_impl_item_type(&* _binding_0);
+ }
+ Macro(ref _binding_0, ) => {
+ _visitor.visit_mac(&* _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_method<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ImplItemMethod) {
+ _visitor.visit_visibility(&_i . vis);
+ _visitor.visit_defaultness(&_i . defaultness);
+ _visitor.visit_method_sig(&_i . sig);
+ _visitor.visit_block(&_i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_type<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ImplItemType) {
+ _visitor.visit_visibility(&_i . vis);
+ _visitor.visit_defaultness(&_i . defaultness);
+ // Skipped field _i . type_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_polarity<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ImplPolarity) {
+ use ::ImplPolarity::*;
+ match *_i {
+ Positive => { }
+ Negative(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_in_place_kind<V: Visitor + ?Sized>(_visitor: &mut V, _i: &InPlaceKind) {
+ use ::InPlaceKind::*;
+ match *_i {
+ Arrow(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ In(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Item) {
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ _visitor.visit_item_kind(&_i . node);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_const<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemConst) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . const_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_default_impl<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemDefaultImpl) {
+ _visitor.visit_unsafety(&_i . unsafety);
+ // Skipped field _i . impl_token;
+ _visitor.visit_path(&_i . path);
+ // Skipped field _i . for_token;
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . brace_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_enum<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemEnum) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . enum_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&_i . generics);
+ // Skipped field _i . brace_token;
+ for el in (_i . variants).iter() { let it = el.item(); _visitor.visit_variant(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_extern_crate<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemExternCrate) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . extern_token;
+ // Skipped field _i . crate_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . rename;
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_fn<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemFn) {
+ _visitor.visit_visibility(&_i . vis);
+ _visitor.visit_constness(&_i . constness);
+ _visitor.visit_unsafety(&_i . unsafety);
+ // Skipped field _i . abi;
+ _visitor.visit_fn_decl(&_i . decl);
+ // Skipped field _i . ident;
+ _visitor.visit_block(&_i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_foreign_mod<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemForeignMod) {
+ _visitor.visit_abi(&_i . abi);
+ // Skipped field _i . brace_token;
+ for it in (_i . items).iter() { _visitor.visit_foreign_item(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_impl<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemImpl) {
+ _visitor.visit_defaultness(&_i . defaultness);
+ _visitor.visit_unsafety(&_i . unsafety);
+ // Skipped field _i . impl_token;
+ _visitor.visit_generics(&_i . generics);
+ // Skipped field _i . trait_;
+ _visitor.visit_ty(&_i . self_ty);
+ // Skipped field _i . brace_token;
+ for it in (_i . items).iter() { _visitor.visit_impl_item(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_kind<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemKind) {
+ use ::ItemKind::*;
+ match *_i {
+ ExternCrate(ref _binding_0, ) => {
+ _visitor.visit_item_extern_crate(&* _binding_0);
+ }
+ Use(ref _binding_0, ) => {
+ _visitor.visit_item_use(&* _binding_0);
+ }
+ Static(ref _binding_0, ) => {
+ _visitor.visit_item_static(&* _binding_0);
+ }
+ Const(ref _binding_0, ) => {
+ _visitor.visit_item_const(&* _binding_0);
+ }
+ Fn(ref _binding_0, ) => {
+ _visitor.visit_item_fn(&* _binding_0);
+ }
+ Mod(ref _binding_0, ) => {
+ _visitor.visit_item_mod(&* _binding_0);
+ }
+ ForeignMod(ref _binding_0, ) => {
+ _visitor.visit_item_foreign_mod(&* _binding_0);
+ }
+ Ty(ref _binding_0, ) => {
+ _visitor.visit_item_ty(&* _binding_0);
+ }
+ Enum(ref _binding_0, ) => {
+ _visitor.visit_item_enum(&* _binding_0);
+ }
+ Struct(ref _binding_0, ) => {
+ _visitor.visit_item_struct(&* _binding_0);
+ }
+ Union(ref _binding_0, ) => {
+ _visitor.visit_item_union(&* _binding_0);
+ }
+ Trait(ref _binding_0, ) => {
+ _visitor.visit_item_trait(&* _binding_0);
+ }
+ DefaultImpl(ref _binding_0, ) => {
+ _visitor.visit_item_default_impl(&* _binding_0);
+ }
+ Impl(ref _binding_0, ) => {
+ _visitor.visit_item_impl(&* _binding_0);
+ }
+ Mac(ref _binding_0, ) => {
+ _visitor.visit_mac(&* _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_mod<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemMod) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . mod_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . content;
+ // Skipped field _i . semi;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_static<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemStatic) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . static_token;
+ _visitor.visit_mutability(&_i . mutbl);
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_expr(&_i . expr);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_struct<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemStruct) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . struct_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&_i . generics);
+ _visitor.visit_variant_data(&_i . data);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_trait<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemTrait) {
+ _visitor.visit_visibility(&_i . vis);
+ _visitor.visit_unsafety(&_i . unsafety);
+ // Skipped field _i . trait_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&_i . generics);
+ // Skipped field _i . colon_token;
+ for el in (_i . supertraits).iter() { let it = el.item(); _visitor.visit_ty_param_bound(&it) };
+ // Skipped field _i . brace_token;
+ for it in (_i . items).iter() { _visitor.visit_trait_item(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_ty<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemTy) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . type_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&_i . generics);
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_union<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemUnion) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . union_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&_i . generics);
+ _visitor.visit_variant_data(&_i . data);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_use<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ItemUse) {
+ _visitor.visit_visibility(&_i . vis);
+ // Skipped field _i . use_token;
+ _visitor.visit_view_path(&_i . path);
+ // Skipped field _i . semi_token;
+}
+
+pub fn walk_lifetime_def<V: Visitor + ?Sized>(_visitor: &mut V, _i: &LifetimeDef) {
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ // Skipped field _i . lifetime;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . bounds;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_local<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Local) {
+ // Skipped field _i . let_token;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . eq_token;
+ // Skipped field _i . semi_token;
+ _visitor.visit_pat(&_i . pat);
+ // Skipped field _i . ty;
+ // Skipped field _i . init;
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+}
+
+pub fn walk_mac<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Mac) {
+ _visitor.visit_path(&_i . path);
+ // Skipped field _i . bang_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . tokens;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_mac_stmt_style<V: Visitor + ?Sized>(_visitor: &mut V, _i: &MacStmtStyle) {
+ use ::MacStmtStyle::*;
+ match *_i {
+ Semicolon(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Braces => { }
+ NoBraces => { }
+ }
+}
+
+pub fn walk_meta_item<V: Visitor + ?Sized>(_visitor: &mut V, _i: &MetaItem) {
+ use ::MetaItem::*;
+ match *_i {
+ Term(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ List(ref _binding_0, ) => {
+ _visitor.visit_meta_item_list(&* _binding_0);
+ }
+ NameValue(ref _binding_0, ) => {
+ _visitor.visit_meta_name_value(&* _binding_0);
+ }
+ }
+}
+
+pub fn walk_meta_item_list<V: Visitor + ?Sized>(_visitor: &mut V, _i: &MetaItemList) {
+ // Skipped field _i . ident;
+ // Skipped field _i . paren_token;
+ for el in (_i . nested).iter() { let it = el.item(); _visitor.visit_nested_meta_item(&it) };
+}
+
+pub fn walk_meta_name_value<V: Visitor + ?Sized>(_visitor: &mut V, _i: &MetaNameValue) {
+ // Skipped field _i . ident;
+ // Skipped field _i . eq_token;
+ // Skipped field _i . lit;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_method_sig<V: Visitor + ?Sized>(_visitor: &mut V, _i: &MethodSig) {
+ _visitor.visit_constness(&_i . constness);
+ _visitor.visit_unsafety(&_i . unsafety);
+ // Skipped field _i . abi;
+ // Skipped field _i . ident;
+ _visitor.visit_fn_decl(&_i . decl);
+}
+
+pub fn walk_mut_ty<V: Visitor + ?Sized>(_visitor: &mut V, _i: &MutTy) {
+ _visitor.visit_ty(&_i . ty);
+ _visitor.visit_mutability(&_i . mutability);
+}
+
+pub fn walk_mutability<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Mutability) {
+ use ::Mutability::*;
+ match *_i {
+ Mutable(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Immutable => { }
+ }
+}
+
+pub fn walk_nested_meta_item<V: Visitor + ?Sized>(_visitor: &mut V, _i: &NestedMetaItem) {
+ use ::NestedMetaItem::*;
+ match *_i {
+ MetaItem(ref _binding_0, ) => {
+ _visitor.visit_meta_item(&* _binding_0);
+ }
+ Literal(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_parenthesized_parameter_data<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ParenthesizedParameterData) {
+ // Skipped field _i . paren_token;
+ for el in (_i . inputs).iter() { let it = el.item(); _visitor.visit_ty(&it) };
+ _visitor.visit_function_ret_ty(&_i . output);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Pat) {
+ use ::Pat::*;
+ match *_i {
+ Wild(ref _binding_0, ) => {
+ _visitor.visit_pat_wild(&* _binding_0);
+ }
+ Ident(ref _binding_0, ) => {
+ _visitor.visit_pat_ident(&* _binding_0);
+ }
+ Struct(ref _binding_0, ) => {
+ _visitor.visit_pat_struct(&* _binding_0);
+ }
+ TupleStruct(ref _binding_0, ) => {
+ _visitor.visit_pat_tuple_struct(&* _binding_0);
+ }
+ Path(ref _binding_0, ) => {
+ _visitor.visit_pat_path(&* _binding_0);
+ }
+ Tuple(ref _binding_0, ) => {
+ _visitor.visit_pat_tuple(&* _binding_0);
+ }
+ Box(ref _binding_0, ) => {
+ _visitor.visit_pat_box(&* _binding_0);
+ }
+ Ref(ref _binding_0, ) => {
+ _visitor.visit_pat_ref(&* _binding_0);
+ }
+ Lit(ref _binding_0, ) => {
+ _visitor.visit_pat_lit(&* _binding_0);
+ }
+ Range(ref _binding_0, ) => {
+ _visitor.visit_pat_range(&* _binding_0);
+ }
+ Slice(ref _binding_0, ) => {
+ _visitor.visit_pat_slice(&* _binding_0);
+ }
+ Mac(ref _binding_0, ) => {
+ _visitor.visit_mac(&* _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_box<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatBox) {
+ _visitor.visit_pat(&_i . pat);
+ // Skipped field _i . box_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_ident<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatIdent) {
+ _visitor.visit_binding_mode(&_i . mode);
+ // Skipped field _i . ident;
+ // Skipped field _i . subpat;
+ // Skipped field _i . at_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_lit<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatLit) {
+ _visitor.visit_expr(&_i . expr);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_path<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatPath) {
+ // Skipped field _i . qself;
+ _visitor.visit_path(&_i . path);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_range<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatRange) {
+ _visitor.visit_expr(&_i . lo);
+ _visitor.visit_expr(&_i . hi);
+ _visitor.visit_range_limits(&_i . limits);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_ref<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatRef) {
+ _visitor.visit_pat(&_i . pat);
+ _visitor.visit_mutability(&_i . mutbl);
+ // Skipped field _i . and_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_slice<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatSlice) {
+ for el in (_i . front).iter() { let it = el.item(); _visitor.visit_pat(&it) };
+ // Skipped field _i . middle;
+ for el in (_i . back).iter() { let it = el.item(); _visitor.visit_pat(&it) };
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . comma_token;
+ // Skipped field _i . bracket_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_struct<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatStruct) {
+ _visitor.visit_path(&_i . path);
+ for el in (_i . fields).iter() { let it = el.item(); _visitor.visit_field_pat(&it) };
+ // Skipped field _i . brace_token;
+ // Skipped field _i . dot2_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_tuple<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatTuple) {
+ for el in (_i . pats).iter() { let it = el.item(); _visitor.visit_pat(&it) };
+ // Skipped field _i . dots_pos;
+ // Skipped field _i . paren_token;
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . comma_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_tuple_struct<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatTupleStruct) {
+ _visitor.visit_path(&_i . path);
+ _visitor.visit_pat_tuple(&_i . pat);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_wild<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PatWild) {
+ // Skipped field _i . underscore_token;
+}
+
+pub fn walk_path<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Path) {
+ // Skipped field _i . leading_colon;
+ for el in (_i . segments).iter() { let it = el.item(); _visitor.visit_path_segment(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_glob<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PathGlob) {
+ _visitor.visit_path(&_i . path);
+ // Skipped field _i . colon2_token;
+ // Skipped field _i . star_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_list<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PathList) {
+ _visitor.visit_path(&_i . path);
+ // Skipped field _i . colon2_token;
+ // Skipped field _i . brace_token;
+ for el in (_i . items).iter() { let it = el.item(); _visitor.visit_path_list_item(&it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_list_item<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PathListItem) {
+ // Skipped field _i . name;
+ // Skipped field _i . rename;
+ // Skipped field _i . as_token;
+}
+
+pub fn walk_path_parameters<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PathParameters) {
+ use ::PathParameters::*;
+ match *_i {
+ None => { }
+ AngleBracketed(ref _binding_0, ) => {
+ _visitor.visit_angle_bracketed_parameter_data(&* _binding_0);
+ }
+ Parenthesized(ref _binding_0, ) => {
+ _visitor.visit_parenthesized_parameter_data(&* _binding_0);
+ }
+ }
+}
+
+pub fn walk_path_segment<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PathSegment) {
+ // Skipped field _i . ident;
+ _visitor.visit_path_parameters(&_i . parameters);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_simple<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PathSimple) {
+ _visitor.visit_path(&_i . path);
+ // Skipped field _i . as_token;
+ // Skipped field _i . rename;
+}
+
+pub fn walk_poly_trait_ref<V: Visitor + ?Sized>(_visitor: &mut V, _i: &PolyTraitRef) {
+ // Skipped field _i . bound_lifetimes;
+ _visitor.visit_path(&_i . trait_ref);
+}
+
+pub fn walk_qself<V: Visitor + ?Sized>(_visitor: &mut V, _i: &QSelf) {
+ // Skipped field _i . lt_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . position;
+ // Skipped field _i . as_token;
+ // Skipped field _i . gt_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_range_limits<V: Visitor + ?Sized>(_visitor: &mut V, _i: &RangeLimits) {
+ use ::RangeLimits::*;
+ match *_i {
+ HalfOpen(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Closed(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_stmt<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Stmt) {
+ use ::Stmt::*;
+ match *_i {
+ Local(ref _binding_0, ) => {
+ _visitor.visit_local(&* _binding_0);
+ }
+ Item(ref _binding_0, ) => {
+ _visitor.visit_item(&* _binding_0);
+ }
+ Expr(ref _binding_0, ) => {
+ _visitor.visit_expr(&* _binding_0);
+ }
+ Semi(ref _binding_0, ref _binding_1, ) => {
+ _visitor.visit_expr(&* _binding_0);
+ // Skipped field * _binding_1;
+ }
+ Mac(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_trait_bound_modifier<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TraitBoundModifier) {
+ use ::TraitBoundModifier::*;
+ match *_i {
+ None => { }
+ Maybe(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TraitItem) {
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ _visitor.visit_trait_item_kind(&_i . node);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_const<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TraitItemConst) {
+ // Skipped field _i . const_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . default;
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_kind<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TraitItemKind) {
+ use ::TraitItemKind::*;
+ match *_i {
+ Const(ref _binding_0, ) => {
+ _visitor.visit_trait_item_const(&* _binding_0);
+ }
+ Method(ref _binding_0, ) => {
+ _visitor.visit_trait_item_method(&* _binding_0);
+ }
+ Type(ref _binding_0, ) => {
+ _visitor.visit_trait_item_type(&* _binding_0);
+ }
+ Macro(ref _binding_0, ) => {
+ _visitor.visit_mac(&* _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_method<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TraitItemMethod) {
+ _visitor.visit_method_sig(&_i . sig);
+ // Skipped field _i . default;
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_type<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TraitItemType) {
+ // Skipped field _i . type_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ for el in (_i . bounds).iter() { let it = el.item(); _visitor.visit_ty_param_bound(&it) };
+ // Skipped field _i . default;
+ // Skipped field _i . semi_token;
+}
+
+pub fn walk_ty<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Ty) {
+ use ::Ty::*;
+ match *_i {
+ Slice(ref _binding_0, ) => {
+ _visitor.visit_ty_slice(&* _binding_0);
+ }
+ Array(ref _binding_0, ) => {
+ _visitor.visit_ty_array(&* _binding_0);
+ }
+ Ptr(ref _binding_0, ) => {
+ _visitor.visit_ty_ptr(&* _binding_0);
+ }
+ Rptr(ref _binding_0, ) => {
+ _visitor.visit_ty_rptr(&* _binding_0);
+ }
+ BareFn(ref _binding_0, ) => {
+ _visitor.visit_ty_bare_fn(&* _binding_0);
+ }
+ Never(ref _binding_0, ) => {
+ _visitor.visit_ty_never(&* _binding_0);
+ }
+ Tup(ref _binding_0, ) => {
+ _visitor.visit_ty_tup(&* _binding_0);
+ }
+ Path(ref _binding_0, ) => {
+ _visitor.visit_ty_path(&* _binding_0);
+ }
+ TraitObject(ref _binding_0, ) => {
+ _visitor.visit_ty_trait_object(&* _binding_0);
+ }
+ ImplTrait(ref _binding_0, ) => {
+ _visitor.visit_ty_impl_trait(&* _binding_0);
+ }
+ Paren(ref _binding_0, ) => {
+ _visitor.visit_ty_paren(&* _binding_0);
+ }
+ Group(ref _binding_0, ) => {
+ _visitor.visit_ty_group(&* _binding_0);
+ }
+ Infer(ref _binding_0, ) => {
+ _visitor.visit_ty_infer(&* _binding_0);
+ }
+ Mac(ref _binding_0, ) => {
+ _visitor.visit_mac(&* _binding_0);
+ }
+ }
+}
+
+pub fn walk_ty_array<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyArray) {
+ // Skipped field _i . bracket_token;
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . semi_token;
+ _visitor.visit_expr(&_i . amt);
+}
+
+pub fn walk_ty_bare_fn<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyBareFn) {
+ _visitor.visit_bare_fn_ty(&_i . ty);
+}
+
+pub fn walk_ty_group<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyGroup) {
+ // Skipped field _i . group_token;
+ _visitor.visit_ty(&_i . ty);
+}
+
+pub fn walk_ty_impl_trait<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyImplTrait) {
+ // Skipped field _i . impl_token;
+ for el in (_i . bounds).iter() { let it = el.item(); _visitor.visit_ty_param_bound(&it) };
+}
+
+pub fn walk_ty_infer<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyInfer) {
+ // Skipped field _i . underscore_token;
+}
+
+pub fn walk_ty_never<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyNever) {
+ // Skipped field _i . bang_token;
+}
+
+pub fn walk_ty_param<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyParam) {
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ for el in (_i . bounds).iter() { let it = el.item(); _visitor.visit_ty_param_bound(&it) };
+ // Skipped field _i . eq_token;
+ // Skipped field _i . default;
+}
+
+pub fn walk_ty_param_bound<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyParamBound) {
+ use ::TyParamBound::*;
+ match *_i {
+ Trait(ref _binding_0, ref _binding_1, ) => {
+ _visitor.visit_poly_trait_ref(&* _binding_0);
+ _visitor.visit_trait_bound_modifier(&* _binding_1);
+ }
+ Region(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_ty_paren<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyParen) {
+ // Skipped field _i . paren_token;
+ _visitor.visit_ty(&_i . ty);
+}
+
+pub fn walk_ty_path<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyPath) {
+ // Skipped field _i . qself;
+ _visitor.visit_path(&_i . path);
+}
+
+pub fn walk_ty_ptr<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyPtr) {
+ // Skipped field _i . star_token;
+ // Skipped field _i . const_token;
+ _visitor.visit_mut_ty(&_i . ty);
+}
+
+pub fn walk_ty_rptr<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyRptr) {
+ // Skipped field _i . and_token;
+ // Skipped field _i . lifetime;
+ _visitor.visit_mut_ty(&_i . ty);
+}
+
+pub fn walk_ty_slice<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TySlice) {
+ _visitor.visit_ty(&_i . ty);
+ // Skipped field _i . bracket_token;
+}
+
+pub fn walk_ty_trait_object<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyTraitObject) {
+ for el in (_i . bounds).iter() { let it = el.item(); _visitor.visit_ty_param_bound(&it) };
+}
+
+pub fn walk_ty_tup<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TyTup) {
+ // Skipped field _i . paren_token;
+ for el in (_i . tys).iter() { let it = el.item(); _visitor.visit_ty(&it) };
+ // Skipped field _i . lone_comma;
+}
+
+pub fn walk_type_binding<V: Visitor + ?Sized>(_visitor: &mut V, _i: &TypeBinding) {
+ // Skipped field _i . ident;
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&_i . ty);
+}
+
+pub fn walk_un_op<V: Visitor + ?Sized>(_visitor: &mut V, _i: &UnOp) {
+ use ::UnOp::*;
+ match *_i {
+ Deref(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Not(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Neg(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_unsafety<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Unsafety) {
+ use ::Unsafety::*;
+ match *_i {
+ Unsafe(ref _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Normal => { }
+ }
+}
+
+pub fn walk_variant<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Variant) {
+ // Skipped field _i . ident;
+ for it in (_i . attrs).iter() { _visitor.visit_attribute(&it) };
+ _visitor.visit_variant_data(&_i . data);
+ // Skipped field _i . discriminant;
+ // Skipped field _i . eq_token;
+}
+
+pub fn walk_variant_data<V: Visitor + ?Sized>(_visitor: &mut V, _i: &VariantData) {
+ use ::VariantData::*;
+ match *_i {
+ Struct(ref _binding_0, ref _binding_1, ) => {
+ for el in (* _binding_0).iter() { let it = el.item(); _visitor.visit_field(&it) };
+ // Skipped field * _binding_1;
+ }
+ Tuple(ref _binding_0, ref _binding_1, ) => {
+ for el in (* _binding_0).iter() { let it = el.item(); _visitor.visit_field(&it) };
+ // Skipped field * _binding_1;
+ }
+ Unit => { }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_view_path<V: Visitor + ?Sized>(_visitor: &mut V, _i: &ViewPath) {
+ use ::ViewPath::*;
+ match *_i {
+ Simple(ref _binding_0, ) => {
+ _visitor.visit_path_simple(&* _binding_0);
+ }
+ Glob(ref _binding_0, ) => {
+ _visitor.visit_path_glob(&* _binding_0);
+ }
+ List(ref _binding_0, ) => {
+ _visitor.visit_path_list(&* _binding_0);
+ }
+ }
+}
+
+pub fn walk_vis_crate<V: Visitor + ?Sized>(_visitor: &mut V, _i: &VisCrate) {
+ // Skipped field _i . pub_token;
+ // Skipped field _i . paren_token;
+ // Skipped field _i . crate_token;
+}
+
+pub fn walk_vis_inherited<V: Visitor + ?Sized>(_visitor: &mut V, _i: &VisInherited) {
+}
+
+pub fn walk_vis_public<V: Visitor + ?Sized>(_visitor: &mut V, _i: &VisPublic) {
+ // Skipped field _i . pub_token;
+}
+
+pub fn walk_vis_restricted<V: Visitor + ?Sized>(_visitor: &mut V, _i: &VisRestricted) {
+ // Skipped field _i . pub_token;
+ // Skipped field _i . paren_token;
+ // Skipped field _i . in_token;
+ _visitor.visit_path(&_i . path);
+}
+
+pub fn walk_visibility<V: Visitor + ?Sized>(_visitor: &mut V, _i: &Visibility) {
+ use ::Visibility::*;
+ match *_i {
+ Public(ref _binding_0, ) => {
+ _visitor.visit_vis_public(&* _binding_0);
+ }
+ Crate(ref _binding_0, ) => {
+ _visitor.visit_vis_crate(&* _binding_0);
+ }
+ Restricted(ref _binding_0, ) => {
+ _visitor.visit_vis_restricted(&* _binding_0);
+ }
+ Inherited(ref _binding_0, ) => {
+ _visitor.visit_vis_inherited(&* _binding_0);
+ }
+ }
+}
+
+pub fn walk_where_bound_predicate<V: Visitor + ?Sized>(_visitor: &mut V, _i: &WhereBoundPredicate) {
+ // Skipped field _i . bound_lifetimes;
+ _visitor.visit_ty(&_i . bounded_ty);
+ // Skipped field _i . colon_token;
+ for el in (_i . bounds).iter() { let it = el.item(); _visitor.visit_ty_param_bound(&it) };
+}
+
+pub fn walk_where_clause<V: Visitor + ?Sized>(_visitor: &mut V, _i: &WhereClause) {
+ // Skipped field _i . where_token;
+ for el in (_i . predicates).iter() { let it = el.item(); _visitor.visit_where_predicate(&it) };
+}
+
+pub fn walk_where_eq_predicate<V: Visitor + ?Sized>(_visitor: &mut V, _i: &WhereEqPredicate) {
+ _visitor.visit_ty(&_i . lhs_ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&_i . rhs_ty);
+}
+
+pub fn walk_where_predicate<V: Visitor + ?Sized>(_visitor: &mut V, _i: &WherePredicate) {
+ use ::WherePredicate::*;
+ match *_i {
+ BoundPredicate(ref _binding_0, ) => {
+ _visitor.visit_where_bound_predicate(&* _binding_0);
+ }
+ RegionPredicate(ref _binding_0, ) => {
+ _visitor.visit_where_region_predicate(&* _binding_0);
+ }
+ EqPredicate(ref _binding_0, ) => {
+ _visitor.visit_where_eq_predicate(&* _binding_0);
+ }
+ }
+}
+
+pub fn walk_where_region_predicate<V: Visitor + ?Sized>(_visitor: &mut V, _i: &WhereRegionPredicate) {
+ // Skipped field _i . lifetime;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . bounds;
+}
+
diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs
new file mode 100644
index 0000000..aefb7cc
--- /dev/null
+++ b/src/gen/visit_mut.rs
@@ -0,0 +1,2025 @@
+
+// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
+
+//! AST walker. Each overridden visit method has full control over what
+//! happens with its node, it can do its own traversal of the node's children,
+//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
+//! deeper traversal by doing nothing.
+
+use super::*;
+
+/// Each method of the VisitorMut trait is a hook to be potentially
+/// overridden. Each method's default implementation recursively visits
+/// the substructure of the input via the corresponding `walk` method;
+/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
+///
+/// If you want to ensure that your code handles every variant
+/// explicitly, you need to override each method. (And you also need
+/// to monitor future changes to `VisitorMut` in case a new method with a
+/// new default implementation gets introduced.)
+pub trait VisitorMut {
+
+fn visit_abi(&mut self, i: &mut Abi) { walk_abi(self, i) }
+
+fn visit_abi_kind(&mut self, i: &mut AbiKind) { walk_abi_kind(self, i) }
+
+fn visit_angle_bracketed_parameter_data(&mut self, i: &mut AngleBracketedParameterData) { walk_angle_bracketed_parameter_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arg_captured(&mut self, i: &mut ArgCaptured) { walk_arg_captured(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arg_self(&mut self, i: &mut ArgSelf) { walk_arg_self(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arg_self_ref(&mut self, i: &mut ArgSelfRef) { walk_arg_self_ref(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_arm(&mut self, i: &mut Arm) { walk_arm(self, i) }
+
+fn visit_attr_style(&mut self, i: &mut AttrStyle) { walk_attr_style(self, i) }
+
+fn visit_attribute(&mut self, i: &mut Attribute) { walk_attribute(self, i) }
+
+fn visit_bare_fn_arg(&mut self, i: &mut BareFnArg) { walk_bare_fn_arg(self, i) }
+
+fn visit_bare_fn_arg_name(&mut self, i: &mut BareFnArgName) { walk_bare_fn_arg_name(self, i) }
+
+fn visit_bare_fn_ty(&mut self, i: &mut BareFnTy) { walk_bare_fn_ty(self, i) }
+
+fn visit_bin_op(&mut self, i: &mut BinOp) { walk_bin_op(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_binding_mode(&mut self, i: &mut BindingMode) { walk_binding_mode(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_block(&mut self, i: &mut Block) { walk_block(self, i) }
+
+fn visit_body(&mut self, i: &mut Body) { walk_body(self, i) }
+
+fn visit_body_enum(&mut self, i: &mut BodyEnum) { walk_body_enum(self, i) }
+
+fn visit_body_struct(&mut self, i: &mut BodyStruct) { walk_body_struct(self, i) }
+
+fn visit_bound_lifetimes(&mut self, i: &mut BoundLifetimes) { walk_bound_lifetimes(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_capture_by(&mut self, i: &mut CaptureBy) { walk_capture_by(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_constness(&mut self, i: &mut Constness) { walk_constness(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_defaultness(&mut self, i: &mut Defaultness) { walk_defaultness(self, i) }
+
+fn visit_derive_input(&mut self, i: &mut DeriveInput) { walk_derive_input(self, i) }
+
+fn visit_expr(&mut self, i: &mut Expr) { walk_expr(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_addr_of(&mut self, i: &mut ExprAddrOf) { walk_expr_addr_of(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_array(&mut self, i: &mut ExprArray) { walk_expr_array(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_assign(&mut self, i: &mut ExprAssign) { walk_expr_assign(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_assign_op(&mut self, i: &mut ExprAssignOp) { walk_expr_assign_op(self, i) }
+
+fn visit_expr_binary(&mut self, i: &mut ExprBinary) { walk_expr_binary(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_block(&mut self, i: &mut ExprBlock) { walk_expr_block(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_box(&mut self, i: &mut ExprBox) { walk_expr_box(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_break(&mut self, i: &mut ExprBreak) { walk_expr_break(self, i) }
+
+fn visit_expr_call(&mut self, i: &mut ExprCall) { walk_expr_call(self, i) }
+
+fn visit_expr_cast(&mut self, i: &mut ExprCast) { walk_expr_cast(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_catch(&mut self, i: &mut ExprCatch) { walk_expr_catch(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_closure(&mut self, i: &mut ExprClosure) { walk_expr_closure(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_continue(&mut self, i: &mut ExprContinue) { walk_expr_continue(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_field(&mut self, i: &mut ExprField) { walk_expr_field(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_for_loop(&mut self, i: &mut ExprForLoop) { walk_expr_for_loop(self, i) }
+
+fn visit_expr_group(&mut self, i: &mut ExprGroup) { walk_expr_group(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_if(&mut self, i: &mut ExprIf) { walk_expr_if(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_if_let(&mut self, i: &mut ExprIfLet) { walk_expr_if_let(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_in_place(&mut self, i: &mut ExprInPlace) { walk_expr_in_place(self, i) }
+
+fn visit_expr_index(&mut self, i: &mut ExprIndex) { walk_expr_index(self, i) }
+
+fn visit_expr_kind(&mut self, i: &mut ExprKind) { walk_expr_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_loop(&mut self, i: &mut ExprLoop) { walk_expr_loop(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_match(&mut self, i: &mut ExprMatch) { walk_expr_match(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_method_call(&mut self, i: &mut ExprMethodCall) { walk_expr_method_call(self, i) }
+
+fn visit_expr_paren(&mut self, i: &mut ExprParen) { walk_expr_paren(self, i) }
+
+fn visit_expr_path(&mut self, i: &mut ExprPath) { walk_expr_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_range(&mut self, i: &mut ExprRange) { walk_expr_range(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_repeat(&mut self, i: &mut ExprRepeat) { walk_expr_repeat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_ret(&mut self, i: &mut ExprRet) { walk_expr_ret(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_struct(&mut self, i: &mut ExprStruct) { walk_expr_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_try(&mut self, i: &mut ExprTry) { walk_expr_try(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_tup(&mut self, i: &mut ExprTup) { walk_expr_tup(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_tup_field(&mut self, i: &mut ExprTupField) { walk_expr_tup_field(self, i) }
+
+fn visit_expr_type(&mut self, i: &mut ExprType) { walk_expr_type(self, i) }
+
+fn visit_expr_unary(&mut self, i: &mut ExprUnary) { walk_expr_unary(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_while(&mut self, i: &mut ExprWhile) { walk_expr_while(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_while_let(&mut self, i: &mut ExprWhileLet) { walk_expr_while_let(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_expr_yield(&mut self, i: &mut ExprYield) { walk_expr_yield(self, i) }
+
+fn visit_field(&mut self, i: &mut Field) { walk_field(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_field_pat(&mut self, i: &mut FieldPat) { walk_field_pat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_field_value(&mut self, i: &mut FieldValue) { walk_field_value(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_file(&mut self, i: &mut File) { walk_file(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_fn_arg(&mut self, i: &mut FnArg) { walk_fn_arg(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_fn_decl(&mut self, i: &mut FnDecl) { walk_fn_decl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item(&mut self, i: &mut ForeignItem) { walk_foreign_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item_fn(&mut self, i: &mut ForeignItemFn) { walk_foreign_item_fn(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item_kind(&mut self, i: &mut ForeignItemKind) { walk_foreign_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_foreign_item_static(&mut self, i: &mut ForeignItemStatic) { walk_foreign_item_static(self, i) }
+
+fn visit_function_ret_ty(&mut self, i: &mut FunctionRetTy) { walk_function_ret_ty(self, i) }
+
+fn visit_generics(&mut self, i: &mut Generics) { walk_generics(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item(&mut self, i: &mut ImplItem) { walk_impl_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_const(&mut self, i: &mut ImplItemConst) { walk_impl_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_kind(&mut self, i: &mut ImplItemKind) { walk_impl_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_method(&mut self, i: &mut ImplItemMethod) { walk_impl_item_method(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_item_type(&mut self, i: &mut ImplItemType) { walk_impl_item_type(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_impl_polarity(&mut self, i: &mut ImplPolarity) { walk_impl_polarity(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_in_place_kind(&mut self, i: &mut InPlaceKind) { walk_in_place_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item(&mut self, i: &mut Item) { walk_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_const(&mut self, i: &mut ItemConst) { walk_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_default_impl(&mut self, i: &mut ItemDefaultImpl) { walk_item_default_impl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_enum(&mut self, i: &mut ItemEnum) { walk_item_enum(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_extern_crate(&mut self, i: &mut ItemExternCrate) { walk_item_extern_crate(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_fn(&mut self, i: &mut ItemFn) { walk_item_fn(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_foreign_mod(&mut self, i: &mut ItemForeignMod) { walk_item_foreign_mod(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_impl(&mut self, i: &mut ItemImpl) { walk_item_impl(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_kind(&mut self, i: &mut ItemKind) { walk_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_mod(&mut self, i: &mut ItemMod) { walk_item_mod(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_static(&mut self, i: &mut ItemStatic) { walk_item_static(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_struct(&mut self, i: &mut ItemStruct) { walk_item_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_trait(&mut self, i: &mut ItemTrait) { walk_item_trait(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_ty(&mut self, i: &mut ItemTy) { walk_item_ty(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_union(&mut self, i: &mut ItemUnion) { walk_item_union(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_item_use(&mut self, i: &mut ItemUse) { walk_item_use(self, i) }
+
+fn visit_lifetime_def(&mut self, i: &mut LifetimeDef) { walk_lifetime_def(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_local(&mut self, i: &mut Local) { walk_local(self, i) }
+
+fn visit_mac(&mut self, i: &mut Mac) { walk_mac(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_mac_stmt_style(&mut self, i: &mut MacStmtStyle) { walk_mac_stmt_style(self, i) }
+
+fn visit_meta_item(&mut self, i: &mut MetaItem) { walk_meta_item(self, i) }
+
+fn visit_meta_item_list(&mut self, i: &mut MetaItemList) { walk_meta_item_list(self, i) }
+
+fn visit_meta_name_value(&mut self, i: &mut MetaNameValue) { walk_meta_name_value(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_method_sig(&mut self, i: &mut MethodSig) { walk_method_sig(self, i) }
+
+fn visit_mut_ty(&mut self, i: &mut MutTy) { walk_mut_ty(self, i) }
+
+fn visit_mutability(&mut self, i: &mut Mutability) { walk_mutability(self, i) }
+
+fn visit_nested_meta_item(&mut self, i: &mut NestedMetaItem) { walk_nested_meta_item(self, i) }
+
+fn visit_parenthesized_parameter_data(&mut self, i: &mut ParenthesizedParameterData) { walk_parenthesized_parameter_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat(&mut self, i: &mut Pat) { walk_pat(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_box(&mut self, i: &mut PatBox) { walk_pat_box(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_ident(&mut self, i: &mut PatIdent) { walk_pat_ident(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_lit(&mut self, i: &mut PatLit) { walk_pat_lit(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_path(&mut self, i: &mut PatPath) { walk_pat_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_range(&mut self, i: &mut PatRange) { walk_pat_range(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_ref(&mut self, i: &mut PatRef) { walk_pat_ref(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_slice(&mut self, i: &mut PatSlice) { walk_pat_slice(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_struct(&mut self, i: &mut PatStruct) { walk_pat_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_tuple(&mut self, i: &mut PatTuple) { walk_pat_tuple(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_tuple_struct(&mut self, i: &mut PatTupleStruct) { walk_pat_tuple_struct(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_pat_wild(&mut self, i: &mut PatWild) { walk_pat_wild(self, i) }
+
+fn visit_path(&mut self, i: &mut Path) { walk_path(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_glob(&mut self, i: &mut PathGlob) { walk_path_glob(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_list(&mut self, i: &mut PathList) { walk_path_list(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_list_item(&mut self, i: &mut PathListItem) { walk_path_list_item(self, i) }
+
+fn visit_path_parameters(&mut self, i: &mut PathParameters) { walk_path_parameters(self, i) }
+
+fn visit_path_segment(&mut self, i: &mut PathSegment) { walk_path_segment(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_path_simple(&mut self, i: &mut PathSimple) { walk_path_simple(self, i) }
+
+fn visit_poly_trait_ref(&mut self, i: &mut PolyTraitRef) { walk_poly_trait_ref(self, i) }
+
+fn visit_qself(&mut self, i: &mut QSelf) { walk_qself(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_range_limits(&mut self, i: &mut RangeLimits) { walk_range_limits(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_stmt(&mut self, i: &mut Stmt) { walk_stmt(self, i) }
+
+fn visit_trait_bound_modifier(&mut self, i: &mut TraitBoundModifier) { walk_trait_bound_modifier(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item(&mut self, i: &mut TraitItem) { walk_trait_item(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_const(&mut self, i: &mut TraitItemConst) { walk_trait_item_const(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_kind(&mut self, i: &mut TraitItemKind) { walk_trait_item_kind(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_method(&mut self, i: &mut TraitItemMethod) { walk_trait_item_method(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_trait_item_type(&mut self, i: &mut TraitItemType) { walk_trait_item_type(self, i) }
+
+fn visit_ty(&mut self, i: &mut Ty) { walk_ty(self, i) }
+
+fn visit_ty_array(&mut self, i: &mut TyArray) { walk_ty_array(self, i) }
+
+fn visit_ty_bare_fn(&mut self, i: &mut TyBareFn) { walk_ty_bare_fn(self, i) }
+
+fn visit_ty_group(&mut self, i: &mut TyGroup) { walk_ty_group(self, i) }
+
+fn visit_ty_impl_trait(&mut self, i: &mut TyImplTrait) { walk_ty_impl_trait(self, i) }
+
+fn visit_ty_infer(&mut self, i: &mut TyInfer) { walk_ty_infer(self, i) }
+
+fn visit_ty_never(&mut self, i: &mut TyNever) { walk_ty_never(self, i) }
+
+fn visit_ty_param(&mut self, i: &mut TyParam) { walk_ty_param(self, i) }
+
+fn visit_ty_param_bound(&mut self, i: &mut TyParamBound) { walk_ty_param_bound(self, i) }
+
+fn visit_ty_paren(&mut self, i: &mut TyParen) { walk_ty_paren(self, i) }
+
+fn visit_ty_path(&mut self, i: &mut TyPath) { walk_ty_path(self, i) }
+
+fn visit_ty_ptr(&mut self, i: &mut TyPtr) { walk_ty_ptr(self, i) }
+
+fn visit_ty_rptr(&mut self, i: &mut TyRptr) { walk_ty_rptr(self, i) }
+
+fn visit_ty_slice(&mut self, i: &mut TySlice) { walk_ty_slice(self, i) }
+
+fn visit_ty_trait_object(&mut self, i: &mut TyTraitObject) { walk_ty_trait_object(self, i) }
+
+fn visit_ty_tup(&mut self, i: &mut TyTup) { walk_ty_tup(self, i) }
+
+fn visit_type_binding(&mut self, i: &mut TypeBinding) { walk_type_binding(self, i) }
+
+fn visit_un_op(&mut self, i: &mut UnOp) { walk_un_op(self, i) }
+
+fn visit_unsafety(&mut self, i: &mut Unsafety) { walk_unsafety(self, i) }
+
+fn visit_variant(&mut self, i: &mut Variant) { walk_variant(self, i) }
+
+fn visit_variant_data(&mut self, i: &mut VariantData) { walk_variant_data(self, i) }
+# [ cfg ( feature = "full" ) ]
+fn visit_view_path(&mut self, i: &mut ViewPath) { walk_view_path(self, i) }
+
+fn visit_vis_crate(&mut self, i: &mut VisCrate) { walk_vis_crate(self, i) }
+
+fn visit_vis_inherited(&mut self, i: &mut VisInherited) { walk_vis_inherited(self, i) }
+
+fn visit_vis_public(&mut self, i: &mut VisPublic) { walk_vis_public(self, i) }
+
+fn visit_vis_restricted(&mut self, i: &mut VisRestricted) { walk_vis_restricted(self, i) }
+
+fn visit_visibility(&mut self, i: &mut Visibility) { walk_visibility(self, i) }
+
+fn visit_where_bound_predicate(&mut self, i: &mut WhereBoundPredicate) { walk_where_bound_predicate(self, i) }
+
+fn visit_where_clause(&mut self, i: &mut WhereClause) { walk_where_clause(self, i) }
+
+fn visit_where_eq_predicate(&mut self, i: &mut WhereEqPredicate) { walk_where_eq_predicate(self, i) }
+
+fn visit_where_predicate(&mut self, i: &mut WherePredicate) { walk_where_predicate(self, i) }
+
+fn visit_where_region_predicate(&mut self, i: &mut WhereRegionPredicate) { walk_where_region_predicate(self, i) }
+
+}
+
+
+pub fn walk_abi<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Abi) {
+ // Skipped field _i . extern_token;
+ _visitor.visit_abi_kind(&mut _i . kind);
+}
+
+pub fn walk_abi_kind<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut AbiKind) {
+ use ::AbiKind::*;
+ match *_i {
+ Named(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Default => { }
+ }
+}
+
+pub fn walk_angle_bracketed_parameter_data<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut AngleBracketedParameterData) {
+ // Skipped field _i . turbofish;
+ // Skipped field _i . lt_token;
+ // Skipped field _i . lifetimes;
+ for mut el in (_i . types).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty(&mut it) };
+ for mut el in (_i . bindings).iter_mut() { let mut it = el.item_mut(); _visitor.visit_type_binding(&mut it) };
+ // Skipped field _i . gt_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_captured<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ArgCaptured) {
+ _visitor.visit_pat(&mut _i . pat);
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&mut _i . ty);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_self<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ArgSelf) {
+ _visitor.visit_mutability(&mut _i . mutbl);
+ // Skipped field _i . self_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arg_self_ref<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ArgSelfRef) {
+ // Skipped field _i . and_token;
+ // Skipped field _i . self_token;
+ // Skipped field _i . lifetime;
+ _visitor.visit_mutability(&mut _i . mutbl);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_arm<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Arm) {
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ for mut el in (_i . pats).iter_mut() { let mut it = el.item_mut(); _visitor.visit_pat(&mut it) };
+ // Skipped field _i . if_token;
+ // Skipped field _i . guard;
+ // Skipped field _i . rocket_token;
+ _visitor.visit_expr(&mut _i . body);
+ // Skipped field _i . comma;
+}
+
+pub fn walk_attr_style<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut AttrStyle) {
+ use ::AttrStyle::*;
+ match *_i {
+ Outer => { }
+ Inner(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_attribute<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Attribute) {
+ _visitor.visit_attr_style(&mut _i . style);
+ // Skipped field _i . pound_token;
+ // Skipped field _i . bracket_token;
+ _visitor.visit_path(&mut _i . path);
+ // Skipped field _i . tts;
+ // Skipped field _i . is_sugared_doc;
+}
+
+pub fn walk_bare_fn_arg<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BareFnArg) {
+ // Skipped field _i . name;
+ _visitor.visit_ty(&mut _i . ty);
+}
+
+pub fn walk_bare_fn_arg_name<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BareFnArgName) {
+ use ::BareFnArgName::*;
+ match *_i {
+ Named(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Wild(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_bare_fn_ty<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BareFnTy) {
+ // Skipped field _i . lifetimes;
+ _visitor.visit_unsafety(&mut _i . unsafety);
+ // Skipped field _i . abi;
+ // Skipped field _i . fn_token;
+ // Skipped field _i . paren_token;
+ for mut el in (_i . inputs).iter_mut() { let mut it = el.item_mut(); _visitor.visit_bare_fn_arg(&mut it) };
+ // Skipped field _i . variadic;
+ _visitor.visit_function_ret_ty(&mut _i . output);
+}
+
+pub fn walk_bin_op<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BinOp) {
+ use ::BinOp::*;
+ match *_i {
+ Add(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Sub(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Mul(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Div(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Rem(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ And(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Or(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitXor(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitAnd(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitOr(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Shl(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Shr(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Eq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Lt(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Le(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Ne(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Ge(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Gt(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ AddEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ SubEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ MulEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ DivEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ RemEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitXorEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitAndEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ BitOrEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ ShlEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ ShrEq(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_binding_mode<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BindingMode) {
+ use ::BindingMode::*;
+ match *_i {
+ ByRef(ref mut _binding_0, ref mut _binding_1, ) => {
+ // Skipped field * _binding_0;
+ _visitor.visit_mutability(&mut * _binding_1);
+ }
+ ByValue(ref mut _binding_0, ) => {
+ _visitor.visit_mutability(&mut * _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_block<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Block) {
+ // Skipped field _i . brace_token;
+ for mut it in (_i . stmts).iter_mut() { _visitor.visit_stmt(&mut it) };
+}
+
+pub fn walk_body<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Body) {
+ use ::Body::*;
+ match *_i {
+ Enum(ref mut _binding_0, ) => {
+ _visitor.visit_body_enum(&mut * _binding_0);
+ }
+ Struct(ref mut _binding_0, ) => {
+ _visitor.visit_body_struct(&mut * _binding_0);
+ }
+ }
+}
+
+pub fn walk_body_enum<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BodyEnum) {
+ // Skipped field _i . enum_token;
+ // Skipped field _i . brace_token;
+ for mut el in (_i . variants).iter_mut() { let mut it = el.item_mut(); _visitor.visit_variant(&mut it) };
+}
+
+pub fn walk_body_struct<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BodyStruct) {
+ _visitor.visit_variant_data(&mut _i . data);
+ // Skipped field _i . struct_token;
+ // Skipped field _i . semi_token;
+}
+
+pub fn walk_bound_lifetimes<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut BoundLifetimes) {
+ // Skipped field _i . for_token;
+ // Skipped field _i . lt_token;
+ for mut el in (_i . lifetimes).iter_mut() { let mut it = el.item_mut(); _visitor.visit_lifetime_def(&mut it) };
+ // Skipped field _i . gt_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_capture_by<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut CaptureBy) {
+ use ::CaptureBy::*;
+ match *_i {
+ Value(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Ref => { }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_constness<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Constness) {
+ use ::Constness::*;
+ match *_i {
+ Const(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ NotConst => { }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_defaultness<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Defaultness) {
+ use ::Defaultness::*;
+ match *_i {
+ Default(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Final => { }
+ }
+}
+
+pub fn walk_derive_input<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut DeriveInput) {
+ // Skipped field _i . ident;
+ _visitor.visit_visibility(&mut _i . vis);
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ _visitor.visit_generics(&mut _i . generics);
+ _visitor.visit_body(&mut _i . body);
+}
+
+pub fn walk_expr<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Expr) {
+ _visitor.visit_expr_kind(&mut _i . node);
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_addr_of<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprAddrOf) {
+ // Skipped field _i . and_token;
+ _visitor.visit_mutability(&mut _i . mutbl);
+ _visitor.visit_expr(&mut _i . expr);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_array<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprArray) {
+ for mut el in (_i . exprs).iter_mut() { let mut it = el.item_mut(); _visitor.visit_expr(&mut it) };
+ // Skipped field _i . bracket_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_assign<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprAssign) {
+ _visitor.visit_expr(&mut _i . left);
+ _visitor.visit_expr(&mut _i . right);
+ // Skipped field _i . eq_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_assign_op<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprAssignOp) {
+ _visitor.visit_bin_op(&mut _i . op);
+ _visitor.visit_expr(&mut _i . left);
+ _visitor.visit_expr(&mut _i . right);
+}
+
+pub fn walk_expr_binary<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprBinary) {
+ _visitor.visit_bin_op(&mut _i . op);
+ _visitor.visit_expr(&mut _i . left);
+ _visitor.visit_expr(&mut _i . right);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_block<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprBlock) {
+ _visitor.visit_unsafety(&mut _i . unsafety);
+ _visitor.visit_block(&mut _i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_box<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprBox) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . box_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_break<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprBreak) {
+ // Skipped field _i . label;
+ // Skipped field _i . expr;
+ // Skipped field _i . break_token;
+}
+
+pub fn walk_expr_call<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprCall) {
+ _visitor.visit_expr(&mut _i . func);
+ for mut el in (_i . args).iter_mut() { let mut it = el.item_mut(); _visitor.visit_expr(&mut it) };
+ // Skipped field _i . paren_token;
+}
+
+pub fn walk_expr_cast<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprCast) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . as_token;
+ _visitor.visit_ty(&mut _i . ty);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_catch<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprCatch) {
+ // Skipped field _i . do_token;
+ // Skipped field _i . catch_token;
+ _visitor.visit_block(&mut _i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_closure<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprClosure) {
+ _visitor.visit_capture_by(&mut _i . capture);
+ _visitor.visit_fn_decl(&mut _i . decl);
+ _visitor.visit_expr(&mut _i . body);
+ // Skipped field _i . or1_token;
+ // Skipped field _i . or2_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_continue<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprContinue) {
+ // Skipped field _i . label;
+ // Skipped field _i . continue_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_field<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprField) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . field;
+ // Skipped field _i . dot_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_for_loop<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprForLoop) {
+ _visitor.visit_pat(&mut _i . pat);
+ _visitor.visit_expr(&mut _i . expr);
+ _visitor.visit_block(&mut _i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . for_token;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . in_token;
+}
+
+pub fn walk_expr_group<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprGroup) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . group_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_if<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprIf) {
+ _visitor.visit_expr(&mut _i . cond);
+ _visitor.visit_block(&mut _i . if_true);
+ // Skipped field _i . if_false;
+ // Skipped field _i . if_token;
+ // Skipped field _i . else_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_if_let<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprIfLet) {
+ _visitor.visit_pat(&mut _i . pat);
+ _visitor.visit_expr(&mut _i . expr);
+ _visitor.visit_block(&mut _i . if_true);
+ // Skipped field _i . if_false;
+ // Skipped field _i . if_token;
+ // Skipped field _i . let_token;
+ // Skipped field _i . eq_token;
+ // Skipped field _i . else_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_in_place<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprInPlace) {
+ _visitor.visit_expr(&mut _i . place);
+ _visitor.visit_in_place_kind(&mut _i . kind);
+ _visitor.visit_expr(&mut _i . value);
+}
+
+pub fn walk_expr_index<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprIndex) {
+ _visitor.visit_expr(&mut _i . expr);
+ _visitor.visit_expr(&mut _i . index);
+ // Skipped field _i . bracket_token;
+}
+
+pub fn walk_expr_kind<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprKind) {
+ use ::ExprKind::*;
+ match *_i {
+ Box(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_box(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ InPlace(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_in_place(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Array(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_array(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Call(ref mut _binding_0, ) => {
+ _visitor.visit_expr_call(&mut * _binding_0);
+ }
+ MethodCall(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_method_call(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Tup(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_tup(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Binary(ref mut _binding_0, ) => {
+ _visitor.visit_expr_binary(&mut * _binding_0);
+ }
+ Unary(ref mut _binding_0, ) => {
+ _visitor.visit_expr_unary(&mut * _binding_0);
+ }
+ Lit(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Cast(ref mut _binding_0, ) => {
+ _visitor.visit_expr_cast(&mut * _binding_0);
+ }
+ Type(ref mut _binding_0, ) => {
+ _visitor.visit_expr_type(&mut * _binding_0);
+ }
+ If(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_if(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ IfLet(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_if_let(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ While(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_while(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ WhileLet(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_while_let(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ ForLoop(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_for_loop(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Loop(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_loop(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Match(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_match(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Closure(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_closure(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Block(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_block(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Assign(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_assign(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ AssignOp(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_assign_op(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Field(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_field(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ TupField(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_tup_field(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Index(ref mut _binding_0, ) => {
+ _visitor.visit_expr_index(&mut * _binding_0);
+ }
+ Range(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_range(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Path(ref mut _binding_0, ) => {
+ _visitor.visit_expr_path(&mut * _binding_0);
+ }
+ AddrOf(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_addr_of(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Break(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_break(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Continue(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_continue(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Ret(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_ret(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Mac(ref mut _binding_0, ) => {
+ _visitor.visit_mac(&mut * _binding_0);
+ }
+ Struct(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_struct(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Repeat(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_repeat(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Paren(ref mut _binding_0, ) => {
+ _visitor.visit_expr_paren(&mut * _binding_0);
+ }
+ Group(ref mut _binding_0, ) => {
+ _visitor.visit_expr_group(&mut * _binding_0);
+ }
+ Try(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_try(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Catch(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_catch(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ Yield(ref mut _binding_0, ) => {
+ { #[cfg(feature = "full")] { _visitor.visit_expr_yield(&mut * _binding_0) } #[cfg(not(feature = "full"))] unreachable!() };
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_loop<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprLoop) {
+ _visitor.visit_block(&mut _i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . loop_token;
+ // Skipped field _i . colon_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_match<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprMatch) {
+ // Skipped field _i . match_token;
+ // Skipped field _i . brace_token;
+ _visitor.visit_expr(&mut _i . expr);
+ for mut it in (_i . arms).iter_mut() { _visitor.visit_arm(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_method_call<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprMethodCall) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . method;
+ for mut el in (_i . typarams).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty(&mut it) };
+ for mut el in (_i . args).iter_mut() { let mut it = el.item_mut(); _visitor.visit_expr(&mut it) };
+ // Skipped field _i . paren_token;
+ // Skipped field _i . dot_token;
+ // Skipped field _i . lt_token;
+ // Skipped field _i . colon2_token;
+ // Skipped field _i . gt_token;
+}
+
+pub fn walk_expr_paren<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprParen) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . paren_token;
+}
+
+pub fn walk_expr_path<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprPath) {
+ // Skipped field _i . qself;
+ _visitor.visit_path(&mut _i . path);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_range<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprRange) {
+ // Skipped field _i . from;
+ // Skipped field _i . to;
+ _visitor.visit_range_limits(&mut _i . limits);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_repeat<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprRepeat) {
+ // Skipped field _i . bracket_token;
+ // Skipped field _i . semi_token;
+ _visitor.visit_expr(&mut _i . expr);
+ _visitor.visit_expr(&mut _i . amt);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_ret<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprRet) {
+ // Skipped field _i . expr;
+ // Skipped field _i . return_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_struct<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprStruct) {
+ _visitor.visit_path(&mut _i . path);
+ for mut el in (_i . fields).iter_mut() { let mut it = el.item_mut(); _visitor.visit_field_value(&mut it) };
+ // Skipped field _i . rest;
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . brace_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_try<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprTry) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . question_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_tup<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprTup) {
+ for mut el in (_i . args).iter_mut() { let mut it = el.item_mut(); _visitor.visit_expr(&mut it) };
+ // Skipped field _i . paren_token;
+ // Skipped field _i . lone_comma;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_tup_field<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprTupField) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . field;
+ // Skipped field _i . dot_token;
+}
+
+pub fn walk_expr_type<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprType) {
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&mut _i . ty);
+}
+
+pub fn walk_expr_unary<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprUnary) {
+ _visitor.visit_un_op(&mut _i . op);
+ _visitor.visit_expr(&mut _i . expr);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_while<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprWhile) {
+ _visitor.visit_expr(&mut _i . cond);
+ _visitor.visit_block(&mut _i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . while_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_while_let<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprWhileLet) {
+ _visitor.visit_pat(&mut _i . pat);
+ _visitor.visit_expr(&mut _i . expr);
+ _visitor.visit_block(&mut _i . body);
+ // Skipped field _i . label;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . while_token;
+ // Skipped field _i . let_token;
+ // Skipped field _i . eq_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_expr_yield<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ExprYield) {
+ // Skipped field _i . yield_token;
+ // Skipped field _i . expr;
+}
+
+pub fn walk_field<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Field) {
+ // Skipped field _i . ident;
+ _visitor.visit_visibility(&mut _i . vis);
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . colon_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_field_pat<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut FieldPat) {
+ // Skipped field _i . ident;
+ _visitor.visit_pat(&mut _i . pat);
+ // Skipped field _i . is_shorthand;
+ // Skipped field _i . colon_token;
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_field_value<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut FieldValue) {
+ // Skipped field _i . ident;
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . is_shorthand;
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ // Skipped field _i . colon_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_file<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut File) {
+ // Skipped field _i . shebang;
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ for mut it in (_i . items).iter_mut() { _visitor.visit_item(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_fn_arg<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut FnArg) {
+ use ::FnArg::*;
+ match *_i {
+ SelfRef(ref mut _binding_0, ) => {
+ _visitor.visit_arg_self_ref(&mut * _binding_0);
+ }
+ SelfValue(ref mut _binding_0, ) => {
+ _visitor.visit_arg_self(&mut * _binding_0);
+ }
+ Captured(ref mut _binding_0, ) => {
+ _visitor.visit_arg_captured(&mut * _binding_0);
+ }
+ Ignored(ref mut _binding_0, ) => {
+ _visitor.visit_ty(&mut * _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_fn_decl<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut FnDecl) {
+ // Skipped field _i . fn_token;
+ // Skipped field _i . paren_token;
+ for mut el in (_i . inputs).iter_mut() { let mut it = el.item_mut(); _visitor.visit_fn_arg(&mut it) };
+ _visitor.visit_function_ret_ty(&mut _i . output);
+ _visitor.visit_generics(&mut _i . generics);
+ // Skipped field _i . variadic;
+ // Skipped field _i . dot_tokens;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ForeignItem) {
+ // Skipped field _i . ident;
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ _visitor.visit_foreign_item_kind(&mut _i . node);
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_fn<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ForeignItemFn) {
+ _visitor.visit_fn_decl(&mut _i . decl);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_kind<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ForeignItemKind) {
+ use ::ForeignItemKind::*;
+ match *_i {
+ Fn(ref mut _binding_0, ) => {
+ _visitor.visit_foreign_item_fn(&mut * _binding_0);
+ }
+ Static(ref mut _binding_0, ) => {
+ _visitor.visit_foreign_item_static(&mut * _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_foreign_item_static<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ForeignItemStatic) {
+ // Skipped field _i . static_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . colon_token;
+ _visitor.visit_mutability(&mut _i . mutbl);
+}
+
+pub fn walk_function_ret_ty<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut FunctionRetTy) {
+ use ::FunctionRetTy::*;
+ match *_i {
+ Default => { }
+ Ty(ref mut _binding_0, ref mut _binding_1, ) => {
+ _visitor.visit_ty(&mut * _binding_0);
+ // Skipped field * _binding_1;
+ }
+ }
+}
+
+pub fn walk_generics<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Generics) {
+ // Skipped field _i . lt_token;
+ // Skipped field _i . gt_token;
+ for mut el in (_i . lifetimes).iter_mut() { let mut it = el.item_mut(); _visitor.visit_lifetime_def(&mut it) };
+ for mut el in (_i . ty_params).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty_param(&mut it) };
+ _visitor.visit_where_clause(&mut _i . where_clause);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ImplItem) {
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ _visitor.visit_impl_item_kind(&mut _i . node);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_const<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ImplItemConst) {
+ _visitor.visit_visibility(&mut _i . vis);
+ _visitor.visit_defaultness(&mut _i . defaultness);
+ // Skipped field _i . const_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_kind<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ImplItemKind) {
+ use ::ImplItemKind::*;
+ match *_i {
+ Const(ref mut _binding_0, ) => {
+ _visitor.visit_impl_item_const(&mut * _binding_0);
+ }
+ Method(ref mut _binding_0, ) => {
+ _visitor.visit_impl_item_method(&mut * _binding_0);
+ }
+ Type(ref mut _binding_0, ) => {
+ _visitor.visit_impl_item_type(&mut * _binding_0);
+ }
+ Macro(ref mut _binding_0, ) => {
+ _visitor.visit_mac(&mut * _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_method<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ImplItemMethod) {
+ _visitor.visit_visibility(&mut _i . vis);
+ _visitor.visit_defaultness(&mut _i . defaultness);
+ _visitor.visit_method_sig(&mut _i . sig);
+ _visitor.visit_block(&mut _i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_item_type<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ImplItemType) {
+ _visitor.visit_visibility(&mut _i . vis);
+ _visitor.visit_defaultness(&mut _i . defaultness);
+ // Skipped field _i . type_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_impl_polarity<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ImplPolarity) {
+ use ::ImplPolarity::*;
+ match *_i {
+ Positive => { }
+ Negative(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_in_place_kind<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut InPlaceKind) {
+ use ::InPlaceKind::*;
+ match *_i {
+ Arrow(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ In(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Item) {
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ _visitor.visit_item_kind(&mut _i . node);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_const<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemConst) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . const_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_default_impl<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemDefaultImpl) {
+ _visitor.visit_unsafety(&mut _i . unsafety);
+ // Skipped field _i . impl_token;
+ _visitor.visit_path(&mut _i . path);
+ // Skipped field _i . for_token;
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . brace_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_enum<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemEnum) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . enum_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&mut _i . generics);
+ // Skipped field _i . brace_token;
+ for mut el in (_i . variants).iter_mut() { let mut it = el.item_mut(); _visitor.visit_variant(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_extern_crate<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemExternCrate) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . extern_token;
+ // Skipped field _i . crate_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . rename;
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_fn<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemFn) {
+ _visitor.visit_visibility(&mut _i . vis);
+ _visitor.visit_constness(&mut _i . constness);
+ _visitor.visit_unsafety(&mut _i . unsafety);
+ // Skipped field _i . abi;
+ _visitor.visit_fn_decl(&mut _i . decl);
+ // Skipped field _i . ident;
+ _visitor.visit_block(&mut _i . block);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_foreign_mod<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemForeignMod) {
+ _visitor.visit_abi(&mut _i . abi);
+ // Skipped field _i . brace_token;
+ for mut it in (_i . items).iter_mut() { _visitor.visit_foreign_item(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_impl<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemImpl) {
+ _visitor.visit_defaultness(&mut _i . defaultness);
+ _visitor.visit_unsafety(&mut _i . unsafety);
+ // Skipped field _i . impl_token;
+ _visitor.visit_generics(&mut _i . generics);
+ // Skipped field _i . trait_;
+ _visitor.visit_ty(&mut _i . self_ty);
+ // Skipped field _i . brace_token;
+ for mut it in (_i . items).iter_mut() { _visitor.visit_impl_item(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_kind<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemKind) {
+ use ::ItemKind::*;
+ match *_i {
+ ExternCrate(ref mut _binding_0, ) => {
+ _visitor.visit_item_extern_crate(&mut * _binding_0);
+ }
+ Use(ref mut _binding_0, ) => {
+ _visitor.visit_item_use(&mut * _binding_0);
+ }
+ Static(ref mut _binding_0, ) => {
+ _visitor.visit_item_static(&mut * _binding_0);
+ }
+ Const(ref mut _binding_0, ) => {
+ _visitor.visit_item_const(&mut * _binding_0);
+ }
+ Fn(ref mut _binding_0, ) => {
+ _visitor.visit_item_fn(&mut * _binding_0);
+ }
+ Mod(ref mut _binding_0, ) => {
+ _visitor.visit_item_mod(&mut * _binding_0);
+ }
+ ForeignMod(ref mut _binding_0, ) => {
+ _visitor.visit_item_foreign_mod(&mut * _binding_0);
+ }
+ Ty(ref mut _binding_0, ) => {
+ _visitor.visit_item_ty(&mut * _binding_0);
+ }
+ Enum(ref mut _binding_0, ) => {
+ _visitor.visit_item_enum(&mut * _binding_0);
+ }
+ Struct(ref mut _binding_0, ) => {
+ _visitor.visit_item_struct(&mut * _binding_0);
+ }
+ Union(ref mut _binding_0, ) => {
+ _visitor.visit_item_union(&mut * _binding_0);
+ }
+ Trait(ref mut _binding_0, ) => {
+ _visitor.visit_item_trait(&mut * _binding_0);
+ }
+ DefaultImpl(ref mut _binding_0, ) => {
+ _visitor.visit_item_default_impl(&mut * _binding_0);
+ }
+ Impl(ref mut _binding_0, ) => {
+ _visitor.visit_item_impl(&mut * _binding_0);
+ }
+ Mac(ref mut _binding_0, ) => {
+ _visitor.visit_mac(&mut * _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_mod<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemMod) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . mod_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . content;
+ // Skipped field _i . semi;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_static<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemStatic) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . static_token;
+ _visitor.visit_mutability(&mut _i . mutbl);
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_expr(&mut _i . expr);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_struct<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemStruct) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . struct_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&mut _i . generics);
+ _visitor.visit_variant_data(&mut _i . data);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_trait<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemTrait) {
+ _visitor.visit_visibility(&mut _i . vis);
+ _visitor.visit_unsafety(&mut _i . unsafety);
+ // Skipped field _i . trait_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&mut _i . generics);
+ // Skipped field _i . colon_token;
+ for mut el in (_i . supertraits).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty_param_bound(&mut it) };
+ // Skipped field _i . brace_token;
+ for mut it in (_i . items).iter_mut() { _visitor.visit_trait_item(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_ty<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemTy) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . type_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&mut _i . generics);
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_union<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemUnion) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . union_token;
+ // Skipped field _i . ident;
+ _visitor.visit_generics(&mut _i . generics);
+ _visitor.visit_variant_data(&mut _i . data);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_item_use<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ItemUse) {
+ _visitor.visit_visibility(&mut _i . vis);
+ // Skipped field _i . use_token;
+ _visitor.visit_view_path(&mut _i . path);
+ // Skipped field _i . semi_token;
+}
+
+pub fn walk_lifetime_def<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut LifetimeDef) {
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ // Skipped field _i . lifetime;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . bounds;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_local<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Local) {
+ // Skipped field _i . let_token;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . eq_token;
+ // Skipped field _i . semi_token;
+ _visitor.visit_pat(&mut _i . pat);
+ // Skipped field _i . ty;
+ // Skipped field _i . init;
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+}
+
+pub fn walk_mac<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Mac) {
+ _visitor.visit_path(&mut _i . path);
+ // Skipped field _i . bang_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . tokens;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_mac_stmt_style<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut MacStmtStyle) {
+ use ::MacStmtStyle::*;
+ match *_i {
+ Semicolon(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Braces => { }
+ NoBraces => { }
+ }
+}
+
+pub fn walk_meta_item<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut MetaItem) {
+ use ::MetaItem::*;
+ match *_i {
+ Term(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ List(ref mut _binding_0, ) => {
+ _visitor.visit_meta_item_list(&mut * _binding_0);
+ }
+ NameValue(ref mut _binding_0, ) => {
+ _visitor.visit_meta_name_value(&mut * _binding_0);
+ }
+ }
+}
+
+pub fn walk_meta_item_list<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut MetaItemList) {
+ // Skipped field _i . ident;
+ // Skipped field _i . paren_token;
+ for mut el in (_i . nested).iter_mut() { let mut it = el.item_mut(); _visitor.visit_nested_meta_item(&mut it) };
+}
+
+pub fn walk_meta_name_value<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut MetaNameValue) {
+ // Skipped field _i . ident;
+ // Skipped field _i . eq_token;
+ // Skipped field _i . lit;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_method_sig<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut MethodSig) {
+ _visitor.visit_constness(&mut _i . constness);
+ _visitor.visit_unsafety(&mut _i . unsafety);
+ // Skipped field _i . abi;
+ // Skipped field _i . ident;
+ _visitor.visit_fn_decl(&mut _i . decl);
+}
+
+pub fn walk_mut_ty<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut MutTy) {
+ _visitor.visit_ty(&mut _i . ty);
+ _visitor.visit_mutability(&mut _i . mutability);
+}
+
+pub fn walk_mutability<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Mutability) {
+ use ::Mutability::*;
+ match *_i {
+ Mutable(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Immutable => { }
+ }
+}
+
+pub fn walk_nested_meta_item<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut NestedMetaItem) {
+ use ::NestedMetaItem::*;
+ match *_i {
+ MetaItem(ref mut _binding_0, ) => {
+ _visitor.visit_meta_item(&mut * _binding_0);
+ }
+ Literal(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_parenthesized_parameter_data<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ParenthesizedParameterData) {
+ // Skipped field _i . paren_token;
+ for mut el in (_i . inputs).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty(&mut it) };
+ _visitor.visit_function_ret_ty(&mut _i . output);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Pat) {
+ use ::Pat::*;
+ match *_i {
+ Wild(ref mut _binding_0, ) => {
+ _visitor.visit_pat_wild(&mut * _binding_0);
+ }
+ Ident(ref mut _binding_0, ) => {
+ _visitor.visit_pat_ident(&mut * _binding_0);
+ }
+ Struct(ref mut _binding_0, ) => {
+ _visitor.visit_pat_struct(&mut * _binding_0);
+ }
+ TupleStruct(ref mut _binding_0, ) => {
+ _visitor.visit_pat_tuple_struct(&mut * _binding_0);
+ }
+ Path(ref mut _binding_0, ) => {
+ _visitor.visit_pat_path(&mut * _binding_0);
+ }
+ Tuple(ref mut _binding_0, ) => {
+ _visitor.visit_pat_tuple(&mut * _binding_0);
+ }
+ Box(ref mut _binding_0, ) => {
+ _visitor.visit_pat_box(&mut * _binding_0);
+ }
+ Ref(ref mut _binding_0, ) => {
+ _visitor.visit_pat_ref(&mut * _binding_0);
+ }
+ Lit(ref mut _binding_0, ) => {
+ _visitor.visit_pat_lit(&mut * _binding_0);
+ }
+ Range(ref mut _binding_0, ) => {
+ _visitor.visit_pat_range(&mut * _binding_0);
+ }
+ Slice(ref mut _binding_0, ) => {
+ _visitor.visit_pat_slice(&mut * _binding_0);
+ }
+ Mac(ref mut _binding_0, ) => {
+ _visitor.visit_mac(&mut * _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_box<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatBox) {
+ _visitor.visit_pat(&mut _i . pat);
+ // Skipped field _i . box_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_ident<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatIdent) {
+ _visitor.visit_binding_mode(&mut _i . mode);
+ // Skipped field _i . ident;
+ // Skipped field _i . subpat;
+ // Skipped field _i . at_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_lit<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatLit) {
+ _visitor.visit_expr(&mut _i . expr);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_path<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatPath) {
+ // Skipped field _i . qself;
+ _visitor.visit_path(&mut _i . path);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_range<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatRange) {
+ _visitor.visit_expr(&mut _i . lo);
+ _visitor.visit_expr(&mut _i . hi);
+ _visitor.visit_range_limits(&mut _i . limits);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_ref<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatRef) {
+ _visitor.visit_pat(&mut _i . pat);
+ _visitor.visit_mutability(&mut _i . mutbl);
+ // Skipped field _i . and_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_slice<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatSlice) {
+ for mut el in (_i . front).iter_mut() { let mut it = el.item_mut(); _visitor.visit_pat(&mut it) };
+ // Skipped field _i . middle;
+ for mut el in (_i . back).iter_mut() { let mut it = el.item_mut(); _visitor.visit_pat(&mut it) };
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . comma_token;
+ // Skipped field _i . bracket_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_struct<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatStruct) {
+ _visitor.visit_path(&mut _i . path);
+ for mut el in (_i . fields).iter_mut() { let mut it = el.item_mut(); _visitor.visit_field_pat(&mut it) };
+ // Skipped field _i . brace_token;
+ // Skipped field _i . dot2_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_tuple<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatTuple) {
+ for mut el in (_i . pats).iter_mut() { let mut it = el.item_mut(); _visitor.visit_pat(&mut it) };
+ // Skipped field _i . dots_pos;
+ // Skipped field _i . paren_token;
+ // Skipped field _i . dot2_token;
+ // Skipped field _i . comma_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_tuple_struct<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatTupleStruct) {
+ _visitor.visit_path(&mut _i . path);
+ _visitor.visit_pat_tuple(&mut _i . pat);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_pat_wild<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PatWild) {
+ // Skipped field _i . underscore_token;
+}
+
+pub fn walk_path<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Path) {
+ // Skipped field _i . leading_colon;
+ for mut el in (_i . segments).iter_mut() { let mut it = el.item_mut(); _visitor.visit_path_segment(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_glob<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PathGlob) {
+ _visitor.visit_path(&mut _i . path);
+ // Skipped field _i . colon2_token;
+ // Skipped field _i . star_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_list<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PathList) {
+ _visitor.visit_path(&mut _i . path);
+ // Skipped field _i . colon2_token;
+ // Skipped field _i . brace_token;
+ for mut el in (_i . items).iter_mut() { let mut it = el.item_mut(); _visitor.visit_path_list_item(&mut it) };
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_list_item<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PathListItem) {
+ // Skipped field _i . name;
+ // Skipped field _i . rename;
+ // Skipped field _i . as_token;
+}
+
+pub fn walk_path_parameters<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PathParameters) {
+ use ::PathParameters::*;
+ match *_i {
+ None => { }
+ AngleBracketed(ref mut _binding_0, ) => {
+ _visitor.visit_angle_bracketed_parameter_data(&mut * _binding_0);
+ }
+ Parenthesized(ref mut _binding_0, ) => {
+ _visitor.visit_parenthesized_parameter_data(&mut * _binding_0);
+ }
+ }
+}
+
+pub fn walk_path_segment<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PathSegment) {
+ // Skipped field _i . ident;
+ _visitor.visit_path_parameters(&mut _i . parameters);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_path_simple<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PathSimple) {
+ _visitor.visit_path(&mut _i . path);
+ // Skipped field _i . as_token;
+ // Skipped field _i . rename;
+}
+
+pub fn walk_poly_trait_ref<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut PolyTraitRef) {
+ // Skipped field _i . bound_lifetimes;
+ _visitor.visit_path(&mut _i . trait_ref);
+}
+
+pub fn walk_qself<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut QSelf) {
+ // Skipped field _i . lt_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . position;
+ // Skipped field _i . as_token;
+ // Skipped field _i . gt_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_range_limits<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut RangeLimits) {
+ use ::RangeLimits::*;
+ match *_i {
+ HalfOpen(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Closed(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_stmt<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Stmt) {
+ use ::Stmt::*;
+ match *_i {
+ Local(ref mut _binding_0, ) => {
+ _visitor.visit_local(&mut * _binding_0);
+ }
+ Item(ref mut _binding_0, ) => {
+ _visitor.visit_item(&mut * _binding_0);
+ }
+ Expr(ref mut _binding_0, ) => {
+ _visitor.visit_expr(&mut * _binding_0);
+ }
+ Semi(ref mut _binding_0, ref mut _binding_1, ) => {
+ _visitor.visit_expr(&mut * _binding_0);
+ // Skipped field * _binding_1;
+ }
+ Mac(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_trait_bound_modifier<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TraitBoundModifier) {
+ use ::TraitBoundModifier::*;
+ match *_i {
+ None => { }
+ Maybe(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TraitItem) {
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ _visitor.visit_trait_item_kind(&mut _i . node);
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_const<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TraitItemConst) {
+ // Skipped field _i . const_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . default;
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_kind<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TraitItemKind) {
+ use ::TraitItemKind::*;
+ match *_i {
+ Const(ref mut _binding_0, ) => {
+ _visitor.visit_trait_item_const(&mut * _binding_0);
+ }
+ Method(ref mut _binding_0, ) => {
+ _visitor.visit_trait_item_method(&mut * _binding_0);
+ }
+ Type(ref mut _binding_0, ) => {
+ _visitor.visit_trait_item_type(&mut * _binding_0);
+ }
+ Macro(ref mut _binding_0, ) => {
+ _visitor.visit_mac(&mut * _binding_0);
+ }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_method<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TraitItemMethod) {
+ _visitor.visit_method_sig(&mut _i . sig);
+ // Skipped field _i . default;
+ // Skipped field _i . semi_token;
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_trait_item_type<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TraitItemType) {
+ // Skipped field _i . type_token;
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ for mut el in (_i . bounds).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty_param_bound(&mut it) };
+ // Skipped field _i . default;
+ // Skipped field _i . semi_token;
+}
+
+pub fn walk_ty<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Ty) {
+ use ::Ty::*;
+ match *_i {
+ Slice(ref mut _binding_0, ) => {
+ _visitor.visit_ty_slice(&mut * _binding_0);
+ }
+ Array(ref mut _binding_0, ) => {
+ _visitor.visit_ty_array(&mut * _binding_0);
+ }
+ Ptr(ref mut _binding_0, ) => {
+ _visitor.visit_ty_ptr(&mut * _binding_0);
+ }
+ Rptr(ref mut _binding_0, ) => {
+ _visitor.visit_ty_rptr(&mut * _binding_0);
+ }
+ BareFn(ref mut _binding_0, ) => {
+ _visitor.visit_ty_bare_fn(&mut * _binding_0);
+ }
+ Never(ref mut _binding_0, ) => {
+ _visitor.visit_ty_never(&mut * _binding_0);
+ }
+ Tup(ref mut _binding_0, ) => {
+ _visitor.visit_ty_tup(&mut * _binding_0);
+ }
+ Path(ref mut _binding_0, ) => {
+ _visitor.visit_ty_path(&mut * _binding_0);
+ }
+ TraitObject(ref mut _binding_0, ) => {
+ _visitor.visit_ty_trait_object(&mut * _binding_0);
+ }
+ ImplTrait(ref mut _binding_0, ) => {
+ _visitor.visit_ty_impl_trait(&mut * _binding_0);
+ }
+ Paren(ref mut _binding_0, ) => {
+ _visitor.visit_ty_paren(&mut * _binding_0);
+ }
+ Group(ref mut _binding_0, ) => {
+ _visitor.visit_ty_group(&mut * _binding_0);
+ }
+ Infer(ref mut _binding_0, ) => {
+ _visitor.visit_ty_infer(&mut * _binding_0);
+ }
+ Mac(ref mut _binding_0, ) => {
+ _visitor.visit_mac(&mut * _binding_0);
+ }
+ }
+}
+
+pub fn walk_ty_array<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyArray) {
+ // Skipped field _i . bracket_token;
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . semi_token;
+ _visitor.visit_expr(&mut _i . amt);
+}
+
+pub fn walk_ty_bare_fn<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyBareFn) {
+ _visitor.visit_bare_fn_ty(&mut _i . ty);
+}
+
+pub fn walk_ty_group<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyGroup) {
+ // Skipped field _i . group_token;
+ _visitor.visit_ty(&mut _i . ty);
+}
+
+pub fn walk_ty_impl_trait<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyImplTrait) {
+ // Skipped field _i . impl_token;
+ for mut el in (_i . bounds).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty_param_bound(&mut it) };
+}
+
+pub fn walk_ty_infer<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyInfer) {
+ // Skipped field _i . underscore_token;
+}
+
+pub fn walk_ty_never<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyNever) {
+ // Skipped field _i . bang_token;
+}
+
+pub fn walk_ty_param<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyParam) {
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ // Skipped field _i . ident;
+ // Skipped field _i . colon_token;
+ for mut el in (_i . bounds).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty_param_bound(&mut it) };
+ // Skipped field _i . eq_token;
+ // Skipped field _i . default;
+}
+
+pub fn walk_ty_param_bound<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyParamBound) {
+ use ::TyParamBound::*;
+ match *_i {
+ Trait(ref mut _binding_0, ref mut _binding_1, ) => {
+ _visitor.visit_poly_trait_ref(&mut * _binding_0);
+ _visitor.visit_trait_bound_modifier(&mut * _binding_1);
+ }
+ Region(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_ty_paren<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyParen) {
+ // Skipped field _i . paren_token;
+ _visitor.visit_ty(&mut _i . ty);
+}
+
+pub fn walk_ty_path<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyPath) {
+ // Skipped field _i . qself;
+ _visitor.visit_path(&mut _i . path);
+}
+
+pub fn walk_ty_ptr<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyPtr) {
+ // Skipped field _i . star_token;
+ // Skipped field _i . const_token;
+ _visitor.visit_mut_ty(&mut _i . ty);
+}
+
+pub fn walk_ty_rptr<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyRptr) {
+ // Skipped field _i . and_token;
+ // Skipped field _i . lifetime;
+ _visitor.visit_mut_ty(&mut _i . ty);
+}
+
+pub fn walk_ty_slice<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TySlice) {
+ _visitor.visit_ty(&mut _i . ty);
+ // Skipped field _i . bracket_token;
+}
+
+pub fn walk_ty_trait_object<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyTraitObject) {
+ for mut el in (_i . bounds).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty_param_bound(&mut it) };
+}
+
+pub fn walk_ty_tup<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TyTup) {
+ // Skipped field _i . paren_token;
+ for mut el in (_i . tys).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty(&mut it) };
+ // Skipped field _i . lone_comma;
+}
+
+pub fn walk_type_binding<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeBinding) {
+ // Skipped field _i . ident;
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&mut _i . ty);
+}
+
+pub fn walk_un_op<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut UnOp) {
+ use ::UnOp::*;
+ match *_i {
+ Deref(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Not(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Neg(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ }
+}
+
+pub fn walk_unsafety<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Unsafety) {
+ use ::Unsafety::*;
+ match *_i {
+ Unsafe(ref mut _binding_0, ) => {
+ // Skipped field * _binding_0;
+ }
+ Normal => { }
+ }
+}
+
+pub fn walk_variant<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Variant) {
+ // Skipped field _i . ident;
+ for mut it in (_i . attrs).iter_mut() { _visitor.visit_attribute(&mut it) };
+ _visitor.visit_variant_data(&mut _i . data);
+ // Skipped field _i . discriminant;
+ // Skipped field _i . eq_token;
+}
+
+pub fn walk_variant_data<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut VariantData) {
+ use ::VariantData::*;
+ match *_i {
+ Struct(ref mut _binding_0, ref mut _binding_1, ) => {
+ for mut el in (* _binding_0).iter_mut() { let mut it = el.item_mut(); _visitor.visit_field(&mut it) };
+ // Skipped field * _binding_1;
+ }
+ Tuple(ref mut _binding_0, ref mut _binding_1, ) => {
+ for mut el in (* _binding_0).iter_mut() { let mut it = el.item_mut(); _visitor.visit_field(&mut it) };
+ // Skipped field * _binding_1;
+ }
+ Unit => { }
+ }
+}
+# [ cfg ( feature = "full" ) ]
+pub fn walk_view_path<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut ViewPath) {
+ use ::ViewPath::*;
+ match *_i {
+ Simple(ref mut _binding_0, ) => {
+ _visitor.visit_path_simple(&mut * _binding_0);
+ }
+ Glob(ref mut _binding_0, ) => {
+ _visitor.visit_path_glob(&mut * _binding_0);
+ }
+ List(ref mut _binding_0, ) => {
+ _visitor.visit_path_list(&mut * _binding_0);
+ }
+ }
+}
+
+pub fn walk_vis_crate<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut VisCrate) {
+ // Skipped field _i . pub_token;
+ // Skipped field _i . paren_token;
+ // Skipped field _i . crate_token;
+}
+
+pub fn walk_vis_inherited<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut VisInherited) {
+}
+
+pub fn walk_vis_public<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut VisPublic) {
+ // Skipped field _i . pub_token;
+}
+
+pub fn walk_vis_restricted<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut VisRestricted) {
+ // Skipped field _i . pub_token;
+ // Skipped field _i . paren_token;
+ // Skipped field _i . in_token;
+ _visitor.visit_path(&mut _i . path);
+}
+
+pub fn walk_visibility<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut Visibility) {
+ use ::Visibility::*;
+ match *_i {
+ Public(ref mut _binding_0, ) => {
+ _visitor.visit_vis_public(&mut * _binding_0);
+ }
+ Crate(ref mut _binding_0, ) => {
+ _visitor.visit_vis_crate(&mut * _binding_0);
+ }
+ Restricted(ref mut _binding_0, ) => {
+ _visitor.visit_vis_restricted(&mut * _binding_0);
+ }
+ Inherited(ref mut _binding_0, ) => {
+ _visitor.visit_vis_inherited(&mut * _binding_0);
+ }
+ }
+}
+
+pub fn walk_where_bound_predicate<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut WhereBoundPredicate) {
+ // Skipped field _i . bound_lifetimes;
+ _visitor.visit_ty(&mut _i . bounded_ty);
+ // Skipped field _i . colon_token;
+ for mut el in (_i . bounds).iter_mut() { let mut it = el.item_mut(); _visitor.visit_ty_param_bound(&mut it) };
+}
+
+pub fn walk_where_clause<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut WhereClause) {
+ // Skipped field _i . where_token;
+ for mut el in (_i . predicates).iter_mut() { let mut it = el.item_mut(); _visitor.visit_where_predicate(&mut it) };
+}
+
+pub fn walk_where_eq_predicate<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut WhereEqPredicate) {
+ _visitor.visit_ty(&mut _i . lhs_ty);
+ // Skipped field _i . eq_token;
+ _visitor.visit_ty(&mut _i . rhs_ty);
+}
+
+pub fn walk_where_predicate<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut WherePredicate) {
+ use ::WherePredicate::*;
+ match *_i {
+ BoundPredicate(ref mut _binding_0, ) => {
+ _visitor.visit_where_bound_predicate(&mut * _binding_0);
+ }
+ RegionPredicate(ref mut _binding_0, ) => {
+ _visitor.visit_where_region_predicate(&mut * _binding_0);
+ }
+ EqPredicate(ref mut _binding_0, ) => {
+ _visitor.visit_where_eq_predicate(&mut * _binding_0);
+ }
+ }
+}
+
+pub fn walk_where_region_predicate<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut WhereRegionPredicate) {
+ // Skipped field _i . lifetime;
+ // Skipped field _i . colon_token;
+ // Skipped field _i . bounds;
+}
+
diff --git a/src/lib.rs b/src/lib.rs
index 2657395..c990cbd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -96,9 +96,15 @@
pub use synom::delimited;
#[cfg(feature = "visit")]
+#[path = "gen/visit.rs"]
pub mod visit;
+#[cfg(feature = "visit")]
+#[path = "gen/visit_mut.rs"]
+pub mod visit_mut;
+
#[cfg(feature = "fold")]
+#[path = "gen/fold.rs"]
pub mod fold;
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/visit.rs b/src/visit.rs
deleted file mode 100644
index eef9135..0000000
--- a/src/visit.rs
+++ /dev/null
@@ -1,825 +0,0 @@
-// Adapted from libsyntax.
-
-//! AST walker. Each overridden visit method has full control over what
-//! happens with its node, it can do its own traversal of the node's children,
-//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
-//! deeper traversal by doing nothing.
-//!
-//! Note: it is an important invariant that the default visitor walks the body
-//! of a function in "execution order" (more concretely, reverse post-order
-//! with respect to the CFG implied by the AST), meaning that if AST node A may
-//! execute before AST node B, then A is visited first. The borrow checker in
-//! particular relies on this property.
-//!
-//! Note: walking an AST before macro expansion is probably a bad idea. For
-//! instance, a walker looking for item names in a module will miss all of
-//! those that are created by the expansion of a macro.
-
-use super::*;
-
-/// Each method of the Visitor trait is a hook to be potentially
-/// overridden. Each method's default implementation recursively visits
-/// the substructure of the input via the corresponding `walk` method;
-/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
-///
-/// If you want to ensure that your code handles every variant
-/// explicitly, you need to override each method. (And you also need
-/// to monitor future changes to `Visitor` in case a new method with a
-/// new default implementation gets introduced.)
-pub trait Visitor: Sized {
- fn visit_ident(&mut self, _ident: &Ident) {}
- fn visit_derive_input(&mut self, derive_input: &DeriveInput) {
- walk_derive_input(self, derive_input)
- }
- fn visit_ty(&mut self, ty: &Ty) {
- walk_ty(self, ty)
- }
- fn visit_generics(&mut self, generics: &Generics) {
- walk_generics(self, generics)
- }
- fn visit_ty_param_bound(&mut self, bound: &TyParamBound) {
- walk_ty_param_bound(self, bound)
- }
- fn visit_poly_trait_ref(&mut self, trait_ref: &PolyTraitRef, modifier: &TraitBoundModifier) {
- walk_poly_trait_ref(self, trait_ref, modifier)
- }
- fn visit_variant_data(&mut self, data: &VariantData, _ident: &Ident, _generics: &Generics) {
- walk_variant_data(self, data)
- }
- fn visit_field(&mut self, field: &Field) {
- walk_field(self, field)
- }
- fn visit_variant(&mut self, variant: &Variant, generics: &Generics) {
- walk_variant(self, variant, generics)
- }
- fn visit_lifetime(&mut self, _lifetime: &Lifetime) {}
- fn visit_lifetime_def(&mut self, lifetime: &LifetimeDef) {
- walk_lifetime_def(self, lifetime)
- }
- fn visit_path(&mut self, path: &Path) {
- walk_path(self, path)
- }
- fn visit_path_segment(&mut self, path_segment: &PathSegment) {
- walk_path_segment(self, path_segment)
- }
- fn visit_path_parameters(&mut self, path_parameters: &PathParameters) {
- walk_path_parameters(self, path_parameters)
- }
- fn visit_assoc_type_binding(&mut self, type_binding: &TypeBinding) {
- walk_assoc_type_binding(self, type_binding)
- }
- fn visit_attribute(&mut self, _attr: &Attribute) {}
- fn visit_fn_ret_ty(&mut self, ret_ty: &FunctionRetTy) {
- walk_fn_ret_ty(self, ret_ty)
- }
- fn visit_lit(&mut self, _lit: &Lit) {}
- fn visit_expr(&mut self, expr: &Expr) {
- walk_expr(self, expr);
- }
-
- fn visit_mac(&mut self, mac: &Mac) {
- walk_mac(self, mac);
- }
-
- #[cfg(feature = "full")]
- fn visit_file(&mut self, file: &File) {
- walk_file(self, file);
- }
- #[cfg(feature = "full")]
- fn visit_item(&mut self, item: &Item) {
- walk_item(self, item);
- }
- #[cfg(feature = "full")]
- fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) {
- walk_foreign_item(self, foreign_item);
- }
- #[cfg(feature = "full")]
- fn visit_pat(&mut self, pat: &Pat) {
- walk_pat(self, pat);
- }
- #[cfg(feature = "full")]
- fn visit_fn_decl(&mut self, fn_decl: &FnDecl) {
- walk_fn_decl(self, fn_decl);
- }
- #[cfg(feature = "full")]
- fn visit_trait_item(&mut self, trait_item: &TraitItem) {
- walk_trait_item(self, trait_item);
- }
- #[cfg(feature = "full")]
- fn visit_impl_item(&mut self, impl_item: &ImplItem) {
- walk_impl_item(self, impl_item);
- }
- #[cfg(feature = "full")]
- fn visit_method_sig(&mut self, method_sig: &MethodSig) {
- walk_method_sig(self, method_sig);
- }
- #[cfg(feature = "full")]
- fn visit_stmt(&mut self, stmt: &Stmt) {
- walk_stmt(self, stmt);
- }
- #[cfg(feature = "full")]
- fn visit_local(&mut self, local: &Local) {
- walk_local(self, local);
- }
- #[cfg(feature = "full")]
- fn visit_view_path(&mut self, view_path: &ViewPath) {
- walk_view_path(self, view_path);
- }
-}
-
-macro_rules! walk_list {
- ($visitor:expr, $method:ident, $list:expr $(, $extra_args:expr)*) => {
- for elem in $list {
- $visitor.$method(elem $(, $extra_args)*)
- }
- };
-}
-
-pub fn walk_opt_ident<V: Visitor>(visitor: &mut V, opt_ident: &Option<Ident>) {
- if let Some(ref ident) = *opt_ident {
- visitor.visit_ident(ident);
- }
-}
-
-pub fn walk_lifetime_def<V: Visitor>(visitor: &mut V, lifetime_def: &LifetimeDef) {
- visitor.visit_lifetime(&lifetime_def.lifetime);
- walk_list!(visitor, visit_lifetime, lifetime_def.bounds.items());
-}
-
-pub fn walk_poly_trait_ref<V>(visitor: &mut V, trait_ref: &PolyTraitRef, _: &TraitBoundModifier)
- where V: Visitor
-{
- if let Some(ref bl) = trait_ref.bound_lifetimes {
- walk_list!(visitor, visit_lifetime_def, bl.lifetimes.items());
- }
- visitor.visit_path(&trait_ref.trait_ref);
-}
-
-pub fn walk_derive_input<V: Visitor>(visitor: &mut V, derive_input: &DeriveInput) {
- visitor.visit_ident(&derive_input.ident);
- visitor.visit_generics(&derive_input.generics);
- match derive_input.body {
- Body::Enum(ref data) => {
- walk_list!(visitor, visit_variant,
- data.variants.items(),
- &derive_input.generics);
- }
- Body::Struct(ref data) => {
- visitor.visit_variant_data(&data.data, &derive_input.ident, &derive_input.generics);
- }
- }
- walk_list!(visitor, visit_attribute, &derive_input.attrs);
-}
-
-pub fn walk_variant<V>(visitor: &mut V, variant: &Variant, generics: &Generics)
- where V: Visitor
-{
- visitor.visit_ident(&variant.ident);
- visitor.visit_variant_data(&variant.data, &variant.ident, generics);
- walk_list!(visitor, visit_attribute, &variant.attrs);
-}
-
-pub fn walk_ty<V: Visitor>(visitor: &mut V, ty: &Ty) {
- use ty::*;
-
- match *ty {
- Ty::Slice(TySlice { ref ty, .. }) |
- Ty::Group(TyGroup { ref ty, .. }) |
- Ty::Paren(TyParen { ref ty, .. }) => visitor.visit_ty(ty),
- Ty::Ptr(TyPtr { ref ty, .. }) => visitor.visit_ty(&ty.ty),
- Ty::Rptr(TyRptr { ref lifetime, ref ty, .. }) => {
- walk_list!(visitor, visit_lifetime, lifetime);
- visitor.visit_ty(&ty.ty)
- }
- Ty::Never(_) | Ty::Infer(_) => {}
- Ty::Tup(TyTup { ref tys, .. }) => {
- walk_list!(visitor, visit_ty, tys.items());
- }
- Ty::BareFn(TyBareFn { ref ty }) => {
- if let Some(ref l) = ty.lifetimes {
- walk_list!(visitor, visit_lifetime_def, l.lifetimes.items());
- }
- for argument in ty.inputs.items() {
- if let Some((ref name, _)) = argument.name {
- if let BareFnArgName::Named(ref name) = *name {
- visitor.visit_ident(name);
- }
- }
- visitor.visit_ty(&argument.ty)
- }
- visitor.visit_fn_ret_ty(&ty.output)
- }
- Ty::Path(TyPath { ref qself, ref path }) => {
- if let Some(ref qself) = *qself {
- visitor.visit_ty(&qself.ty);
- }
- visitor.visit_path(path);
- }
- Ty::Array(TyArray { ref ty, ref amt, .. }) => {
- visitor.visit_ty(ty);
- visitor.visit_expr(amt);
- }
- Ty::TraitObject(TyTraitObject { ref bounds, .. }) |
- Ty::ImplTrait(TyImplTrait { ref bounds, .. }) => {
- walk_list!(visitor, visit_ty_param_bound, bounds.items());
- }
- Ty::Mac(ref mac) => {
- visitor.visit_mac(mac);
- }
- }
-}
-
-pub fn walk_path<V: Visitor>(visitor: &mut V, path: &Path) {
- for segment in path.segments.items() {
- visitor.visit_path_segment(segment);
- }
-}
-
-pub fn walk_path_segment<V: Visitor>(visitor: &mut V, segment: &PathSegment) {
- visitor.visit_ident(&segment.ident);
- visitor.visit_path_parameters(&segment.parameters);
-}
-
-pub fn walk_path_parameters<V>(visitor: &mut V, path_parameters: &PathParameters)
- where V: Visitor
-{
- match *path_parameters {
- PathParameters::None => {}
- PathParameters::AngleBracketed(ref data) => {
- walk_list!(visitor, visit_ty, data.types.items());
- walk_list!(visitor, visit_lifetime, data.lifetimes.items());
- walk_list!(visitor, visit_assoc_type_binding, data.bindings.items());
- }
- PathParameters::Parenthesized(ref data) => {
- walk_list!(visitor, visit_ty, data.inputs.items());
- visitor.visit_fn_ret_ty(&data.output);
- }
- }
-}
-
-pub fn walk_assoc_type_binding<V: Visitor>(visitor: &mut V, type_binding: &TypeBinding) {
- visitor.visit_ident(&type_binding.ident);
- visitor.visit_ty(&type_binding.ty);
-}
-
-pub fn walk_ty_param_bound<V: Visitor>(visitor: &mut V, bound: &TyParamBound) {
- match *bound {
- TyParamBound::Trait(ref ty, ref modifier) => {
- visitor.visit_poly_trait_ref(ty, modifier);
- }
- TyParamBound::Region(ref lifetime) => {
- visitor.visit_lifetime(lifetime);
- }
- }
-}
-
-pub fn walk_generics<V: Visitor>(visitor: &mut V, generics: &Generics) {
- for param in generics.ty_params.items() {
- visitor.visit_ident(¶m.ident);
- walk_list!(visitor, visit_ty_param_bound, param.bounds.items());
- walk_list!(visitor, visit_ty, ¶m.default);
- }
- walk_list!(visitor, visit_lifetime_def, generics.lifetimes.items());
- for predicate in generics.where_clause.predicates.items() {
- match *predicate {
- WherePredicate::BoundPredicate(WhereBoundPredicate { ref bounded_ty,
- ref bounds,
- ref bound_lifetimes,
- .. }) => {
- visitor.visit_ty(bounded_ty);
- walk_list!(visitor, visit_ty_param_bound, bounds.items());
- if let Some(ref l) = *bound_lifetimes {
- walk_list!(visitor, visit_lifetime_def, l.lifetimes.items());
- }
- }
- WherePredicate::RegionPredicate(WhereRegionPredicate { ref lifetime,
- ref bounds,
- .. }) => {
- visitor.visit_lifetime(lifetime);
- walk_list!(visitor, visit_lifetime, bounds.items());
- }
- WherePredicate::EqPredicate(WhereEqPredicate { ref lhs_ty, ref rhs_ty, .. }) => {
- visitor.visit_ty(lhs_ty);
- visitor.visit_ty(rhs_ty);
- }
- }
- }
-}
-
-pub fn walk_fn_ret_ty<V: Visitor>(visitor: &mut V, ret_ty: &FunctionRetTy) {
- if let FunctionRetTy::Ty(ref output_ty, _) = *ret_ty {
- visitor.visit_ty(output_ty)
- }
-}
-
-pub fn walk_variant_data<V: Visitor>(visitor: &mut V, data: &VariantData) {
- let fields = match *data {
- VariantData::Struct(ref f, _) |
- VariantData::Tuple(ref f, _) => f,
- VariantData::Unit => return,
- };
- walk_list!(visitor, visit_field, fields.items());
-}
-
-pub fn walk_field<V: Visitor>(visitor: &mut V, field: &Field) {
- walk_opt_ident(visitor, &field.ident);
- visitor.visit_ty(&field.ty);
- walk_list!(visitor, visit_attribute, &field.attrs);
-}
-
-pub fn walk_mac<V: Visitor>(visitor: &mut V, mac: &Mac) {
- visitor.visit_path(&mac.path);
-}
-
-#[cfg(feature = "full")]
-pub fn walk_file<V: Visitor>(visitor: &mut V, file: &File) {
- walk_list!(visitor, visit_attribute, &file.attrs);
- walk_list!(visitor, visit_item, &file.items);
-}
-
-#[cfg(feature = "full")]
-pub fn walk_item<V: Visitor>(visitor: &mut V, item: &Item) {
- use item::*;
-
- walk_list!(visitor, visit_attribute, &item.attrs);
- match item.node {
- ItemKind::ExternCrate(ItemExternCrate { ref ident, ref rename, .. }) => {
- visitor.visit_ident(ident);
- if let Some((_, ref id)) = *rename {
- visitor.visit_ident(id);
- }
- }
- ItemKind::Use(ItemUse { ref path, .. }) => {
- visitor.visit_view_path(path);
- }
- ItemKind::Static(ItemStatic { ref ident, ref ty, ref expr, .. }) |
- ItemKind::Const(ItemConst { ref ident, ref ty, ref expr, .. }) => {
- visitor.visit_ident(ident);
- visitor.visit_ty(ty);
- visitor.visit_expr(expr);
- }
- ItemKind::Fn(ItemFn { ref ident, ref decl, ref block, .. }) => {
- visitor.visit_ident(ident);
- visitor.visit_fn_decl(decl);
- walk_list!(visitor, visit_stmt, &block.stmts);
- }
- ItemKind::Mod(ItemMod { ref ident, ref content, .. }) => {
- visitor.visit_ident(ident);
- if let Some((_, ref items)) = *content {
- walk_list!(visitor, visit_item, items);
- }
- }
- ItemKind::ForeignMod(ItemForeignMod { ref items, .. }) => {
- walk_list!(visitor, visit_foreign_item, items);
- }
- ItemKind::Ty(ItemTy { ref ident, ref ty, ref generics, .. }) => {
- visitor.visit_ident(ident);
- visitor.visit_ty(ty);
- visitor.visit_generics(generics);
- }
- ItemKind::Enum(ItemEnum { ref ident, ref variants, ref generics, ..}) => {
- visitor.visit_ident(ident);
- walk_list!(visitor, visit_variant, variants.items(), generics);
- }
- ItemKind::Struct(ItemStruct { ref ident, ref data, ref generics, .. }) |
- ItemKind::Union(ItemUnion { ref ident, ref data, ref generics, .. }) => {
- visitor.visit_ident(ident);
- visitor.visit_variant_data(data, ident, generics);
- }
- ItemKind::Trait(ItemTrait {
- ref ident,
- ref generics,
- ref supertraits,
- ref items,
- ..
- }) => {
- visitor.visit_ident(ident);
- visitor.visit_generics(generics);
- walk_list!(visitor, visit_ty_param_bound, supertraits.items());
- walk_list!(visitor, visit_trait_item, items);
- }
- ItemKind::DefaultImpl(ItemDefaultImpl { ref path, .. }) => {
- visitor.visit_path(path);
- }
- ItemKind::Impl(ItemImpl {
- ref generics,
- ref trait_,
- ref self_ty,
- ref items,
- ..
- }) => {
- visitor.visit_generics(generics);
- if let Some((_, ref path, _)) = *trait_ {
- visitor.visit_path(path);
- }
- visitor.visit_ty(self_ty);
- walk_list!(visitor, visit_impl_item, items);
- }
- ItemKind::Mac(ref mac) => visitor.visit_mac(mac),
- }
-}
-
-#[cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))]
-pub fn walk_expr<V: Visitor>(visitor: &mut V, expr: &Expr) {
- use expr::*;
- use expr::ExprKind::*;
-
- walk_list!(visitor, visit_attribute, &expr.attrs);
- match expr.node {
- #[cfg(feature = "full")]
- InPlace(ExprInPlace { ref place, ref value, .. }) => {
- visitor.visit_expr(place);
- visitor.visit_expr(value);
- }
- Call(ExprCall { ref func, ref args, .. }) => {
- visitor.visit_expr(func);
- walk_list!(visitor, visit_expr, args.items());
- }
- #[cfg(feature = "full")]
- MethodCall(ExprMethodCall { ref method, ref typarams, ref args, .. }) => {
- visitor.visit_ident(method);
- walk_list!(visitor, visit_ty, typarams.items());
- walk_list!(visitor, visit_expr, args.items());
- }
- #[cfg(feature = "full")]
- Array(ExprArray { ref exprs, ..}) |
- Tup(ExprTup { args: ref exprs, .. }) => {
- walk_list!(visitor, visit_expr, exprs.items());
- }
- Lit(ref lit) => {
- visitor.visit_lit(lit);
- }
- Cast(ExprCast { ref expr, ref ty, .. }) |
- Type(ExprType { ref expr, ref ty, .. }) => {
- visitor.visit_expr(expr);
- visitor.visit_ty(ty);
- }
- #[cfg(feature = "full")]
- If(ExprIf { ref cond, ref if_true, ref if_false, .. }) => {
- visitor.visit_expr(cond);
- walk_list!(visitor, visit_stmt, &if_true.stmts);
- if let Some(ref alt) = *if_false {
- visitor.visit_expr(alt);
- }
- }
- #[cfg(feature = "full")]
- IfLet(ExprIfLet { ref pat, ref expr, ref if_true, ref if_false, .. }) => {
- visitor.visit_pat(pat);
- visitor.visit_expr(expr);
- walk_list!(visitor, visit_stmt, &if_true.stmts);
- if let Some(ref alt) = *if_false {
- visitor.visit_expr(alt);
- }
- }
- #[cfg(feature = "full")]
- While(ExprWhile { ref cond, ref body, ref label, .. }) => {
- visitor.visit_expr(cond);
- walk_list!(visitor, visit_stmt, &body.stmts);
- if let Some(ref label) = *label {
- visitor.visit_lifetime(label);
- }
- }
- #[cfg(feature = "full")]
- WhileLet(ExprWhileLet { ref pat, ref expr, ref body, ref label, .. }) |
- ForLoop(ExprForLoop { ref pat, ref expr, ref body, ref label, .. }) => {
- visitor.visit_pat(pat);
- visitor.visit_expr(expr);
- walk_list!(visitor, visit_stmt, &body.stmts);
- if let Some(ref label) = *label {
- visitor.visit_lifetime(label);
- }
- }
- #[cfg(feature = "full")]
- Loop(ExprLoop { ref body, ref label, .. }) => {
- walk_list!(visitor, visit_stmt, &body.stmts);
- if let Some(ref label) = *label {
- visitor.visit_lifetime(label);
- }
- }
- #[cfg(feature = "full")]
- Match(ExprMatch { ref expr, ref arms, .. }) => {
- visitor.visit_expr(expr);
- for &Arm { ref attrs, ref pats, ref guard, ref body, .. } in arms {
- walk_list!(visitor, visit_attribute, attrs);
- walk_list!(visitor, visit_pat, pats.items());
- if let Some(ref guard) = *guard {
- visitor.visit_expr(guard);
- }
- visitor.visit_expr(body);
- }
- }
- #[cfg(feature = "full")]
- Closure(ExprClosure { ref decl, ref body, .. }) => {
- visitor.visit_fn_decl(decl);
- visitor.visit_expr(body);
- }
- #[cfg(feature = "full")]
- Catch(ExprCatch { ref block, .. }) |
- Block(ExprBlock { ref block, .. }) => {
- walk_list!(visitor, visit_stmt, &block.stmts);
- }
- Binary(ExprBinary { ref left, ref right, .. }) => {
- visitor.visit_expr(left);
- visitor.visit_expr(right);
- }
- #[cfg(feature = "full")]
- Assign(ExprAssign { ref left, ref right, .. }) |
- AssignOp(ExprAssignOp { ref left, ref right, .. }) => {
- visitor.visit_expr(left);
- visitor.visit_expr(right);
- }
- #[cfg(feature = "full")]
- Field(ExprField { ref expr, ref field, .. }) => {
- visitor.visit_expr(expr);
- visitor.visit_ident(field);
- }
- Index(ExprIndex { ref expr, ref index, .. }) => {
- visitor.visit_expr(expr);
- visitor.visit_expr(index);
- }
- #[cfg(feature = "full")]
- Range(ExprRange { ref from, ref to, .. }) => {
- if let Some(ref start) = *from {
- visitor.visit_expr(start);
- }
- if let Some(ref end) = *to {
- visitor.visit_expr(end);
- }
- }
- Path(ExprPath { ref qself, ref path }) => {
- if let Some(ref qself) = *qself {
- visitor.visit_ty(&qself.ty);
- }
- visitor.visit_path(path);
- }
- #[cfg(feature = "full")]
- Break(ExprBreak { ref label, ref expr, .. }) => {
- if let Some(ref label) = *label {
- visitor.visit_lifetime(label);
- }
- if let Some(ref expr) = *expr {
- visitor.visit_expr(expr);
- }
- }
- #[cfg(feature = "full")]
- Continue(ExprContinue { ref label, .. }) => {
- if let Some(ref label) = *label {
- visitor.visit_lifetime(label);
- }
- }
- #[cfg(feature = "full")]
- Ret(ExprRet { ref expr, .. }) => {
- if let Some(ref expr) = *expr {
- visitor.visit_expr(expr);
- }
- }
- Mac(ref mac) => {
- visitor.visit_mac(mac);
- }
- #[cfg(feature = "full")]
- Struct(ExprStruct { ref path, ref fields, ref rest, .. }) => {
- visitor.visit_path(path);
- for &FieldValue { ref ident, ref expr, .. } in fields.items() {
- visitor.visit_ident(ident);
- visitor.visit_expr(expr);
- }
- if let Some(ref base) = *rest {
- visitor.visit_expr(base);
- }
- }
- #[cfg(feature = "full")]
- Repeat(ExprRepeat { ref expr, ref amt, .. }) => {
- visitor.visit_expr(expr);
- visitor.visit_expr(amt);
- }
- #[cfg(feature = "full")]
- Yield(ExprYield { ref expr, .. }) => {
- if let Some(ref expr) = *expr {
- visitor.visit_expr(expr);
- }
- }
- #[cfg(feature = "full")]
- TupField(ExprTupField { ref expr, .. }) |
- Unary(ExprUnary { ref expr, .. }) |
- Box(ExprBox { ref expr, .. }) |
- AddrOf(ExprAddrOf { ref expr, .. }) |
- Try(ExprTry { ref expr, .. }) => {
- visitor.visit_expr(expr);
- }
- Paren(ExprParen { ref expr, .. }) |
- Group(ExprGroup { ref expr, .. }) => {
- visitor.visit_expr(expr);
- }
- #[cfg(not(feature = "full"))]
- _ => unreachable!(),
- }
-}
-
-#[cfg(feature = "full")]
-pub fn walk_foreign_item<V: Visitor>(visitor: &mut V, foreign_item: &ForeignItem) {
- use item::*;
-
- visitor.visit_ident(&foreign_item.ident);
- walk_list!(visitor, visit_attribute, &foreign_item.attrs);
- match foreign_item.node {
- ForeignItemKind::Fn(ForeignItemFn { ref decl, .. }) => {
- visitor.visit_fn_decl(decl);
- }
- ForeignItemKind::Static(ForeignItemStatic { ref ty, .. }) => {
- visitor.visit_ty(ty);
- }
- }
-}
-
-#[cfg(feature = "full")]
-pub fn walk_pat<V: Visitor>(visitor: &mut V, pat: &Pat) {
- use expr::*;
-
- match *pat {
- Pat::Wild(_) => {}
- Pat::Ident(PatIdent { ref ident, ref subpat, .. }) => {
- visitor.visit_ident(ident);
- if let Some(ref pat) = *subpat {
- visitor.visit_pat(pat);
- }
- }
- Pat::Struct(PatStruct { ref path, ref fields, .. }) => {
- visitor.visit_path(path);
- for &FieldPat { ref ident, ref pat, .. } in fields.items() {
- visitor.visit_ident(ident);
- visitor.visit_pat(pat);
- }
- }
- Pat::TupleStruct(PatTupleStruct { ref path, ref pat, .. }) => {
- visitor.visit_path(path);
- walk_list!(visitor, visit_pat, pat.pats.items());
- }
- Pat::Path(PatPath { ref qself, ref path }) => {
- if let Some(ref qself) = *qself {
- visitor.visit_ty(&qself.ty);
- }
- visitor.visit_path(path);
- }
- Pat::Tuple(PatTuple { ref pats, .. }) => {
- walk_list!(visitor, visit_pat, pats.items());
- }
- Pat::Box(PatBox { ref pat, .. }) |
- Pat::Ref(PatRef { ref pat, .. }) => {
- visitor.visit_pat(pat);
- }
- Pat::Lit(PatLit { ref expr }) => {
- visitor.visit_expr(expr);
- }
- Pat::Range(PatRange { ref lo, ref hi, .. }) => {
- visitor.visit_expr(lo);
- visitor.visit_expr(hi);
- }
- Pat::Slice(PatSlice { ref front, ref middle, ref back, .. }) => {
- walk_list!(visitor, visit_pat, front.items());
- if let Some(ref mid) = *middle {
- visitor.visit_pat(mid);
- }
- walk_list!(visitor, visit_pat, back.items());
- }
- Pat::Mac(ref mac) => {
- visitor.visit_mac(mac);
- }
- }
-}
-
-#[cfg(feature = "full")]
-pub fn walk_fn_decl<V: Visitor>(visitor: &mut V, fn_decl: &FnDecl) {
- use item::*;
-
- for input in fn_decl.inputs.items() {
- match *input {
- FnArg::SelfRef(_) |
- FnArg::SelfValue(_) => {}
- FnArg::Captured(ArgCaptured { ref pat, ref ty, .. }) => {
- visitor.visit_pat(pat);
- visitor.visit_ty(ty);
- }
- FnArg::Ignored(ref ty) => {
- visitor.visit_ty(ty);
- }
- }
- }
- visitor.visit_generics(&fn_decl.generics);
- visitor.visit_fn_ret_ty(&fn_decl.output);
-}
-
-#[cfg(feature = "full")]
-pub fn walk_trait_item<V: Visitor>(visitor: &mut V, trait_item: &TraitItem) {
- use item::*;
-
- walk_list!(visitor, visit_attribute, &trait_item.attrs);
- match trait_item.node {
- TraitItemKind::Const(TraitItemConst { ref ident, ref ty, ref default, ..}) => {
- visitor.visit_ident(ident);
- visitor.visit_ty(ty);
- if let Some((_, ref expr)) = *default {
- visitor.visit_expr(expr);
- }
- }
- TraitItemKind::Method(TraitItemMethod { ref sig, ref default, .. }) => {
- visitor.visit_method_sig(sig);
- if let Some(ref block) = *default {
- walk_list!(visitor, visit_stmt, &block.stmts);
- }
- }
- TraitItemKind::Type(TraitItemType { ref ident, ref bounds, ref default, .. }) => {
- visitor.visit_ident(ident);
- walk_list!(visitor, visit_ty_param_bound, bounds.items());
- if let Some((_, ref ty)) = *default {
- visitor.visit_ty(ty);
- }
- }
- TraitItemKind::Macro(ref mac) => {
- visitor.visit_mac(mac);
- }
- }
-}
-
-#[cfg(feature = "full")]
-pub fn walk_impl_item<V: Visitor>(visitor: &mut V, impl_item: &ImplItem) {
- use item::*;
-
- walk_list!(visitor, visit_attribute, &impl_item.attrs);
- match impl_item.node {
- ImplItemKind::Const(ImplItemConst { ref ident, ref ty, ref expr, .. }) => {
- visitor.visit_ident(ident);
- visitor.visit_ty(ty);
- visitor.visit_expr(expr);
- }
- ImplItemKind::Method(ImplItemMethod { ref sig, ref block, .. }) => {
- visitor.visit_method_sig(sig);
- walk_list!(visitor, visit_stmt, &block.stmts);
- }
- ImplItemKind::Type(ImplItemType { ref ident, ref ty, .. }) => {
- visitor.visit_ident(ident);
- visitor.visit_ty(ty);
- }
- ImplItemKind::Macro(ref mac) => {
- visitor.visit_mac(mac);
- }
- }
-}
-
-#[cfg(feature = "full")]
-pub fn walk_method_sig<V: Visitor>(visitor: &mut V, method_sig: &MethodSig) {
- visitor.visit_fn_decl(&method_sig.decl);
-}
-
-#[cfg(feature = "full")]
-pub fn walk_stmt<V: Visitor>(visitor: &mut V, stmt: &Stmt) {
- match *stmt {
- Stmt::Local(ref local) => {
- visitor.visit_local(local);
- }
- Stmt::Item(ref item) => {
- visitor.visit_item(item);
- }
- Stmt::Expr(ref expr) |
- Stmt::Semi(ref expr, _) => {
- visitor.visit_expr(expr);
- }
- Stmt::Mac(ref details) => {
- let (ref mac, _, ref attrs) = **details;
- visitor.visit_mac(mac);
- walk_list!(visitor, visit_attribute, attrs);
- }
- }
-}
-
-#[cfg(feature = "full")]
-pub fn walk_local<V: Visitor>(visitor: &mut V, local: &Local) {
- visitor.visit_pat(&local.pat);
- if let Some(ref ty) = local.ty {
- visitor.visit_ty(ty);
- }
- if let Some(ref init) = local.init {
- visitor.visit_expr(init);
- }
- walk_list!(visitor, visit_attribute, &local.attrs);
-}
-
-#[cfg(feature = "full")]
-pub fn walk_view_path<V: Visitor>(visitor: &mut V, view_path: &ViewPath) {
- use item::*;
- match *view_path {
- ViewPath::Simple(PathSimple { ref path, ref rename, .. }) => {
- visitor.visit_path(path);
- walk_opt_ident(visitor, rename);
- }
- ViewPath::Glob(PathGlob { ref path, .. }) => {
- visitor.visit_path(path);
- }
- ViewPath::List(PathList { ref path, ref items, .. }) => {
- visitor.visit_path(path);
- for &PathListItem { ref name, ref rename, .. } in items.items() {
- visitor.visit_ident(name);
- walk_opt_ident(visitor, rename);
- }
- }
- }
-}
diff --git a/syn_codegen/Cargo.toml b/syn_codegen/Cargo.toml
new file mode 100644
index 0000000..48df243
--- /dev/null
+++ b/syn_codegen/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "syn_codegen"
+version = "0.1.0"
+authors = ["Nika Layzell <nika@thelayzells.com>"]
+
+publish = false # this is an internal crate which should never be published
+
+[dependencies]
+syn = { path = "..", features = ["full", "extra-traits"] }
+synom = { path = "../synom" }
+quote = { git = 'https://github.com/dtolnay/quote' }
+inflections = "1.1"
diff --git a/syn_codegen/README.md b/syn_codegen/README.md
new file mode 100644
index 0000000..7c7960f
--- /dev/null
+++ b/syn_codegen/README.md
@@ -0,0 +1,12 @@
+# syn_codegen
+
+This is an internal (not published on crates.io) crate which is used to generate
+the files in the `gen/` directory of `syn`. It is used to ensure that the
+implementations for `Folder`, `Visitor`, and `VisitorMut` remain in sync with
+the actual AST.
+
+To run this program, run `cargo run` in this directory, and the `gen/` folder
+will be re-generated.
+
+This program is slow, and is therefore not run when building `syn` as part of
+the build script to save on compile time.
diff --git a/syn_codegen/src/main.rs b/syn_codegen/src/main.rs
new file mode 100644
index 0000000..1ca357f
--- /dev/null
+++ b/syn_codegen/src/main.rs
@@ -0,0 +1,803 @@
+//! This crate automatically generates the definition of the Visitor,
+//! VisitorMut, and Folder traits in `syn` based on the `syn` source. It
+//! discovers structs and enums declared with the `ast_*` macros and generates
+//! the functions for those types.
+//!
+//! It makes a few assumptions about the target crate:
+//! 1. All structs which are discovered must be re-exported in the root of the
+//! crate, even if they were declared in a submodule.
+//! 2. This code cannot discover submodules which are located in subdirectories
+//! - only submodules located in the same directory.
+//! 3. The path to `syn` is hardcoded.
+
+extern crate syn;
+#[macro_use] extern crate synom;
+#[macro_use] extern crate quote;
+extern crate inflections;
+
+use quote::{Tokens, ToTokens};
+use syn::{ItemKind, Attribute, DeriveInput, Ident};
+
+use std::io::{self, Read, Write};
+use std::fs::File;
+use std::path::Path;
+use std::collections::BTreeMap;
+
+const SYN_CRATE_ROOT: &str = "../src/lib.rs";
+
+const FOLD_SRC: &str = "../src/gen/fold.rs";
+const VISIT_SRC: &str = "../src/gen/visit.rs";
+const VISIT_MUT_SRC: &str = "../src/gen/visit_mut.rs";
+
+const IGNORED_MODS: &[&str] = &[
+ "fold",
+ "visit",
+ "visit_mut",
+];
+
+fn path_eq(a: &syn::Path, b: &syn::Path) -> bool {
+ if a.global() != b.global() || a.segments.len() != b.segments.len() {
+ return false;
+ }
+ a.segments.iter().zip(b.segments.iter())
+ .all(|(a, b)| a.item().ident.as_ref() == b.item().ident.as_ref())
+}
+
+fn get_features(attrs: &[Attribute], mut features: Tokens) -> Tokens {
+ for attr in attrs {
+ if path_eq(&attr.path, &"cfg".into()) {
+ attr.to_tokens(&mut features);
+ }
+ }
+ features
+}
+
+#[derive(Clone)]
+pub struct AstItem {
+ item: DeriveInput,
+ features: Tokens,
+ // True if this is an ast_enum_of_structs! item with a #full annotation.
+ eos_full: bool,
+}
+
+use std::fmt;
+impl fmt::Debug for AstItem {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.debug_struct("AstItem")
+ .field("item", &self.item)
+ .field("features", &self.features.to_string())
+ .finish()
+ }
+}
+
+// NOTE: BTreeMap is used here instead of HashMap to have deterministic output.
+type Lookup<'a> = BTreeMap<Ident, AstItem>;
+
+fn load_file<P: AsRef<Path>>(
+ name: P,
+ features: Tokens,
+ lookup: &mut Lookup,
+) -> Result<(), io::Error> {
+ let name = name.as_ref();
+ let parent = name.parent().ok_or(io::ErrorKind::Other)?;
+
+ let mut f = File::open(name)?;
+ let mut src = String::new();
+ f.read_to_string(&mut src)?;
+
+ // Parse the file
+ let file = syn::parse_file(&src).map_err(|_| io::ErrorKind::Other)?;
+
+ // Collect all of the interesting AstItems declared in this file or submodules.
+ 'items: for item in &file.items {
+ match item.node {
+ ItemKind::Mod(ref module) => {
+ // Don't inspect inline modules.
+ if module.content.is_some() {
+ continue;
+ }
+
+ // We don't want to try to load the generated rust files and
+ // parse them, so we ignore them here.
+ for name in IGNORED_MODS {
+ if module.ident.as_ref() == *name {
+ continue 'items;
+ }
+ }
+
+ // Lookup any #[cfg()] attributes on the module and add them to
+ // the feature set.
+ let features = get_features(&item.attrs, features.clone());
+
+ // Look up the submodule file, and recursively parse it.
+ // XXX: Only handles same-directory .rs file submodules.
+ let path = parent.join(&format!("{}.rs", module.ident.as_ref()));
+ load_file(path, features, lookup)?;
+ }
+ ItemKind::Mac(ref mac) => {
+ // Lookip any #[cfg()] attributes directly on the macro
+ // invocation, and add them to the feature set.
+ let features = get_features(&item.attrs, features.clone());
+
+ // Try to parse the AstItem declaration out of the item.
+ let found = if path_eq(&mac.path, &"ast_struct".into()) {
+ syn::parse_tokens::<parsing::AstStruct>(
+ mac.tokens[0].clone().into_tokens()
+ ).map_err(|_| io::ErrorKind::Other)?.0
+ } else if path_eq(&mac.path, &"ast_enum".into()) {
+ syn::parse_tokens::<parsing::AstEnum>(
+ mac.tokens[0].clone().into_tokens()
+ ).map_err(|_| io::ErrorKind::Other)?.0
+ } else if path_eq(&mac.path, &"ast_enum_of_structs".into()) {
+ syn::parse_tokens::<parsing::AstEnumOfStructs>(
+ mac.tokens[0].clone().into_tokens()
+ ).map_err(|_| io::ErrorKind::Other)?.0
+ } else {
+ continue
+ };
+
+ // Record our features on the parsed AstItems.
+ for mut item in found {
+ features.to_tokens(&mut item.features);
+ lookup.insert(item.item.ident.clone(), item);
+ }
+ }
+ _ => {}
+ }
+ }
+ Ok(())
+}
+
+mod parsing {
+ use super::AstItem;
+
+ use synom::*;
+ use synom::tokens::*;
+ use syn::*;
+ use syn::TokenTree;
+ use quote::Tokens;
+
+ // Parses #full - returns #[cfg(feature = "full")] if it is present, and
+ // nothing otherwise.
+ named!(full -> (Tokens, bool), map!(option!(do_parse!(
+ syn!(Pound) >>
+ id: syn!(Ident) >>
+ cond_reduce!(id.as_ref() == "full", epsilon!()) >>
+ (())
+ )), |s| if s.is_some() {
+ (quote!(#[cfg(feature = "full")]), true)
+ } else {
+ (quote!(), false)
+ }));
+
+ // Parses a simple AstStruct without the `pub struct` prefix.
+ named!(ast_struct_inner -> AstItem, do_parse!(
+ id: syn!(Ident) >>
+ features: full >>
+ rest: call!(TokenTree::parse_list) >>
+ (AstItem {
+ item: parse_tokens::<DeriveInput>(quote! {
+ pub struct #id #(#rest)*
+ })?,
+ features: features.0,
+ eos_full: features.1,
+ })
+ ));
+
+ // ast_struct! parsing
+ pub struct AstStruct(pub Vec<AstItem>);
+ impl Synom for AstStruct {
+ named!(parse -> Self, map!(braces!(do_parse!(
+ many0!(call!(Attribute::parse_outer)) >>
+ syn!(Pub) >>
+ syn!(Struct) >>
+ res: call!(ast_struct_inner) >>
+ (res)
+ )), |x| AstStruct(vec![x.0])));
+ }
+
+ // ast_enum! parsing
+ pub struct AstEnum(pub Vec<AstItem>);
+ impl Synom for AstEnum {
+ named!(parse -> Self, map!(braces!(syn!(DeriveInput)), |x| {
+ AstEnum(vec![AstItem {
+ item: x.0,
+ features: quote!(),
+ eos_full: false,
+ }])
+ }));
+ }
+
+ // A single variant of an ast_enum_of_structs!
+ struct EosVariant {
+ name: Ident,
+ member: Path,
+ inner: Option<AstItem>,
+ }
+ named!(eos_variant -> EosVariant, do_parse!(
+ many0!(call!(Attribute::parse_outer)) >>
+ syn!(Pub) >>
+ variant: syn!(Ident) >>
+ member: map!(parens!(alt!(
+ call!(ast_struct_inner) => { |x: AstItem| (Path::from(x.item.ident.clone()), Some(x)) }
+ |
+ syn!(Path) => { |x| (x, None) }
+ )), |x| x.0) >>
+ syn!(Comma) >>
+ (EosVariant {
+ name: variant,
+ member: member.0,
+ inner: member.1,
+ })
+ ));
+
+ // ast_enum_of_structs! parsing
+ pub struct AstEnumOfStructs(pub Vec<AstItem>);
+ impl Synom for AstEnumOfStructs {
+ named!(parse -> Self, map!(braces!(do_parse!(
+ many0!(call!(Attribute::parse_outer)) >>
+ syn!(Pub) >>
+ syn!(Enum) >>
+ id: syn!(Ident) >>
+ body: braces!(many0!(call!(eos_variant))) >>
+ option!(syn!(Ident)) >> // do_not_generate_to_tokens
+ ({
+ // XXX: This is really gross - we shouldn't have to convert the
+ // tokens to strings to re-parse them.
+ let enum_item = {
+ let variants = body.0.iter().map(|v| {
+ let name = v.name;
+ let member = &v.member;
+ quote!(#name(#member))
+ });
+ parse_tokens::<DeriveInput>(quote! {
+ pub enum #id { #(#variants),* }
+ })?
+ };
+ let mut items = vec![AstItem {
+ item: enum_item,
+ features: quote!(),
+ eos_full: false,
+ }];
+ items.extend(body.0.into_iter().filter_map(|v| v.inner));
+ AstEnumOfStructs(items)
+ })
+ )), |x| x.0));
+ }
+}
+
+mod codegen {
+ use super::{AstItem, Lookup};
+ use syn::*;
+ use quote::{Tokens, ToTokens};
+
+ #[derive(Default)]
+ pub struct State {
+ pub visit_trait: String,
+ pub visit_impl: String,
+ pub visit_mut_trait: String,
+ pub visit_mut_impl: String,
+ pub fold_trait: String,
+ pub fold_impl: String,
+ }
+
+ fn under_name(name: &Ident) -> Ident {
+ use inflections::Inflect;
+ name.as_ref().to_snake_case().into()
+ }
+
+ fn last_segment(ty: &Ty) -> Option<&PathSegment> {
+ match *ty {
+ Ty::Path(ref typath) => {
+ if typath.qself.is_some() {
+ return None;
+ }
+ let name = if let Some(name) = typath.path.segments.last() { name } else {
+ return None;
+ };
+
+ Some(name.item())
+ }
+ _ => None,
+ }
+ }
+
+ #[derive(Debug, Eq, PartialEq, Copy, Clone)]
+ enum Kind {
+ Visit,
+ VisitMut,
+ Fold,
+ }
+
+ fn first_param(params: &PathParameters) -> &Ty {
+ let data = match *params {
+ PathParameters::AngleBracketed(ref data) => data,
+ _ => panic!("Expected at least 1 type parameter here"),
+ };
+
+ data.types.first().expect("Expected at least 1 type parameter here").item()
+ }
+
+ fn simple_visit(
+ type_name: &Ident,
+ lookup: &Lookup,
+ kind: Kind,
+ name: &Tokens,
+ eos_full: &mut bool,
+ ) -> Option<String> {
+ if let Some(ref s) = lookup.get(type_name) {
+ *eos_full = s.eos_full;
+ Some(match kind {
+ Kind::Visit => format!(
+ "_visitor.visit_{under_name}(&{name})",
+ under_name = under_name(type_name),
+ name = name,
+ ),
+ Kind::VisitMut => format!(
+ "_visitor.visit_{under_name}(&mut {name})",
+ under_name = under_name(type_name),
+ name = name,
+ ),
+ Kind::Fold => format!(
+ "_visitor.fold_{under_name}({name})",
+ under_name = under_name(type_name),
+ name = name,
+ )
+ })
+ } else {
+ None
+ }
+ }
+
+ fn box_visit(
+ seg: &PathSegment,
+ lookup: &Lookup,
+ kind: Kind,
+ name: &Tokens,
+ eos_full: &mut bool,
+ ) -> Option<String> {
+ if let Some(res) = simple_visit(&seg.ident, lookup, kind, name, eos_full) {
+ return Some(res);
+ }
+
+ if seg.ident == "Box" {
+ let ty = first_param(&seg.parameters);
+ if let Some(seg) = last_segment(ty) {
+ if kind == Kind::Fold {
+ let name = quote!(*#name);
+ if let Some(val) = simple_visit(
+ &seg.ident,
+ lookup,
+ kind,
+ &name,
+ eos_full,
+ ) {
+ return Some(format!("Box::new({})", val));
+ }
+ } else {
+ return simple_visit(&seg.ident, lookup, kind, name, eos_full);
+ }
+ }
+ }
+
+ None
+ }
+
+ fn vec_visit(
+ seg: &PathSegment,
+ lookup: &Lookup,
+ kind: Kind,
+ name: &Tokens,
+ eos_full: &mut bool,
+ ) -> Option<String> {
+ if let Some(res) = box_visit(seg, lookup, kind, name, eos_full) {
+ return Some(res);
+ }
+
+ if seg.ident == "Vec" || seg.ident == "Delimited" {
+ let is_vec = seg.ident == "Vec";
+ let ty = first_param(&seg.parameters);
+ if let Some(seg) = last_segment(ty) {
+ if let Some(val) = box_visit(seg, lookup, kind, "e!(it), eos_full) {
+ return Some(match kind {
+ Kind::Visit => {
+ if is_vec {
+ format!(
+ "for it in ({name}).iter() {{ {val} }}",
+ name = name,
+ val = val,
+ )
+ } else {
+ format!(
+ "for el in ({name}).iter() {{ \
+ let it = el.item(); \
+ {val} \
+ }}",
+ name = name,
+ val = val,
+ )
+ }
+ }
+ Kind::VisitMut => {
+ if is_vec {
+ format!(
+ "for mut it in ({name}).iter_mut() {{ {val} }}",
+ name = name,
+ val = val,
+ )
+ } else {
+ format!(
+ "for mut el in ({name}).iter_mut() {{ \
+ let mut it = el.item_mut(); \
+ {val} \
+ }}",
+ name = name,
+ val = val,
+ )
+ }
+ }
+ Kind::Fold => {
+ format!(
+ "FoldHelper::lift({name}, |it| {{ {val} }})",
+ name = name,
+ val = val,
+ )
+ }
+ });
+ }
+ }
+ }
+
+ None
+ }
+
+ fn visit(ty: &Ty, lookup: &Lookup, kind: Kind, name: &Tokens) -> String {
+ if let Some(seg) = last_segment(ty) {
+ let mut eos_full = false;
+ if let Some(res) = vec_visit(seg, lookup, kind, name, &mut eos_full) {
+ if eos_full {
+ return format!(
+ "{{ \
+ #[cfg(feature = \"full\")] \
+ {{ {res} }} \
+ #[cfg(not(feature = \"full\"))] \
+ unreachable!() \
+ }}",
+ res = res);
+ }
+ return res;
+ }
+ }
+
+ if kind == Kind::Fold {
+ return name.to_string();
+ }
+ return format!("// Skipped field {}", name);
+ }
+
+ pub fn generate(state: &mut State, lookup: &Lookup, s: &AstItem) {
+ let under_name = under_name(&s.item.ident);
+
+ state.visit_trait.push_str(&format!(
+ "{features}\n\
+ fn visit_{under_name}(&mut self, i: &{ty}) {{ \
+ walk_{under_name}(self, i) \
+ }}\n",
+ features = s.features,
+ under_name = under_name,
+ ty = s.item.ident,
+ ));
+ state.visit_mut_trait.push_str(&format!(
+ "{features}\n\
+ fn visit_{under_name}(&mut self, i: &mut {ty}) {{ \
+ walk_{under_name}(self, i) \
+ }}\n",
+ features = s.features,
+ under_name = under_name,
+ ty = s.item.ident,
+ ));
+ state.fold_trait.push_str(&format!(
+ "{features}\n\
+ fn fold_{under_name}(&mut self, i: {ty}) -> {ty} {{ \
+ walk_{under_name}(self, i) \
+ }}\n",
+ features = s.features,
+ under_name = under_name,
+ ty = s.item.ident,
+ ));
+
+ state.visit_impl.push_str(&format!(
+ "{features}\n\
+ pub fn walk_{under_name}<V: Visitor + ?Sized>(\
+ _visitor: &mut V, _i: &{ty}) {{\n",
+ features = s.features,
+ under_name = under_name,
+ ty = s.item.ident,
+ ));
+ state.visit_mut_impl.push_str(&format!(
+ "{features}\n\
+ pub fn walk_{under_name}<V: VisitorMut + ?Sized>(\
+ _visitor: &mut V, _i: &mut {ty}) {{\n",
+ features = s.features,
+ under_name = under_name,
+ ty = s.item.ident,
+ ));
+ state.fold_impl.push_str(&format!(
+ "{features}\n\
+ pub fn walk_{under_name}<V: Folder + ?Sized>(\
+ _visitor: &mut V, _i: {ty}) -> {ty} {{\n",
+ features = s.features,
+ under_name = under_name,
+ ty = s.item.ident,
+ ));
+
+ // XXX: This part is a disaster - I'm not sure how to make it cleaner though :'(
+ match s.item.body {
+ Body::Enum(ref e) => {
+ let use_decl = format!(" use ::{}::*;\n", s.item.ident);
+ state.visit_impl.push_str(&use_decl);
+ state.visit_mut_impl.push_str(&use_decl);
+ state.fold_impl.push_str(&use_decl);
+
+ state.visit_impl.push_str(" match *_i {\n");
+ state.visit_mut_impl.push_str(" match *_i {\n");
+ state.fold_impl.push_str(" match _i {\n");
+ for variant in &e.variants {
+ let fields: Vec<(&Field, Tokens)> = match variant.item().data {
+ VariantData::Struct(..) => {
+ panic!("Doesn't support enum struct variants");
+ }
+ VariantData::Tuple(ref fields, ..) => {
+ let binding = format!(" {}(", variant.item().ident);
+ state.visit_impl.push_str(&binding);
+ state.visit_mut_impl.push_str(&binding);
+ state.fold_impl.push_str(&binding);
+
+ let res = fields.iter().enumerate().map(|(idx, el)| {
+ let name = format!("_binding_{}", idx);
+
+ state.visit_impl.push_str("ref ");
+ state.visit_mut_impl.push_str("ref mut ");
+
+ state.visit_impl.push_str(&name);
+ state.visit_mut_impl.push_str(&name);
+ state.fold_impl.push_str(&name);
+ state.visit_impl.push_str(", ");
+ state.visit_mut_impl.push_str(", ");
+ state.fold_impl.push_str(", ");
+
+ let mut tokens = quote!();
+ Ident::from(name).to_tokens(&mut tokens);
+
+ (*el.item(), tokens)
+ }).collect();
+
+ state.visit_impl.push_str(") => {\n");
+ state.visit_mut_impl.push_str(") => {\n");
+ state.fold_impl.push_str(") => {\n");
+
+ res
+ }
+ VariantData::Unit => {
+ state.visit_impl.push_str(&format!(
+ " {} => {{ }}\n",
+ variant.item().ident,
+ ));
+ state.visit_mut_impl.push_str(&format!(
+ " {} => {{ }}\n",
+ variant.item().ident,
+ ));
+ state.fold_impl.push_str(&format!(
+ " {0} => {{ {0} }}\n",
+ variant.item().ident
+ ));
+ continue
+ }
+ };
+
+ if fields.is_empty() {
+ state.visit_impl.push_str(" {}");
+ state.visit_mut_impl.push_str(") => {\n");
+ state.fold_impl.push_str(") => {\n");
+ }
+ state.fold_impl.push_str(&format!(
+ " {} (\n",
+ variant.item().ident,
+ ));
+ for (field, binding) in fields {
+ state.visit_impl.push_str(&format!(
+ " {};\n",
+ visit(&field.ty, lookup, Kind::Visit, "e!(*#binding)),
+ ));
+ state.visit_mut_impl.push_str(&format!(
+ " {};\n",
+ visit(&field.ty, lookup, Kind::VisitMut, "e!(*#binding)),
+ ));
+ state.fold_impl.push_str(&format!(
+ " {},\n",
+ visit(&field.ty, lookup, Kind::Fold, &binding),
+ ));
+ }
+ state.fold_impl.push_str(" )\n");
+
+ state.visit_impl.push_str(" }\n");
+ state.visit_mut_impl.push_str(" }\n");
+ state.fold_impl.push_str(" }\n");
+ }
+ state.visit_impl.push_str(" }\n");
+ state.visit_mut_impl.push_str(" }\n");
+ state.fold_impl.push_str(" }\n");
+ }
+ Body::Struct(ref v) => {
+ let fields: Vec<(&Field, Tokens)> = match v.data {
+ VariantData::Struct(ref fields, ..) => {
+ state.fold_impl.push_str(&format!(" {} {{\n", s.item.ident));
+ fields.iter().map(|el| {
+ let id = el.item().ident;
+ (*el.item(), quote!(_i.#id))
+ }).collect()
+ }
+ VariantData::Tuple(ref fields, ..) => {
+ state.fold_impl.push_str(&format!(" {} (\n", s.item.ident));
+ fields.iter().enumerate().map(|(idx, el)| {
+ // XXX: Make sure we don't get the usize suffix!
+ let id = Ident::from(format!("{}", idx));
+ (*el.item(), quote!(_i.#id))
+ }).collect()
+ }
+ VariantData::Unit => vec![]
+ };
+
+ for (field, ref_toks) in fields {
+ state.visit_impl.push_str(&format!(
+ " {};\n", visit(&field.ty, lookup, Kind::Visit, &ref_toks)
+ ));
+ state.visit_mut_impl.push_str(&format!(
+ " {};\n", visit(&field.ty, lookup, Kind::VisitMut, &ref_toks)
+ ));
+ let fold = visit(&field.ty, lookup, Kind::Fold, &ref_toks);
+ if let Some(ref name) = field.ident {
+ state.fold_impl.push_str(&format!(" {}: {},\n", name, fold));
+ } else {
+ state.fold_impl.push_str(&format!(" {},\n", fold));
+ }
+ }
+
+ match v.data {
+ VariantData::Struct(..) => state.fold_impl.push_str(" }\n"),
+ VariantData::Tuple(..) => state.fold_impl.push_str(" )\n"),
+ VariantData::Unit => {}
+ };
+ }
+ }
+
+ // Close the impl body
+ state.visit_impl.push_str("}\n");
+ state.visit_mut_impl.push_str("}\n");
+ state.fold_impl.push_str("}\n");
+ }
+}
+
+fn main() {
+ let mut lookup = BTreeMap::new();
+ load_file(SYN_CRATE_ROOT, quote!(), &mut lookup).unwrap();
+
+ let mut state = Default::default();
+ for s in lookup.values() {
+ codegen::generate(&mut state, &lookup, s);
+ }
+
+ let mut fold_file = File::create(FOLD_SRC).unwrap();
+ write!(fold_file, "
+// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
+
+//! A Folder represents an AST->AST fold; it accepts an AST piece,
+//! and returns a piece of the same type.
+
+// Unreachable code is generated sometimes without the full feature.
+#![allow(unreachable_code)]
+
+use super::*;
+use synom::delimited::Delimited;
+
+trait FoldHelper {{
+ type Item;
+ fn lift<F>(self, f: F) -> Self where F: FnMut(Self::Item) -> Self::Item;
+}}
+
+impl<T> FoldHelper for Vec<T> {{
+ type Item = T;
+ fn lift<F>(self, f: F) -> Self where F: FnMut(Self::Item) -> Self::Item {{
+ self.into_iter().map(f).collect()
+ }}
+}}
+
+impl<T, U> FoldHelper for Delimited<T, U> {{
+ type Item = T;
+ fn lift<F>(self, mut f: F) -> Self where F: FnMut(Self::Item) -> Self::Item {{
+ self.into_iter().map(|elem| {{
+ let (t, u) = elem.into_tuple();
+ (f(t), u)
+ }}).collect::<Vec<(T, Option<U>)>>().into()
+ }}
+}}
+
+/// AST->AST fold.
+///
+/// Each method of the Folder trait is a hook to be potentially overridden. Each
+/// method's default implementation recursively visits the substructure of the
+/// input via the `walk` functions, which perform an \"identity fold\", that
+/// is, they return the same structure that they are given (for example the
+/// `fold_file` method by default calls `fold::walk_file`).
+///
+/// If you want to ensure that your code handles every variant
+/// explicitly, you need to override each method. (And you also need
+/// to monitor future changes to `Folder` in case a new method with a
+/// new default implementation gets introduced.)
+pub trait Folder {{
+{fold_trait}
+}}
+
+{fold_impl}
+",
+ fold_trait = state.fold_trait,
+ fold_impl = state.fold_impl).unwrap();
+
+ let mut visit_file = File::create(VISIT_SRC).unwrap();
+ write!(visit_file, "
+// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
+
+//! AST walker. Each overridden visit method has full control over what
+//! happens with its node, it can do its own traversal of the node's children,
+//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
+//! deeper traversal by doing nothing.
+
+use super::*;
+
+/// Each method of the Visitor trait is a hook to be potentially
+/// overridden. Each method's default implementation recursively visits
+/// the substructure of the input via the corresponding `walk` method;
+/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
+///
+/// If you want to ensure that your code handles every variant
+/// explicitly, you need to override each method. (And you also need
+/// to monitor future changes to `Visitor` in case a new method with a
+/// new default implementation gets introduced.)
+pub trait Visitor {{
+{visit_trait}
+}}
+
+{visit_impl}
+",
+ visit_trait = state.visit_trait,
+ visit_impl = state.visit_impl).unwrap();
+
+ let mut visit_mut_file = File::create(VISIT_MUT_SRC).unwrap();
+ write!(visit_mut_file, "
+// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
+
+//! AST walker. Each overridden visit method has full control over what
+//! happens with its node, it can do its own traversal of the node's children,
+//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
+//! deeper traversal by doing nothing.
+
+use super::*;
+
+/// Each method of the VisitorMut trait is a hook to be potentially
+/// overridden. Each method's default implementation recursively visits
+/// the substructure of the input via the corresponding `walk` method;
+/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
+///
+/// If you want to ensure that your code handles every variant
+/// explicitly, you need to override each method. (And you also need
+/// to monitor future changes to `VisitorMut` in case a new method with a
+/// new default implementation gets introduced.)
+pub trait VisitorMut {{
+{visit_mut_trait}
+}}
+
+{visit_mut_impl}
+",
+ visit_mut_trait = state.visit_mut_trait,
+ visit_mut_impl = state.visit_mut_impl).unwrap();
+}