diff options
| author | varkor <github@varkor.com> | 2019-09-26 17:34:50 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-09-26 18:21:10 +0100 |
| commit | 21bf983acbb5d7ac8fb9462cbf2cc4c280abd857 (patch) | |
| tree | a92c4cc5a421c256847c345f861bee2b074c89ae | |
| parent | c3d8791373005ef08c876aa649ede245efd2352d (diff) | |
| download | rust-21bf983acbb5d7ac8fb9462cbf2cc4c280abd857.tar.gz rust-21bf983acbb5d7ac8fb9462cbf2cc4c280abd857.zip | |
Rename `Stmt.node` to `Stmt.kind`
32 files changed, 76 insertions, 76 deletions
diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 987745722d6..8340c17b4b7 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -262,7 +262,7 @@ impl CheckAttrVisitor<'tcx> { fn check_stmt_attributes(&self, stmt: &hir::Stmt) { // When checking statements ignore expressions, they will be checked later - if let hir::StmtKind::Local(ref l) = stmt.node { + if let hir::StmtKind::Local(ref l) = stmt.kind { for attr in l.attrs.iter() { if attr.check_name(sym::inline) { self.check_inline(attr, &stmt.span, Target::Statement); diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index b06cea5cd1a..188f3c53729 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -974,7 +974,7 @@ pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block) { pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) { visitor.visit_id(statement.hir_id); - match statement.node { + match statement.kind { StmtKind::Local(ref local) => visitor.visit_local(local), StmtKind::Item(item) => visitor.visit_nested_item(item), StmtKind::Expr(ref expression) | diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index a62ef4e840c..24ea32b65ea 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2660,7 +2660,7 @@ impl<'a> LoweringContext<'a> { for (index, stmt) in b.stmts.iter().enumerate() { if index == b.stmts.len() - 1 { - if let StmtKind::Expr(ref e) = stmt.node { + if let StmtKind::Expr(ref e) = stmt.kind { expr = Some(P(self.lower_expr(e))); } else { stmts.extend(self.lower_stmt(stmt)); @@ -2931,7 +2931,7 @@ impl<'a> LoweringContext<'a> { } fn lower_stmt(&mut self, s: &Stmt) -> SmallVec<[hir::Stmt; 1]> { - let node = match s.node { + let kind = match s.kind { StmtKind::Local(ref l) => { let (l, item_ids) = self.lower_local(l); let mut ids: SmallVec<[hir::Stmt; 1]> = item_ids @@ -2944,7 +2944,7 @@ impl<'a> LoweringContext<'a> { ids.push({ hir::Stmt { hir_id: self.lower_node_id(s.id), - node: hir::StmtKind::Local(P(l)), + kind: hir::StmtKind::Local(P(l)), span: s.span, } }); @@ -2962,7 +2962,7 @@ impl<'a> LoweringContext<'a> { hir::Stmt { hir_id, - node: hir::StmtKind::Item(item_id), + kind: hir::StmtKind::Item(item_id), span: s.span, } }) @@ -2974,7 +2974,7 @@ impl<'a> LoweringContext<'a> { }; smallvec![hir::Stmt { hir_id: self.lower_node_id(s.id), - node, + kind, span: s.span, }] } @@ -3011,8 +3011,8 @@ impl<'a> LoweringContext<'a> { // Helper methods for building HIR. - fn stmt(&mut self, span: Span, node: hir::StmtKind) -> hir::Stmt { - hir::Stmt { span, node, hir_id: self.next_id() } + fn stmt(&mut self, span: Span, kind: hir::StmtKind) -> hir::Stmt { + hir::Stmt { span, kind, hir_id: self.next_id() } } fn stmt_expr(&mut self, span: Span, expr: hir::Expr) -> hir::Stmt { diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index 0bfd8cbdfa2..74137f81bf8 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -303,7 +303,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { } fn visit_stmt(&mut self, stmt: &'a Stmt) { - match stmt.node { + match stmt.kind { StmtKind::Mac(..) => self.visit_macro_invoc(stmt.id), _ => visit::walk_stmt(self, stmt), } diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index e6b4611a505..2d319a64d4d 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -968,7 +968,7 @@ impl<'hir> Map<'hir> { Some(Node::Variant(ref v)) => Some(&v.attrs[..]), Some(Node::Field(ref f)) => Some(&f.attrs[..]), Some(Node::Expr(ref e)) => Some(&*e.attrs), - Some(Node::Stmt(ref s)) => Some(s.node.attrs()), + Some(Node::Stmt(ref s)) => Some(s.kind.attrs()), Some(Node::Arm(ref a)) => Some(&*a.attrs), Some(Node::GenericParam(param)) => Some(¶m.attrs[..]), // Unit/tuple structs/variants take the attributes straight from diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e2ea3d26558..e5cc045d38c 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1221,7 +1221,7 @@ impl UnOp { #[derive(RustcEncodable, RustcDecodable)] pub struct Stmt { pub hir_id: HirId, - pub node: StmtKind, + pub kind: StmtKind, pub span: Span, } diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 7ca3482295c..2c2884e1020 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -944,7 +944,7 @@ impl<'a> State<'a> { pub fn print_stmt(&mut self, st: &hir::Stmt) { self.maybe_print_comment(st.span.lo()); - match st.node { + match st.kind { hir::StmtKind::Local(ref loc) => { self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc)); } @@ -961,7 +961,7 @@ impl<'a> State<'a> { self.s.word(";"); } } - if stmt_ends_with_semi(&st.node) { + if stmt_ends_with_semi(&st.kind) { self.s.word(";"); } self.maybe_print_trailing_comment(st.span, None) diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 01588657f33..c92a9e97d22 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -158,7 +158,7 @@ impl_stable_hash_for_spanned!(hir::BinOpKind); impl_stable_hash_for!(struct hir::Stmt { hir_id, - node, + kind, span, }); diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index bb17905dd78..45b660f5c67 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -590,7 +590,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { } fn walk_stmt(&mut self, stmt: &hir::Stmt) { - match stmt.node { + match stmt.kind { hir::StmtKind::Local(ref local) => { self.walk_local(&local); } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 162b03c8359..a654a26eb0b 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -947,7 +947,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn propagate_through_stmt(&mut self, stmt: &hir::Stmt, succ: LiveNode) -> LiveNode { - match stmt.node { + match stmt.kind { hir::StmtKind::Local(ref local) => { // Note: we mark the variable as defined regardless of whether // there is an initializer. Initially I had thought to only mark diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index a3c21d8af46..28bf88321ae 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -796,7 +796,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h // index information.) for (i, statement) in blk.stmts.iter().enumerate() { - match statement.node { + match statement.kind { hir::StmtKind::Local(..) | hir::StmtKind::Item(..) => { // Each declaration introduces a subscope for bindings diff --git a/src/librustc_ast_borrowck/cfg/construct.rs b/src/librustc_ast_borrowck/cfg/construct.rs index ef35e3615cd..ec7f40f8c97 100644 --- a/src/librustc_ast_borrowck/cfg/construct.rs +++ b/src/librustc_ast_borrowck/cfg/construct.rs @@ -99,7 +99,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex { - let exit = match stmt.node { + let exit = match stmt.kind { hir::StmtKind::Local(ref local) => { let init_exit = self.opt_expr(&local.init, pred); self.pat(&local.pat, init_exit) diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 44899721b1f..b0f7766472d 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -841,7 +841,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> { ast::Stmt { id: sess.next_node_id(), - node: ast::StmtKind::Expr(expr), + kind: ast::StmtKind::Expr(expr), span: syntax_pos::DUMMY_SP, } } @@ -857,7 +857,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> { let loop_stmt = ast::Stmt { id: self.sess.next_node_id(), span: syntax_pos::DUMMY_SP, - node: ast::StmtKind::Expr(loop_expr), + kind: ast::StmtKind::Expr(loop_expr), }; if self.within_static_or_const { diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index f7695b18c5f..1cb909d24ef 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -772,7 +772,7 @@ impl EarlyLintPass for UnusedDocComment { } fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) { - let (kind, is_macro_expansion) = match stmt.node { + let (kind, is_macro_expansion) = match stmt.kind { ast::StmtKind::Local(..) => ("statements", false), ast::StmtKind::Item(..) => ("inner items", false), ast::StmtKind::Mac(..) => ("macro expansions", true), @@ -781,7 +781,7 @@ impl EarlyLintPass for UnusedDocComment { ast::StmtKind::Expr(..) => return, }; - self.warn_if_doc(cx, stmt.span, kind, is_macro_expansion, stmt.node.attrs()); + self.warn_if_doc(cx, stmt.span, kind, is_macro_expansion, stmt.kind.attrs()); } fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) { diff --git a/src/librustc_lint/redundant_semicolon.rs b/src/librustc_lint/redundant_semicolon.rs index 0bfd4c3afc9..0adf1eeb410 100644 --- a/src/librustc_lint/redundant_semicolon.rs +++ b/src/librustc_lint/redundant_semicolon.rs @@ -12,7 +12,7 @@ declare_lint_pass!(RedundantSemicolon => [REDUNDANT_SEMICOLON]); impl EarlyLintPass for RedundantSemicolon { fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &Stmt) { - if let StmtKind::Semi(expr) = &stmt.node { + if let StmtKind::Semi(expr) = &stmt.kind { if let ExprKind::Tup(ref v) = &expr.kind { if v.is_empty() { // Strings of excess semicolons are encoded as empty tuple expressions diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index d13e4ad8a8b..d0149b0e909 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -38,7 +38,7 @@ declare_lint_pass!(UnusedResults => [UNUSED_MUST_USE, UNUSED_RESULTS]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { fn check_stmt(&mut self, cx: &LateContext<'_, '_>, s: &hir::Stmt) { - let expr = match s.node { + let expr = match s.kind { hir::StmtKind::Semi(ref expr) => &**expr, _ => return, }; @@ -269,7 +269,7 @@ declare_lint_pass!(PathStatements => [PATH_STATEMENTS]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PathStatements { fn check_stmt(&mut self, cx: &LateContext<'_, '_>, s: &hir::Stmt) { - if let hir::StmtKind::Semi(ref expr) = s.node { + if let hir::StmtKind::Semi(ref expr) = s.kind { if let hir::ExprKind::Path(_) = expr.kind { cx.span_lint(PATH_STATEMENTS, s.span, "path statement with no effect"); } @@ -587,7 +587,7 @@ impl EarlyLintPass for UnusedParens { } fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) { - if let ast::StmtKind::Local(ref local) = s.node { + if let ast::StmtKind::Local(ref local) = s.kind { self.check_unused_parens_pat(cx, &local.pat, false, false); if let Some(ref value) = local.init { diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index 9a73842d2f0..395f5b16fa4 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -49,7 +49,7 @@ fn mirror_stmts<'a, 'tcx>( for (index, stmt) in stmts.iter().enumerate() { let hir_id = stmt.hir_id; let opt_dxn_ext = cx.region_scope_tree.opt_destruction_scope(hir_id.local_id); - match stmt.node { + match stmt.kind { hir::StmtKind::Expr(ref expr) | hir::StmtKind::Semi(ref expr) => { result.push(StmtRef::Mirror(Box::new(Stmt { diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index ddc85cd364c..a93ca7847d6 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -212,7 +212,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { } fn check_stmt(&mut self, stmt: &'tcx hir::Stmt) -> Promotability { - match stmt.node { + match stmt.kind { hir::StmtKind::Local(ref local) => { if self.remove_mut_rvalue_borrow(&local.pat) { if let Some(init) = &local.init { diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index ba612bb04ac..bd0606cb670 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -309,7 +309,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { fn block_needs_anonymous_module(&mut self, block: &Block) -> bool { // If any statements are items, we need to create an anonymous module - block.stmts.iter().any(|statement| match statement.node { + block.stmts.iter().any(|statement| match statement.kind { StmtKind::Item(_) | StmtKind::Mac(_) => true, _ => false, }) @@ -1161,7 +1161,7 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> { } fn visit_stmt(&mut self, stmt: &'b ast::Stmt) { - if let ast::StmtKind::Mac(..) = stmt.node { + if let ast::StmtKind::Mac(..) = stmt.kind { self.parent_scope.legacy = self.visit_invoc(stmt.id); } else { visit::walk_stmt(self, stmt); diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 9ae1699fb05..3f66829e8f8 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -1804,7 +1804,7 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> { // Descend into the block. for stmt in &block.stmts { - if let StmtKind::Item(ref item) = stmt.node { + if let StmtKind::Item(ref item) = stmt.kind { if let ItemKind::MacroDef(..) = item.node { num_macro_definition_ribs += 1; let res = self.r.definitions.local_def_id(item.id); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index c076a41f775..91297d6ecd0 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3860,7 +3860,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn check_stmt(&self, stmt: &'tcx hir::Stmt) { // Don't do all the complex logic below for `DeclItem`. - match stmt.node { + match stmt.kind { hir::StmtKind::Item(..) => return, hir::StmtKind::Local(..) | hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {} } @@ -3873,7 +3873,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.diverges.set(Diverges::Maybe); self.has_errors.set(false); - match stmt.node { + match stmt.kind { hir::StmtKind::Local(ref l) => { self.check_decl_local(&l); } @@ -4560,7 +4560,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Be helpful when the user wrote `{... expr;}` and // taking the `;` off is enough to fix the error. let last_stmt = blk.stmts.last()?; - let last_expr = match last_stmt.node { + let last_expr = match last_stmt.kind { hir::StmtKind::Semi(ref e) => e, _ => return None, }; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 73751c422f6..684a2f15c62 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -835,31 +835,31 @@ impl UnOp { #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Stmt { pub id: NodeId, - pub node: StmtKind, + pub kind: StmtKind, pub span: Span, } impl Stmt { pub fn add_trailing_semicolon(mut self) -> Self { - self.node = match self.node { + self.kind = match self.kind { StmtKind::Expr(expr) => StmtKind::Semi(expr), StmtKind::Mac(mac) => { StmtKind::Mac(mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs))) } - node => node, + kind => kind, }; self } pub fn is_item(&self) -> bool { - match self.node { + match self.kind { StmtKind::Item(_) => true, _ => false, } } pub fn is_expr(&self) -> bool { - match self.node { + match self.kind { StmtKind::Expr(_) => true, _ => false, } @@ -991,7 +991,7 @@ impl Expr { /// for example, an `if` condition. pub fn returns(&self) -> bool { if let ExprKind::Block(ref block, _) = self.kind { - match block.stmts.last().map(|last_stmt| &last_stmt.node) { + match block.stmts.last().map(|last_stmt| &last_stmt.kind) { // Implicit return Some(&StmtKind::Expr(_)) => true, Some(&StmtKind::Semi(ref expr)) => { diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index bba7532df2e..91bd0f29762 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -702,11 +702,11 @@ impl HasAttrs for StmtKind { impl HasAttrs for Stmt { fn attrs(&self) -> &[ast::Attribute] { - self.node.attrs() + self.kind.attrs() } fn visit_attrs<F: FnOnce(&mut Vec<ast::Attribute>)>(&mut self, f: F) { - self.node.visit_attrs(f); + self.kind.visit_attrs(f); } } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index a0093808412..692849eb8cf 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -363,7 +363,7 @@ macro_rules! make_stmts_default { $me.make_expr().map(|e| smallvec![ast::Stmt { id: ast::DUMMY_NODE_ID, span: e.span, - node: ast::StmtKind::Expr(e), + kind: ast::StmtKind::Expr(e), }]) } } @@ -602,7 +602,7 @@ impl MacResult for DummyResult { fn make_stmts(self: Box<DummyResult>) -> Option<SmallVec<[ast::Stmt; 1]>> { Some(smallvec![ast::Stmt { id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Expr(DummyResult::raw_expr(self.span, self.is_error)), + kind: ast::StmtKind::Expr(DummyResult::raw_expr(self.span, self.is_error)), span: self.span, }]) } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 98b434abea4..a2a7571c440 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -171,7 +171,7 @@ impl<'a> ExtCtxt<'a> { ast::Stmt { id: ast::DUMMY_NODE_ID, span: expr.span, - node: ast::StmtKind::Expr(expr), + kind: ast::StmtKind::Expr(expr), } } @@ -193,7 +193,7 @@ impl<'a> ExtCtxt<'a> { }); ast::Stmt { id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Local(local), + kind: ast::StmtKind::Local(local), span: sp, } } @@ -210,7 +210,7 @@ impl<'a> ExtCtxt<'a> { }); ast::Stmt { id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Local(local), + kind: ast::StmtKind::Local(local), span, } } @@ -218,7 +218,7 @@ impl<'a> ExtCtxt<'a> { pub fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> ast::Stmt { ast::Stmt { id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Item(item), + kind: ast::StmtKind::Item(item), span: sp, } } @@ -227,7 +227,7 @@ impl<'a> ExtCtxt<'a> { self.block(expr.span, vec![ast::Stmt { id: ast::DUMMY_NODE_ID, span: expr.span, - node: ast::StmtKind::Expr(expr), + kind: ast::StmtKind::Expr(expr), }]) } pub fn block(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Block> { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 98a4de4cfe9..d90839ac7fd 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1206,7 +1206,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } } - if let StmtKind::Mac(mac) = stmt.node { + if let StmtKind::Mac(mac) = stmt.kind { let (mac, style, attrs) = mac.into_inner(); self.check_attributes(&attrs); let mut placeholder = self.collect_bang(mac, stmt.span, AstFragmentKind::Stmts) @@ -1224,9 +1224,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } // The placeholder expander gives ids to statements, so we avoid folding the id here. - let ast::Stmt { id, node, span } = stmt; - noop_flat_map_stmt_kind(node, self).into_iter().map(|node| { - ast::Stmt { id, node, span } + let ast::Stmt { id, kind, span } = stmt; + noop_flat_map_stmt_kind(kind, self).into_iter().map(|kind| { + ast::Stmt { id, kind, span } }).collect() } diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index 05b4985bb73..cb4c685dabe 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -75,7 +75,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment { })), AstFragmentKind::Stmts => AstFragment::Stmts(smallvec![{ let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new())); - ast::Stmt { id, span, node: ast::StmtKind::Mac(mac) } + ast::Stmt { id, span, kind: ast::StmtKind::Mac(mac) } }]), AstFragmentKind::Arms => AstFragment::Arms(smallvec![ ast::Arm { @@ -296,7 +296,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { } fn flat_map_stmt(&mut self, stmt: ast::Stmt) -> SmallVec<[ast::Stmt; 1]> { - let (style, mut stmts) = match stmt.node { + let (style, mut stmts) = match stmt.kind { ast::StmtKind::Mac(mac) => (mac.1, self.remove(stmt.id).make_stmts()), _ => return noop_flat_map_stmt(stmt, self), }; diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index c08e154e045..0a42fc0cdfd 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -1247,19 +1247,19 @@ pub fn noop_filter_map_expr<T: MutVisitor>(mut e: P<Expr>, vis: &mut T) -> Optio Some({ vis.visit_expr(&mut e); e }) } -pub fn noop_flat_map_stmt<T: MutVisitor>(Stmt { node, mut span, mut id }: Stmt, vis: &mut T) +pub fn noop_flat_map_stmt<T: MutVisitor>(Stmt { kind, mut span, mut id }: Stmt, vis: &mut T) -> SmallVec<[Stmt; 1]> { vis.visit_id(&mut id); vis.visit_span(&mut span); - noop_flat_map_stmt_kind(node, vis).into_iter().map(|node| { - Stmt { id, node, span } + noop_flat_map_stmt_kind(kind, vis).into_iter().map(|kind| { + Stmt { id, kind, span } }).collect() } -pub fn noop_flat_map_stmt_kind<T: MutVisitor>(node: StmtKind, vis: &mut T) +pub fn noop_flat_map_stmt_kind<T: MutVisitor>(kind: StmtKind, vis: &mut T) -> SmallVec<[StmtKind; 1]> { - match node { + match kind { StmtKind::Local(mut local) => smallvec![StmtKind::Local({ vis.visit_local(&mut local); local })], StmtKind::Item(item) => vis.flat_map_item(item).into_iter().map(StmtKind::Item).collect(), diff --git a/src/libsyntax/parse/parser/stmt.rs b/src/libsyntax/parse/parser/stmt.rs index 02da56f6e35..855b03ddd6f 100644 --- a/src/libsyntax/parse/parser/stmt.rs +++ b/src/libsyntax/parse/parser/stmt.rs @@ -44,7 +44,7 @@ impl<'a> Parser<'a> { Ok(Some(if self.eat_keyword(kw::Let) { Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Local(self.parse_local(attrs.into())?), + kind: StmtKind::Local(self.parse_local(attrs.into())?), span: lo.to(self.prev_span), } } else if let Some(macro_def) = self.eat_macro_def( @@ -54,7 +54,7 @@ impl<'a> Parser<'a> { )? { Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Item(macro_def), + kind: StmtKind::Item(macro_def), span: lo.to(self.prev_span), } // Starts like a simple path, being careful to avoid contextual keywords @@ -86,7 +86,7 @@ impl<'a> Parser<'a> { return Ok(Some(Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Expr(expr), + kind: StmtKind::Expr(expr), span: lo.to(self.prev_span), })); } @@ -107,7 +107,7 @@ impl<'a> Parser<'a> { span: lo.to(hi), prior_type_ascription: self.last_type_ascription, }; - let node = if delim == MacDelimiter::Brace || + let kind = if delim == MacDelimiter::Brace || self.token == token::Semi || self.token == token::Eof { StmtKind::Mac(P((mac, style, attrs.into()))) } @@ -137,7 +137,7 @@ impl<'a> Parser<'a> { Stmt { id: DUMMY_NODE_ID, span: lo.to(hi), - node, + kind, } } else { // FIXME: Bad copy of attrs @@ -150,7 +150,7 @@ impl<'a> Parser<'a> { Some(i) => Stmt { id: DUMMY_NODE_ID, span: lo.to(i.span), - node: StmtKind::Item(i), + kind: StmtKind::Item(i), }, None => { let unused_attrs = |attrs: &[Attribute], s: &mut Self| { @@ -180,7 +180,7 @@ impl<'a> Parser<'a> { return Ok(Some(Stmt { id: DUMMY_NODE_ID, span: lo.to(last_semi), - node: StmtKind::Semi(self.mk_expr(lo.to(last_semi), + kind: StmtKind::Semi(self.mk_expr(lo.to(last_semi), ExprKind::Tup(Vec::new()), ThinVec::new() )), @@ -198,7 +198,7 @@ impl<'a> Parser<'a> { Stmt { id: DUMMY_NODE_ID, span: lo.to(e.span), - node: StmtKind::Expr(e), + kind: StmtKind::Expr(e), } } } @@ -400,7 +400,7 @@ impl<'a> Parser<'a> { self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore); Some(Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Expr(DummyResult::raw_expr(self.token.span, true)), + kind: StmtKind::Expr(DummyResult::raw_expr(self.token.span, true)), span: self.token.span, }) } @@ -431,7 +431,7 @@ impl<'a> Parser<'a> { None => return Ok(None), }; - match stmt.node { + match stmt.kind { StmtKind::Expr(ref expr) if self.token != token::Eof => { // expression without semicolon if classify::expr_requires_semi_to_be_stmt(expr) { @@ -443,7 +443,7 @@ impl<'a> Parser<'a> { self.recover_stmt(); // Don't complain about type errors in body tail after parse error (#57383). let sp = expr.span.to(self.prev_span); - stmt.node = StmtKind::Expr(DummyResult::raw_expr(sp, true)); + stmt.kind = StmtKind::Expr(DummyResult::raw_expr(sp, true)); } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 7eaaab9e70d..5bf5842e3f7 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1630,7 +1630,7 @@ impl<'a> State<'a> { crate fn print_stmt(&mut self, st: &ast::Stmt) { self.maybe_print_comment(st.span.lo()); - match st.node { + match st.kind { ast::StmtKind::Local(ref loc) => { self.print_outer_attributes(&loc.attrs); self.space_if_not_bol(); @@ -1703,7 +1703,7 @@ impl<'a> State<'a> { self.print_inner_attributes(attrs); for (i, st) in blk.stmts.iter().enumerate() { - match st.node { + match st.kind { ast::StmtKind::Expr(ref expr) if i == blk.stmts.len() - 1 => { self.maybe_print_comment(st.span.lo()); self.space_if_not_bol(); diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 16616cf3185..477852e5df1 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -656,7 +656,7 @@ pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) { } pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) { - match statement.node { + match statement.kind { StmtKind::Local(ref local) => visitor.visit_local(local), StmtKind::Item(ref item) => visitor.visit_item(item), StmtKind::Expr(ref expression) | StmtKind::Semi(ref expression) => { diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs index 088b61be8b8..003c2423576 100644 --- a/src/libsyntax_ext/deriving/debug.rs +++ b/src/libsyntax_ext/deriving/debug.rs @@ -131,7 +131,7 @@ fn stmt_let_undescore(cx: &mut ExtCtxt<'_>, sp: Span, expr: P<ast::Expr>) -> ast }); ast::Stmt { id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Local(local), + kind: ast::StmtKind::Local(local), span: sp, } } |
