}
pub fn noop_fold_struct_field<T: Folder>(f: StructField, fld: &mut T) -> StructField {
- let StructField {node: StructField_ {id, kind, ty, attrs}, span} = f;
- Spanned {
- node: StructField_ {
- id: fld.new_id(id),
- kind: kind,
- ty: fld.fold_ty(ty),
- attrs: fold_attrs(attrs, fld),
- },
- span: fld.new_span(span),
+ StructField {
+ span: fld.new_span(f.span),
+ id: fld.new_id(f.id),
+ name: f.name,
+ vis: f.vis,
+ ty: fld.fold_ty(f.ty),
+ attrs: fold_attrs(f.attrs, fld),
}
}
name: folder.fold_name(i.name),
attrs: fold_attrs(i.attrs, folder),
vis: i.vis,
+ defaultness: i.defaultness,
node: match i.node {
ImplItemKind::Const(ty, expr) => {
ImplItemKind::Const(folder.fold_ty(ty), folder.fold_expr(expr))
Pat {
id: folder.new_id(id),
node: match node {
- PatWild => PatWild,
- PatIdent(binding_mode, pth1, sub) => {
- PatIdent(binding_mode,
+ PatKind::Wild => PatKind::Wild,
+ PatKind::Ident(binding_mode, pth1, sub) => {
+ PatKind::Ident(binding_mode,
Spanned {
span: folder.new_span(pth1.span),
node: folder.fold_ident(pth1.node),
},
sub.map(|x| folder.fold_pat(x)))
}
- PatLit(e) => PatLit(folder.fold_expr(e)),
- PatEnum(pth, pats) => {
- PatEnum(folder.fold_path(pth),
+ PatKind::Lit(e) => PatKind::Lit(folder.fold_expr(e)),
+ PatKind::TupleStruct(pth, pats) => {
+ PatKind::TupleStruct(folder.fold_path(pth),
pats.map(|pats| pats.move_map(|x| folder.fold_pat(x))))
}
- PatQPath(qself, pth) => {
+ PatKind::Path(pth) => {
+ PatKind::Path(folder.fold_path(pth))
+ }
+ PatKind::QPath(qself, pth) => {
let qself = QSelf { ty: folder.fold_ty(qself.ty), ..qself };
- PatQPath(qself, folder.fold_path(pth))
+ PatKind::QPath(qself, folder.fold_path(pth))
}
- PatStruct(pth, fields, etc) => {
+ PatKind::Struct(pth, fields, etc) => {
let pth = folder.fold_path(pth);
let fs = fields.move_map(|f| {
Spanned {
},
}
});
- PatStruct(pth, fs, etc)
+ PatKind::Struct(pth, fs, etc)
}
- PatTup(elts) => PatTup(elts.move_map(|x| folder.fold_pat(x))),
- PatBox(inner) => PatBox(folder.fold_pat(inner)),
- PatRegion(inner, mutbl) => PatRegion(folder.fold_pat(inner), mutbl),
- PatRange(e1, e2) => {
- PatRange(folder.fold_expr(e1), folder.fold_expr(e2))
+ PatKind::Tup(elts) => PatKind::Tup(elts.move_map(|x| folder.fold_pat(x))),
+ PatKind::Box(inner) => PatKind::Box(folder.fold_pat(inner)),
+ PatKind::Ref(inner, mutbl) => PatKind::Ref(folder.fold_pat(inner), mutbl),
+ PatKind::Range(e1, e2) => {
+ PatKind::Range(folder.fold_expr(e1), folder.fold_expr(e2))
}
- PatVec(before, slice, after) => {
- PatVec(before.move_map(|x| folder.fold_pat(x)),
+ PatKind::Vec(before, slice, after) => {
+ PatKind::Vec(before.move_map(|x| folder.fold_pat(x)),
slice.map(|x| folder.fold_pat(x)),
after.move_map(|x| folder.fold_pat(x)))
}
ExprIndex(el, er) => {
ExprIndex(folder.fold_expr(el), folder.fold_expr(er))
}
- ExprRange(e1, e2) => {
- ExprRange(e1.map(|x| folder.fold_expr(x)),
- e2.map(|x| folder.fold_expr(x)))
- }
ExprPath(qself, path) => {
let qself = qself.map(|QSelf { ty, position }| {
QSelf {
respan(folder.new_span(label.span), folder.fold_ident(label.node))
})),
ExprRet(e) => ExprRet(e.map(|x| folder.fold_expr(x))),
- ExprInlineAsm(InlineAsm {
- inputs,
- outputs,
- asm,
- asm_str_style,
- clobbers,
- volatile,
- alignstack,
- dialect,
- expn_id,
- }) => ExprInlineAsm(InlineAsm {
- inputs: inputs.move_map(|(c, input)| (c, folder.fold_expr(input))),
- outputs: outputs.move_map(|out| {
- InlineAsmOutput {
- constraint: out.constraint,
- expr: folder.fold_expr(out.expr),
- is_rw: out.is_rw,
- is_indirect: out.is_indirect,
- }
- }),
- asm: asm,
- asm_str_style: asm_str_style,
- clobbers: clobbers,
- volatile: volatile,
- alignstack: alignstack,
- dialect: dialect,
- expn_id: expn_id,
- }),
+ ExprInlineAsm(asm, outputs, inputs) => {
+ ExprInlineAsm(asm,
+ outputs.move_map(|x| folder.fold_expr(x)),
+ inputs.move_map(|x| folder.fold_expr(x)))
+ }
ExprStruct(path, fields, maybe_expr) => {
ExprStruct(folder.fold_path(path),
fields.move_map(|x| folder.fold_field(x)),