Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ pub struct FieldPat {
pub pat: P<Pat>,
pub is_shorthand: bool,
pub attrs: ThinVec<Attribute>,
pub id: NodeId,
}

#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
Expand Down Expand Up @@ -925,6 +926,7 @@ pub struct Arm {
pub guard: Option<P<Expr>>,
pub body: P<Expr>,
pub span: Span,
pub id: NodeId,
}

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
Expand All @@ -934,6 +936,7 @@ pub struct Field {
pub span: Span,
pub is_shorthand: bool,
pub attrs: ThinVec<Attribute>,
pub id: NodeId,
}

pub type SpannedIdent = Spanned<Ident>;
Expand Down
2 changes: 2 additions & 0 deletions src/libsyntax/ext/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ impl<'a> ExtCtxt<'a> {
span,
is_shorthand: false,
attrs: ThinVec::new(),
id: ast::DUMMY_NODE_ID,
}
}
pub fn expr_struct(
Expand Down Expand Up @@ -612,6 +613,7 @@ impl<'a> ExtCtxt<'a> {
guard: None,
body: expr,
span,
id: ast::DUMMY_NODE_ID,
}
}

Expand Down
12 changes: 9 additions & 3 deletions src/libsyntax/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,11 @@ pub fn noop_visit_use_tree<T: MutVisitor>(use_tree: &mut UseTree, vis: &mut T) {
}

pub fn noop_visit_arm<T: MutVisitor>(
Arm { attrs, pats, guard, body, span }: &mut Arm,
Arm { attrs, pats, guard, body, span, id }: &mut Arm,
vis: &mut T,
) {
visit_attrs(attrs, vis);
vis.visit_id(id);
visit_vec(pats, |pat| vis.visit_pat(pat));
visit_opt(guard, |guard| vis.visit_expr(guard));
vis.visit_expr(body);
Expand Down Expand Up @@ -808,9 +809,10 @@ pub fn noop_visit_struct_field<T: MutVisitor>(f: &mut StructField, visitor: &mut
}

pub fn noop_visit_field<T: MutVisitor>(f: &mut Field, vis: &mut T) {
let Field { ident, expr, span, is_shorthand: _, attrs } = f;
let Field { ident, expr, span, is_shorthand: _, attrs, id } = f;
vis.visit_ident(ident);
vis.visit_expr(expr);
vis.visit_id(id);
vis.visit_span(span);
visit_thin_attrs(attrs, vis);
}
Expand Down Expand Up @@ -1040,8 +1042,12 @@ pub fn noop_visit_pat<T: MutVisitor>(pat: &mut P<Pat>, vis: &mut T) {
}
PatKind::Struct(path, fields, _etc) => {
vis.visit_path(path);
for Spanned { node: FieldPat { ident, pat, is_shorthand: _, attrs }, span } in fields {
for Spanned {
node: FieldPat { ident, pat, is_shorthand: _, attrs, id },
span
} in fields {
vis.visit_ident(ident);
vis.visit_id(id);
vis.visit_pat(pat);
visit_thin_attrs(attrs, vis);
vis.visit_span(span);
Expand Down
3 changes: 3 additions & 0 deletions src/libsyntax/parse/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,7 @@ impl<'a> Parser<'a> {
guard,
body: expr,
span: lo.to(hi),
id: ast::DUMMY_NODE_ID,
})
}

Expand Down Expand Up @@ -1599,6 +1600,7 @@ impl<'a> Parser<'a> {
expr: self.mk_expr(self.token.span, ExprKind::Err, ThinVec::new()),
is_shorthand: false,
attrs: ThinVec::new(),
id: ast::DUMMY_NODE_ID,
});
}
}
Expand Down Expand Up @@ -1684,6 +1686,7 @@ impl<'a> Parser<'a> {
expr,
is_shorthand,
attrs: attrs.into(),
id: ast::DUMMY_NODE_ID,
})
}

Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/parse/parser/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ impl<'a> Parser<'a> {
pat: subpat,
is_shorthand,
attrs: attrs.into(),
id: ast::DUMMY_NODE_ID,
}
})
}
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax_ext/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,7 @@ impl<'a> TraitDef<'a> {
source_map::Spanned {
span: pat.span.with_ctxt(self.span.ctxt()),
node: ast::FieldPat {
id: ast::DUMMY_NODE_ID,
ident: ident.unwrap(),
pat,
is_shorthand: false,
Expand Down