about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs13
-rw-r--r--src/libsyntax/attr.rs6
-rw-r--r--src/libsyntax/config.rs2
-rw-r--r--src/libsyntax/ext/build.rs6
-rw-r--r--src/libsyntax/ext/expand.rs6
-rw-r--r--src/libsyntax/fold.rs8
-rw-r--r--src/libsyntax/parse/classify.rs4
-rw-r--r--src/libsyntax/parse/parser.rs8
-rw-r--r--src/libsyntax/print/pprust.rs4
-rw-r--r--src/libsyntax/visit.rs4
10 files changed, 30 insertions, 31 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 209ed014ea2..9f013ad5ae7 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -10,7 +10,6 @@
 
 // The Rust abstract syntax tree.
 
-pub use self::Decl_::*;
 pub use self::ExplicitSelf_::*;
 pub use self::Expr_::*;
 pub use self::FloatTy::*;
@@ -829,21 +828,21 @@ impl Local {
     }
 }
 
-pub type Decl = Spanned<Decl_>;
+pub type Decl = Spanned<DeclKind>;
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
-pub enum Decl_ {
+pub enum DeclKind {
     /// A local (let) binding:
-    DeclLocal(P<Local>),
+    Local(P<Local>),
     /// An item binding:
-    DeclItem(P<Item>),
+    Item(P<Item>),
 }
 
 impl Decl {
     pub fn attrs(&self) -> &[Attribute] {
         match self.node {
-            DeclLocal(ref l) => l.attrs(),
-            DeclItem(ref i) => i.attrs(),
+            DeclKind::Local(ref l) => l.attrs(),
+            DeclKind::Item(ref i) => i.attrs(),
         }
     }
 }
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 96d0052cf18..746f728e096 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -16,7 +16,7 @@ pub use self::IntType::*;
 
 use ast;
 use ast::{AttrId, Attribute, Attribute_, MetaItem, MetaWord, MetaNameValue, MetaList};
-use ast::{Stmt, StmtDecl, StmtExpr, StmtMac, StmtSemi, DeclItem, DeclLocal};
+use ast::{Stmt, StmtDecl, StmtExpr, StmtMac, StmtSemi, DeclKind};
 use ast::{Expr, Item, Local, Decl};
 use codemap::{Span, Spanned, spanned, dummy_spanned};
 use codemap::BytePos;
@@ -933,8 +933,8 @@ impl WithAttrs for P<Decl> {
             Spanned {
                 span: span,
                 node: match node {
-                    DeclLocal(local) => DeclLocal(local.with_attrs(attrs)),
-                    DeclItem(item) => DeclItem(item.with_attrs(attrs)),
+                    DeclKind::Local(local) => DeclKind::Local(local.with_attrs(attrs)),
+                    DeclKind::Item(item) => DeclKind::Item(item.with_attrs(attrs)),
                 }
             }
         })
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index 64b16538f05..e849de0b1c6 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -373,7 +373,7 @@ impl<'v, 'a, 'b> visit::Visitor<'v> for StmtExprAttrFeatureVisitor<'a, 'b> {
         if stmt_attrs.len() > 0 {
             // attributes on items are fine
             if let ast::StmtDecl(ref decl, _) = s.node {
-                if let ast::DeclItem(_) = decl.node {
+                if let ast::DeclKind::Item(_) = decl.node {
                     visit::walk_stmt(self, s);
                     return;
                 }
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 5980cf3abcc..3a69b84ab3c 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -524,7 +524,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
             span: sp,
             attrs: None,
         });
-        let decl = respan(sp, ast::DeclLocal(local));
+        let decl = respan(sp, ast::DeclKind::Local(local));
         P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
     }
 
@@ -548,7 +548,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
             span: sp,
             attrs: None,
         });
-        let decl = respan(sp, ast::DeclLocal(local));
+        let decl = respan(sp, ast::DeclKind::Local(local));
         P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
     }
 
@@ -558,7 +558,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
     }
 
     fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> P<ast::Stmt> {
-        let decl = respan(sp, ast::DeclItem(item));
+        let decl = respan(sp, ast::DeclKind::Item(item));
         P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
     }
 
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 72537f6c7b2..460d564a70e 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use ast::{Block, Crate, DeclLocal, PatMac};
+use ast::{Block, Crate, DeclKind, PatMac};
 use ast::{Local, Ident, Mac_, Name};
 use ast::{ItemMac, MacStmtWithSemicolon, Mrk, Stmt, StmtDecl, StmtMac};
 use ast::{StmtExpr, StmtSemi};
