Skip to content

Commit 21bf983

Browse files
committed
Rename Stmt.node to Stmt.kind
1 parent c3d8791 commit 21bf983

File tree

32 files changed

+76
-76
lines changed

32 files changed

+76
-76
lines changed

src/librustc/hir/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl CheckAttrVisitor<'tcx> {
262262

263263
fn check_stmt_attributes(&self, stmt: &hir::Stmt) {
264264
// When checking statements ignore expressions, they will be checked later
265-
if let hir::StmtKind::Local(ref l) = stmt.node {
265+
if let hir::StmtKind::Local(ref l) = stmt.kind {
266266
for attr in l.attrs.iter() {
267267
if attr.check_name(sym::inline) {
268268
self.check_inline(attr, &stmt.span, Target::Statement);

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block) {
974974

975975
pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
976976
visitor.visit_id(statement.hir_id);
977-
match statement.node {
977+
match statement.kind {
978978
StmtKind::Local(ref local) => visitor.visit_local(local),
979979
StmtKind::Item(item) => visitor.visit_nested_item(item),
980980
StmtKind::Expr(ref expression) |

src/librustc/hir/lowering.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,7 +2660,7 @@ impl<'a> LoweringContext<'a> {
26602660

26612661
for (index, stmt) in b.stmts.iter().enumerate() {
26622662
if index == b.stmts.len() - 1 {
2663-
if let StmtKind::Expr(ref e) = stmt.node {
2663+
if let StmtKind::Expr(ref e) = stmt.kind {
26642664
expr = Some(P(self.lower_expr(e)));
26652665
} else {
26662666
stmts.extend(self.lower_stmt(stmt));
@@ -2931,7 +2931,7 @@ impl<'a> LoweringContext<'a> {
29312931
}
29322932

29332933
fn lower_stmt(&mut self, s: &Stmt) -> SmallVec<[hir::Stmt; 1]> {
2934-
let node = match s.node {
2934+
let kind = match s.kind {
29352935
StmtKind::Local(ref l) => {
29362936
let (l, item_ids) = self.lower_local(l);
29372937
let mut ids: SmallVec<[hir::Stmt; 1]> = item_ids
@@ -2944,7 +2944,7 @@ impl<'a> LoweringContext<'a> {
29442944
ids.push({
29452945
hir::Stmt {
29462946
hir_id: self.lower_node_id(s.id),
2947-
node: hir::StmtKind::Local(P(l)),
2947+
kind: hir::StmtKind::Local(P(l)),
29482948
span: s.span,
29492949
}
29502950
});
@@ -2962,7 +2962,7 @@ impl<'a> LoweringContext<'a> {
29622962

29632963
hir::Stmt {
29642964
hir_id,
2965-
node: hir::StmtKind::Item(item_id),
2965+
kind: hir::StmtKind::Item(item_id),
29662966
span: s.span,
29672967
}
29682968
})
@@ -2974,7 +2974,7 @@ impl<'a> LoweringContext<'a> {
29742974
};
29752975
smallvec![hir::Stmt {
29762976
hir_id: self.lower_node_id(s.id),
2977-
node,
2977+
kind,
29782978
span: s.span,
29792979
}]
29802980
}
@@ -3011,8 +3011,8 @@ impl<'a> LoweringContext<'a> {
30113011

30123012
// Helper methods for building HIR.
30133013

3014-
fn stmt(&mut self, span: Span, node: hir::StmtKind) -> hir::Stmt {
3015-
hir::Stmt { span, node, hir_id: self.next_id() }
3014+
fn stmt(&mut self, span: Span, kind: hir::StmtKind) -> hir::Stmt {
3015+
hir::Stmt { span, kind, hir_id: self.next_id() }
30163016
}
30173017

30183018
fn stmt_expr(&mut self, span: Span, expr: hir::Expr) -> hir::Stmt {

src/librustc/hir/map/def_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
303303
}
304304

305305
fn visit_stmt(&mut self, stmt: &'a Stmt) {
306-
match stmt.node {
306+
match stmt.kind {
307307
StmtKind::Mac(..) => self.visit_macro_invoc(stmt.id),
308308
_ => visit::walk_stmt(self, stmt),
309309
}

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ impl<'hir> Map<'hir> {
968968
Some(Node::Variant(ref v)) => Some(&v.attrs[..]),
969969
Some(Node::Field(ref f)) => Some(&f.attrs[..]),
970970
Some(Node::Expr(ref e)) => Some(&*e.attrs),
971-
Some(Node::Stmt(ref s)) => Some(s.node.attrs()),
971+
Some(Node::Stmt(ref s)) => Some(s.kind.attrs()),
972972
Some(Node::Arm(ref a)) => Some(&*a.attrs),
973973
Some(Node::GenericParam(param)) => Some(&param.attrs[..]),
974974
// Unit/tuple structs/variants take the attributes straight from

src/librustc/hir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ impl UnOp {
12211221
#[derive(RustcEncodable, RustcDecodable)]
12221222
pub struct Stmt {
12231223
pub hir_id: HirId,
1224-
pub node: StmtKind,
1224+
pub kind: StmtKind,
12251225
pub span: Span,
12261226
}
12271227

src/librustc/hir/print.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ impl<'a> State<'a> {
944944

945945
pub fn print_stmt(&mut self, st: &hir::Stmt) {
946946
self.maybe_print_comment(st.span.lo());
947-
match st.node {
947+
match st.kind {
948948
hir::StmtKind::Local(ref loc) => {
949949
self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc));
950950
}
@@ -961,7 +961,7 @@ impl<'a> State<'a> {
961961
self.s.word(";");
962962
}
963963
}
964-
if stmt_ends_with_semi(&st.node) {
964+
if stmt_ends_with_semi(&st.kind) {
965965
self.s.word(";");
966966
}
967967
self.maybe_print_trailing_comment(st.span, None)

src/librustc/ich/impls_hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl_stable_hash_for_spanned!(hir::BinOpKind);
158158

159159
impl_stable_hash_for!(struct hir::Stmt {
160160
hir_id,
161-
node,
161+
kind,
162162
span,
163163
});
164164

src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
590590
}
591591

592592
fn walk_stmt(&mut self, stmt: &hir::Stmt) {
593-
match stmt.node {
593+
match stmt.kind {
594594
hir::StmtKind::Local(ref local) => {
595595
self.walk_local(&local);
596596
}

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
947947

948948
fn propagate_through_stmt(&mut self, stmt: &hir::Stmt, succ: LiveNode)
949949
-> LiveNode {
950-
match stmt.node {
950+
match stmt.kind {
951951
hir::StmtKind::Local(ref local) => {
952952
// Note: we mark the variable as defined regardless of whether
953953
// there is an initializer. Initially I had thought to only mark

src/librustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
796796
// index information.)
797797

798798
for (i, statement) in blk.stmts.iter().enumerate() {
799-
match statement.node {
799+
match statement.kind {
800800
hir::StmtKind::Local(..) |
801801
hir::StmtKind::Item(..) => {
802802
// Each declaration introduces a subscope for bindings

src/librustc_ast_borrowck/cfg/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
9999
}
100100

101101
fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex {
102-
let exit = match stmt.node {
102+
let exit = match stmt.kind {
103103
hir::StmtKind::Local(ref local) => {
104104
let init_exit = self.opt_expr(&local.init, pred);
105105
self.pat(&local.pat, init_exit)

src/librustc_interface/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
841841

842842
ast::Stmt {
843843
id: sess.next_node_id(),
844-
node: ast::StmtKind::Expr(expr),
844+
kind: ast::StmtKind::Expr(expr),
845845
span: syntax_pos::DUMMY_SP,
846846
}
847847
}
@@ -857,7 +857,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
857857
let loop_stmt = ast::Stmt {
858858
id: self.sess.next_node_id(),
859859
span: syntax_pos::DUMMY_SP,
860-
node: ast::StmtKind::Expr(loop_expr),
860+
kind: ast::StmtKind::Expr(loop_expr),
861861
};
862862

863863
if self.within_static_or_const {

src/librustc_lint/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ impl EarlyLintPass for UnusedDocComment {
772772
}
773773

774774
fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) {
775-
let (kind, is_macro_expansion) = match stmt.node {
775+
let (kind, is_macro_expansion) = match stmt.kind {
776776
ast::StmtKind::Local(..) => ("statements", false),
777777
ast::StmtKind::Item(..) => ("inner items", false),
778778
ast::StmtKind::Mac(..) => ("macro expansions", true),
@@ -781,7 +781,7 @@ impl EarlyLintPass for UnusedDocComment {
781781
ast::StmtKind::Expr(..) => return,
782782
};
783783

784-
self.warn_if_doc(cx, stmt.span, kind, is_macro_expansion, stmt.node.attrs());
784+
self.warn_if_doc(cx, stmt.span, kind, is_macro_expansion, stmt.kind.attrs());
785785
}
786786

787787
fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) {

src/librustc_lint/redundant_semicolon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ declare_lint_pass!(RedundantSemicolon => [REDUNDANT_SEMICOLON]);
1212

1313
impl EarlyLintPass for RedundantSemicolon {
1414
fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &Stmt) {
15-
if let StmtKind::Semi(expr) = &stmt.node {
15+
if let StmtKind::Semi(expr) = &stmt.kind {
1616
if let ExprKind::Tup(ref v) = &expr.kind {
1717
if v.is_empty() {
1818
// Strings of excess semicolons are encoded as empty tuple expressions

src/librustc_lint/unused.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ declare_lint_pass!(UnusedResults => [UNUSED_MUST_USE, UNUSED_RESULTS]);
3838

3939
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
4040
fn check_stmt(&mut self, cx: &LateContext<'_, '_>, s: &hir::Stmt) {
41-
let expr = match s.node {
41+
let expr = match s.kind {
4242
hir::StmtKind::Semi(ref expr) => &**expr,
4343
_ => return,
4444
};
@@ -269,7 +269,7 @@ declare_lint_pass!(PathStatements => [PATH_STATEMENTS]);
269269

270270
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PathStatements {
271271
fn check_stmt(&mut self, cx: &LateContext<'_, '_>, s: &hir::Stmt) {
272-
if let hir::StmtKind::Semi(ref expr) = s.node {
272+
if let hir::StmtKind::Semi(ref expr) = s.kind {
273273
if let hir::ExprKind::Path(_) = expr.kind {
274274
cx.span_lint(PATH_STATEMENTS, s.span, "path statement with no effect");
275275
}
@@ -587,7 +587,7 @@ impl EarlyLintPass for UnusedParens {
587587
}
588588

589589
fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) {
590-
if let ast::StmtKind::Local(ref local) = s.node {
590+
if let ast::StmtKind::Local(ref local) = s.kind {
591591
self.check_unused_parens_pat(cx, &local.pat, false, false);
592592

593593
if let Some(ref value) = local.init {

src/librustc_mir/hair/cx/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn mirror_stmts<'a, 'tcx>(
4949
for (index, stmt) in stmts.iter().enumerate() {
5050
let hir_id = stmt.hir_id;
5151
let opt_dxn_ext = cx.region_scope_tree.opt_destruction_scope(hir_id.local_id);
52-
match stmt.node {
52+
match stmt.kind {
5353
hir::StmtKind::Expr(ref expr) |
5454
hir::StmtKind::Semi(ref expr) => {
5555
result.push(StmtRef::Mirror(Box::new(Stmt {

src/librustc_passes/rvalue_promotion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
212212
}
213213

214214
fn check_stmt(&mut self, stmt: &'tcx hir::Stmt) -> Promotability {
215-
match stmt.node {
215+
match stmt.kind {
216216
hir::StmtKind::Local(ref local) => {
217217
if self.remove_mut_rvalue_borrow(&local.pat) {
218218
if let Some(init) = &local.init {

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
309309

310310
fn block_needs_anonymous_module(&mut self, block: &Block) -> bool {
311311
// If any statements are items, we need to create an anonymous module
312-
block.stmts.iter().any(|statement| match statement.node {
312+
block.stmts.iter().any(|statement| match statement.kind {
313313
StmtKind::Item(_) | StmtKind::Mac(_) => true,
314314
_ => false,
315315
})
@@ -1161,7 +1161,7 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
11611161
}
11621162

11631163
fn visit_stmt(&mut self, stmt: &'b ast::Stmt) {
1164-
if let ast::StmtKind::Mac(..) = stmt.node {
1164+
if let ast::StmtKind::Mac(..) = stmt.kind {
11651165
self.parent_scope.legacy = self.visit_invoc(stmt.id);
11661166
} else {
11671167
visit::walk_stmt(self, stmt);

src/librustc_resolve/late.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
18041804

18051805
// Descend into the block.
18061806
for stmt in &block.stmts {
1807-
if let StmtKind::Item(ref item) = stmt.node {
1807+
if let StmtKind::Item(ref item) = stmt.kind {
18081808
if let ItemKind::MacroDef(..) = item.node {
18091809
num_macro_definition_ribs += 1;
18101810
let res = self.r.definitions.local_def_id(item.id);

src/librustc_typeck/check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3860,7 +3860,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
38603860

38613861
pub fn check_stmt(&self, stmt: &'tcx hir::Stmt) {
38623862
// Don't do all the complex logic below for `DeclItem`.
3863-
match stmt.node {
3863+
match stmt.kind {
38643864
hir::StmtKind::Item(..) => return,
38653865
hir::StmtKind::Local(..) | hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {}
38663866
}
@@ -3873,7 +3873,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
38733873
self.diverges.set(Diverges::Maybe);
38743874
self.has_errors.set(false);
38753875

3876-
match stmt.node {
3876+
match stmt.kind {
38773877
hir::StmtKind::Local(ref l) => {
38783878
self.check_decl_local(&l);
38793879
}
@@ -4560,7 +4560,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
45604560
// Be helpful when the user wrote `{... expr;}` and
45614561
// taking the `;` off is enough to fix the error.
45624562
let last_stmt = blk.stmts.last()?;
4563-
let last_expr = match last_stmt.node {
4563+
let last_expr = match last_stmt.kind {
45644564
hir::StmtKind::Semi(ref e) => e,
45654565
_ => return None,
45664566
};

src/libsyntax/ast.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -835,31 +835,31 @@ impl UnOp {
835835
#[derive(Clone, RustcEncodable, RustcDecodable)]
836836
pub struct Stmt {
837837
pub id: NodeId,
838-
pub node: StmtKind,
838+
pub kind: StmtKind,
839839
pub span: Span,
840840
}
841841

842842
impl Stmt {
843843
pub fn add_trailing_semicolon(mut self) -> Self {
844-
self.node = match self.node {
844+
self.kind = match self.kind {
845845
StmtKind::Expr(expr) => StmtKind::Semi(expr),
846846
StmtKind::Mac(mac) => {
847847
StmtKind::Mac(mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)))
848848
}
849-
node => node,
849+
kind => kind,
850850
};
851851
self
852852
}
853853

854854
pub fn is_item(&self) -> bool {
855-
match self.node {
855+
match self.kind {
856856
StmtKind::Item(_) => true,
857857
_ => false,
858858
}
859859
}
860860

861861
pub fn is_expr(&self) -> bool {
862-
match self.node {
862+
match self.kind {
863863
StmtKind::Expr(_) => true,
864864
_ => false,
865865
}
@@ -991,7 +991,7 @@ impl Expr {
991991
/// for example, an `if` condition.
992992
pub fn returns(&self) -> bool {
993993
if let ExprKind::Block(ref block, _) = self.kind {
994-
match block.stmts.last().map(|last_stmt| &last_stmt.node) {
994+
match block.stmts.last().map(|last_stmt| &last_stmt.kind) {
995995
// Implicit return
996996
Some(&StmtKind::Expr(_)) => true,
997997
Some(&StmtKind::Semi(ref expr)) => {

src/libsyntax/attr/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,11 +702,11 @@ impl HasAttrs for StmtKind {
702702

703703
impl HasAttrs for Stmt {
704704
fn attrs(&self) -> &[ast::Attribute] {
705-
self.node.attrs()
705+
self.kind.attrs()
706706
}
707707

708708
fn visit_attrs<F: FnOnce(&mut Vec<ast::Attribute>)>(&mut self, f: F) {
709-
self.node.visit_attrs(f);
709+
self.kind.visit_attrs(f);
710710
}
711711
}
712712

src/libsyntax/ext/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ macro_rules! make_stmts_default {
363363
$me.make_expr().map(|e| smallvec![ast::Stmt {
364364
id: ast::DUMMY_NODE_ID,
365365
span: e.span,
366-
node: ast::StmtKind::Expr(e),
366+
kind: ast::StmtKind::Expr(e),
367367
}])
368368
}
369369
}
@@ -602,7 +602,7 @@ impl MacResult for DummyResult {
602602
fn make_stmts(self: Box<DummyResult>) -> Option<SmallVec<[ast::Stmt; 1]>> {
603603
Some(smallvec![ast::Stmt {
604604
id: ast::DUMMY_NODE_ID,
605-
node: ast::StmtKind::Expr(DummyResult::raw_expr(self.span, self.is_error)),
605+
kind: ast::StmtKind::Expr(DummyResult::raw_expr(self.span, self.is_error)),
606606
span: self.span,
607607
}])
608608
}

0 commit comments

Comments
 (0)