about summary refs log tree commit diff
diff options
context:
space:
mode:
authorcsmoe <35686186+csmoe@users.noreply.github.com>2018-07-11 18:59:17 +0800
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-07-16 15:09:16 +0200
commit14893ba96b64f6077dae37ded929956046618714 (patch)
tree00bef10caee6714d5cb3ade3a7a7bddc6c7180f9
parent114314c92037d0e3e1320e9c7e4147f5b3bc2c63 (diff)
downloadrust-14893ba96b64f6077dae37ded929956046618714.tar.gz
rust-14893ba96b64f6077dae37ded929956046618714.zip
DeclKind
-rw-r--r--src/librustc/cfg/construct.rs4
-rw-r--r--src/librustc/hir/intravisit.rs4
-rw-r--r--src/librustc/hir/lowering.rs6
-rw-r--r--src/librustc/hir/mod.rs19
-rw-r--r--src/librustc/hir/print.rs8
-rw-r--r--src/librustc/ich/impls_hir.rs8
-rw-r--r--src/librustc/middle/expr_use_visitor.rs4
-rw-r--r--src/librustc/middle/liveness.rs4
-rw-r--r--src/librustc_mir/hair/cx/block.rs4
-rw-r--r--src/librustc_passes/rvalue_promotion.rs4
-rw-r--r--src/librustc_typeck/check/mod.rs8
11 files changed, 36 insertions, 37 deletions
diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs
index bbea4ad6a4c..e4b9ec89bc5 100644
--- a/src/librustc/cfg/construct.rs
+++ b/src/librustc/cfg/construct.rs
@@ -126,12 +126,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
 
     fn decl(&mut self, decl: &hir::Decl, pred: CFGIndex) -> CFGIndex {
         match decl.node {
-            hir::DeclLocal(ref local) => {
+            hir::DeclKind::Local(ref local) => {
                 let init_exit = self.opt_expr(&local.init, pred);
                 self.pat(&local.pat, init_exit)
             }
 
-            hir::DeclItem(_) => pred,
+            hir::DeclKind::Item(_) => pred,
         }
     }
 
diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs
index de0f3a405d8..01c318ca17c 100644
--- a/src/librustc/hir/intravisit.rs
+++ b/src/librustc/hir/intravisit.rs
@@ -949,8 +949,8 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
 
 pub fn walk_decl<'v, V: Visitor<'v>>(visitor: &mut V, declaration: &'v Decl) {
     match declaration.node {
-        DeclLocal(ref local) => visitor.visit_local(local),
-        DeclItem(item) => visitor.visit_nested_item(item),
+        DeclKind::Local(ref local) => visitor.visit_local(local),
+        DeclKind::Item(item) => visitor.visit_nested_item(item),
     }
 }
 
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 07d1281ada6..4bdf6e1e96b 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -4248,7 +4248,7 @@ impl<'a> LoweringContext<'a> {
             StmtKind::Local(ref l) => Spanned {
                 node: hir::StmtKind::Decl(
                     P(Spanned {
-                        node: hir::DeclLocal(self.lower_local(l)),
+                        node: hir::DeclKind::Local(self.lower_local(l)),
                         span: s.span,
                     }),
                     self.lower_node_id(s.id).node_id,
@@ -4263,7 +4263,7 @@ impl<'a> LoweringContext<'a> {
                     .map(|item_id| Spanned {
                         node: hir::StmtKind::Decl(
                             P(Spanned {
-                                node: hir::DeclItem(item_id),
+                                node: hir::DeclKind::Item(item_id),
                                 span: s.span,
                             }),
                             id.take()
@@ -4493,7 +4493,7 @@ impl<'a> LoweringContext<'a> {
             attrs: ThinVec::new(),
             source,
         });
-        let decl = respan(sp, hir::DeclLocal(local));
+        let decl = respan(sp, hir::DeclKind::Local(local));
         respan(sp, hir::StmtKind::Decl(P(decl), self.next_id().node_id))
     }
 
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index bb1536d9630..6e413416100 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -12,8 +12,7 @@
 
 pub use self::BlockCheckMode::*;
 pub use self::CaptureClause::*;
-pub use self::Decl_::*;
-pub use self::Expr_::*;
+pub use self::ExprKind::*;
 pub use self::FunctionRetTy::*;
 pub use self::ForeignItem_::*;
 pub use self::Item_::*;
@@ -1158,27 +1157,27 @@ pub struct Local {
     pub source: LocalSource,
 }
 
-pub type Decl = Spanned<Decl_>;
+pub type Decl = Spanned<DeclKind>;
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
-pub enum Decl_ {
+pub enum DeclKind {
     /// A local (let) binding:
-    DeclLocal(P<Local>),
+    Local(P<Local>),
     /// An item binding:
-    DeclItem(ItemId),
+    Item(ItemId),
 }
 
-impl Decl_ {
+impl DeclKind {
     pub fn attrs(&self) -> &[Attribute] {
         match *self {
-            DeclLocal(ref l) => &l.attrs,
-            DeclItem(_) => &[]
+            DeclKind::Local(ref l) => &l.attrs,
+            DeclKind::Item(_) => &[]
         }
     }
 
     pub fn is_local(&self) -> bool {
         match *self {
-            Decl_::DeclLocal(_) => true,
+            DeclKind::Local(_) => true,
             _ => false,
         }
     }
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index 5a3a36c6458..7fe06478844 100644
--- a/src/librustc/hir/print.rs
+++ b/src/librustc/hir/print.rs
@@ -1575,7 +1575,7 @@ impl<'a> State<'a> {
     pub fn print_decl(&mut self, decl: &hir::Decl) -> io::Result<()> {
         self.maybe_print_comment(decl.span.lo())?;
         match decl.node {
-            hir::DeclLocal(ref loc) => {
+            hir::DeclKind::Local(ref loc) => {
                 self.space_if_not_bol()?;
                 self.ibox(indent_unit)?;
                 self.word_nbsp("let")?;
@@ -1590,7 +1590,7 @@ impl<'a> State<'a> {
                 }
                 self.end()
             }
-            hir::DeclItem(item) => {
+            hir::DeclKind::Item(item) => {
                 self.ann.nested(self, Nested::Item(item))
             }
         }
@@ -2400,8 +2400,8 @@ fn stmt_ends_with_semi(stmt: &hir::StmtKind) -> bool {
     match *stmt {
         hir::StmtKind::Decl(ref d, _) => {
             match d.node {
-                hir::DeclLocal(_) => true,
-                hir::DeclItem(_) => false,
+                hir::DeclKind::Local(_) => true,
+                hir::DeclKind::Item(_) => false,
             }
         }
         hir::StmtKind::Expr(ref e, _) => {
diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs
index 8df6539ecfe..c242efeb8b0 100644
--- a/src/librustc/ich/impls_hir.rs
+++ b/src/librustc/ich/impls_hir.rs
@@ -479,10 +479,10 @@ impl_stable_hash_for!(struct hir::Local {
     source
 });
 
-impl_stable_hash_for_spanned!(hir::Decl_);
-impl_stable_hash_for!(enum hir::Decl_ {
-    DeclLocal(local),
-    DeclItem(item_id)
+impl_stable_hash_for_spanned!(hir::DeclKind);
+impl_stable_hash_for!(enum hir::DeclKind {
+    Local(local),
+    Item(item_id)
 });
 
 impl_stable_hash_for!(struct hir::Arm {
diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs
index af7dc3afdbb..8250821051a 100644
--- a/src/librustc/middle/expr_use_visitor.rs
+++ b/src/librustc/middle/expr_use_visitor.rs
@@ -588,11 +588,11 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
         match stmt.node {
             hir::StmtKind::Decl(ref decl, _) => {
                 match decl.node {
-                    hir::DeclLocal(ref local) => {
+                    hir::DeclKind::Local(ref local) => {
                         self.walk_local(&local);
                     }
 
-                    hir::DeclItem(_) => {
+                    hir::DeclKind::Item(_) => {
                         // we don't visit nested items in this visitor,
                         // only the fn body we were given.
                     }
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index cad74a0fb9e..fd23ae89940 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -873,10 +873,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
     fn propagate_through_decl(&mut self, decl: &hir::Decl, succ: LiveNode)
                               -> LiveNode {
         match decl.node {
-            hir::DeclLocal(ref local) => {
+            hir::DeclKind::Local(ref local) => {
                 self.propagate_through_local(&local, succ)
             }
-            hir::DeclItem(_) => succ,
+            hir::DeclKind::Item(_) => succ,
         }
     }
 
diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs
index 48558ba6db2..6c8b5d97b6f 100644
--- a/src/librustc_mir/hair/cx/block.rs
+++ b/src/librustc_mir/hair/cx/block.rs
@@ -67,10 +67,10 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
             }
             hir::StmtKind::Decl(ref decl, _) => {
                 match decl.node {
-                    hir::DeclItem(..) => {
+                    hir::DeclKind::Item(..) => {
                         // ignore for purposes of the MIR
                     }
-                    hir::DeclLocal(ref local) => {
+                    hir::DeclKind::Local(ref local) => {
                         let remainder_scope = region::Scope::Remainder(BlockRemainder {
                             block: block_id,
                             first_statement_index: region::FirstStatementIndex::new(index),
diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs
index 138731edfff..33b104072d9 100644
--- a/src/librustc_passes/rvalue_promotion.rs
+++ b/src/librustc_passes/rvalue_promotion.rs
@@ -263,7 +263,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
         match stmt.node {
             hir::StmtKind::Decl(ref decl, _node_id) => {
                 match &decl.node {
-                    hir::DeclLocal(local) => {
+                    hir::DeclKind::Local(local) => {
                         if self.remove_mut_rvalue_borrow(&local.pat) {
                             if let Some(init) = &local.init {
                                 self.mut_rvalue_borrows.insert(init.id);
@@ -277,7 +277,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
                         NotPromotable
                     }
                     // Item statements are allowed
-                    hir::DeclItem(_) => Promotable
+                    hir::DeclKind::Item(_) => Promotable
                 }
             }
             hir::StmtKind::Expr(ref box_expr, _node_id) |
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 0d93c52a248..75d02e32b64 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -4379,8 +4379,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         match stmt.node {
             hir::StmtKind::Decl(ref decl, _) => {
                 match decl.node {
-                    hir::DeclLocal(_) => {}
-                    hir::DeclItem(_) => {
+                    hir::DeclKind::Local(_) => {}
+                    hir::DeclKind::Item(_) => {
                         return;
                     }
                 }
@@ -4399,10 +4399,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         match stmt.node {
             hir::StmtKind::Decl(ref decl, _) => {
                 match decl.node {
-                    hir::DeclLocal(ref l) => {
+                    hir::DeclKind::Local(ref l) => {
                         self.check_decl_local(&l);
                     }
-                    hir::DeclItem(_) => {/* ignore for now */}
+                    hir::DeclKind::Item(_) => {/* ignore for now */}
                 }
             }
             hir::StmtKind::Expr(ref expr, _) => {