@@ -559,7 +559,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
     // is it a let?
     match node {
         StmtDecl(decl, node_id) => decl.and_then(|Spanned {node: decl, span}| match decl {
-            DeclLocal(local) => {
+            DeclKind::Local(local) => {
                 // take it apart:
                 let rewritten_local = local.map(|Local {id, pat, ty, init, span, attrs}| {
                     // expand the ty since TyFixedLengthVec contains an Expr
@@ -597,7 +597,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
                 });
                 SmallVector::one(P(Spanned {
                     node: StmtDecl(P(Spanned {
-                            node: DeclLocal(rewritten_local),
+                            node: DeclKind::Local(rewritten_local),
                             span: span
                         }),
                         node_id),
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index dc96e9ecc09..233bcbf4650 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -356,12 +356,12 @@ pub fn noop_fold_arm<T: Folder>(Arm {attrs, pats, guard, body}: Arm, fld: &mut T
 
 pub fn noop_fold_decl<T: Folder>(d: P<Decl>, fld: &mut T) -> SmallVector<P<Decl>> {
     d.and_then(|Spanned {node, span}| match node {
-        DeclLocal(l) => SmallVector::one(P(Spanned {
-            node: DeclLocal(fld.fold_local(l)),
+        DeclKind::Local(l) => SmallVector::one(P(Spanned {
+            node: DeclKind::Local(fld.fold_local(l)),
             span: fld.new_span(span)
         })),
-        DeclItem(it) => fld.fold_item(it).into_iter().map(|i| P(Spanned {
-            node: DeclItem(i),
+        DeclKind::Item(it) => fld.fold_item(it).into_iter().map(|i| P(Spanned {
+            node: DeclKind::Item(i),
             span: fld.new_span(span)
         })).collect()
     })
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs
index ef50b3adad3..82b8730e10f 100644
--- a/src/libsyntax/parse/classify.rs
+++ b/src/libsyntax/parse/classify.rs
@@ -49,8 +49,8 @@ pub fn stmt_ends_with_semi(stmt: &ast::Stmt_) -> bool {
     match *stmt {
         ast::StmtDecl(ref d, _) => {
             match d.node {
-                ast::DeclLocal(_) => true,
-                ast::DeclItem(_) => false,
+                ast::DeclKind::Local(_) => true,
+                ast::DeclKind::Item(_) => false,
             }
         }
         ast::StmtExpr(ref e, _) => expr_requires_semi_to_be_stmt(e),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c149f1f62b0..8bdd9a8f539 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -18,7 +18,7 @@ use ast::{Mod, Arg, Arm, Attribute, BindingMode};
 use ast::Block;
 use ast::{BlockCheckMode, CaptureBy};
 use ast::{Constness, ConstTraitItem, Crate, CrateConfig};
-use ast::{Decl, DeclItem, DeclLocal};
+use ast::{Decl, DeclKind};
 use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf};
 use ast::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain};
 use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock, ExprBox};
@@ -3636,7 +3636,7 @@ impl<'a> Parser<'a> {
     fn parse_let(&mut self, attrs: ThinAttributes) -> PResult<'a, P<Decl>> {
         let lo = self.span.lo;
         let local = try!(self.parse_local(attrs));
-        Ok(P(spanned(lo, self.last_span.hi, DeclLocal(local))))
+        Ok(P(spanned(lo, self.last_span.hi, DeclKind::Local(local))))
     }
 
     /// Parse a structure field
@@ -3759,7 +3759,7 @@ impl<'a> Parser<'a> {
                     }
                 }
                 spanned(lo, hi, StmtDecl(
-                    P(spanned(lo, hi, DeclItem(
+                    P(spanned(lo, hi, DeclKind::Item(
                         self.mk_item(
                             lo, hi, id /*id is good here*/,
                             ItemMac(spanned(lo, hi,
@@ -3772,7 +3772,7 @@ impl<'a> Parser<'a> {
             match try!(self.parse_item_(attrs.clone(), false, true)) {
                 Some(i) => {
                     let hi = i.span.hi;
-                    let decl = P(spanned(lo, hi, DeclItem(i)));
+                    let decl = P(spanned(lo, hi, DeclKind::Item(i)));
                     spanned(lo, hi, StmtDecl(decl, ast::DUMMY_NODE_ID))
                 }
                 None => {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 9b8e16bbd38..421225f279d 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2299,7 +2299,7 @@ impl<'a> State<'a> {
     pub fn print_decl(&mut self, decl: &ast::Decl) -> io::Result<()> {
         try!(self.maybe_print_comment(decl.span.lo));
         match decl.node {
-            ast::DeclLocal(ref loc) => {
+            ast::DeclKind::Local(ref loc) => {
                 try!(self.print_outer_attributes(loc.attrs.as_attr_slice()));
                 try!(self.space_if_not_bol());
                 try!(self.ibox(INDENT_UNIT));
@@ -2315,7 +2315,7 @@ impl<'a> State<'a> {
                 }
                 self.end()
             }
-            ast::DeclItem(ref item) => self.print_item(&**item)
+            ast::DeclKind::Item(ref item) => self.print_item(&**item)
         }
     }
 
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 834291dd561..d12a5f353e7 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -640,8 +640,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(ref item) => visitor.visit_item(item),
+        DeclKind::Local(ref local) => visitor.visit_local(local),
+        DeclKind::Item(ref item) => visitor.visit_item(item),
     }
 }