about summary refs log tree commit diff
path: root/src/libsyntax_ext/deriving
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-02-11 12:52:42 +0000
committerbors <bors@rust-lang.org>2016-02-11 12:52:42 +0000
commit7732c0aa9ea12262cbe46fa77c2fa636e8aecf6a (patch)
tree8d0364921d0d70e6fdc67176297a1f1ee3e5070e /src/libsyntax_ext/deriving
parentf5f8e0bfbeee2abc425f26a3ad36430f23010e69 (diff)
parentbafea3bf78e75c99958ef15fd3d06652cb63133c (diff)
downloadrust-7732c0aa9ea12262cbe46fa77c2fa636e8aecf6a.tar.gz
rust-7732c0aa9ea12262cbe46fa77c2fa636e8aecf6a.zip
Auto merge of #31487 - oli-obk:breaking_batch/ast/unop, r=Manishearth
r? @Manishearth

I just noticed they can't be rolled up (often modifying the same line(s) in imports). So once I reach the critical amount for them to be merged I'll create a PR that merges all of them.
Diffstat (limited to 'src/libsyntax_ext/deriving')
-rw-r--r--src/libsyntax_ext/deriving/cmp/ord.rs5
-rw-r--r--src/libsyntax_ext/deriving/cmp/partial_eq.rs10
-rw-r--r--src/libsyntax_ext/deriving/cmp/partial_ord.rs13
-rw-r--r--src/libsyntax_ext/deriving/debug.rs13
-rw-r--r--src/libsyntax_ext/deriving/decodable.rs4
-rw-r--r--src/libsyntax_ext/deriving/encodable.rs18
-rw-r--r--src/libsyntax_ext/deriving/generic/mod.rs92
-rw-r--r--src/libsyntax_ext/deriving/generic/ty.rs8
-rw-r--r--src/libsyntax_ext/deriving/hash.rs4
-rw-r--r--src/libsyntax_ext/deriving/mod.rs4
10 files changed, 84 insertions, 87 deletions
diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs
index 95a5d184d0e..2fa847ee430 100644
--- a/src/libsyntax_ext/deriving/cmp/ord.rs
+++ b/src/libsyntax_ext/deriving/cmp/ord.rs
@@ -11,8 +11,7 @@
 use deriving::generic::*;
 use deriving::generic::ty::*;
 
-use syntax::ast;
-use syntax::ast::{MetaItem, Expr};
+use syntax::ast::{MetaItem, Expr, BinOpKind, self};
 use syntax::codemap::Span;
 use syntax::ext::base::{ExtCtxt, Annotatable};
 use syntax::ext::build::AstBuilder;
@@ -116,7 +115,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
 
             let assign = cx.stmt_let(span, false, test_id, new);
 
-            let cond = cx.expr_binary(span, ast::BiEq,
+            let cond = cx.expr_binary(span, BinOpKind::Eq,
                                       cx.expr_ident(span, test_id),
                                       cx.expr_path(equals_path.clone()));
             let if_ = cx.expr_if(span,
diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs
index 29be5a7ddc3..0150a073b07 100644
--- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs
+++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs
@@ -11,7 +11,7 @@
 use deriving::generic::*;
 use deriving::generic::ty::*;
 
-use syntax::ast::{MetaItem, Expr, self};
+use syntax::ast::{MetaItem, Expr, BinOpKind};
 use syntax::codemap::Span;
 use syntax::ext::base::{ExtCtxt, Annotatable};
 use syntax::ext::build::AstBuilder;
@@ -35,9 +35,9 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
                     _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
                 };
 
-                let eq = cx.expr_binary(span, ast::BiEq, self_f, other_f.clone());
+                let eq = cx.expr_binary(span, BinOpKind::Eq, self_f, other_f.clone());
 
-                cx.expr_binary(span, ast::BiAnd, subexpr, eq)
+                cx.expr_binary(span, BinOpKind::And, subexpr, eq)
             },
             cx.expr_bool(span, true),
             Box::new(|cx, span, _, _| cx.expr_bool(span, false)),
@@ -52,9 +52,9 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
                     _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
                 };
 
-                let eq = cx.expr_binary(span, ast::BiNe, self_f, other_f.clone());
+                let eq = cx.expr_binary(span, BinOpKind::Ne, self_f, other_f.clone());
 
-                cx.expr_binary(span, ast::BiOr, subexpr, eq)
+                cx.expr_binary(span, BinOpKind::Or, subexpr, eq)
             },
             cx.expr_bool(span, false),
             Box::new(|cx, span, _, _| cx.expr_bool(span, true)),
diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs
index bd825e5c8df..e857f7d52f9 100644
--- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs
+++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs
@@ -13,8 +13,7 @@ pub use self::OrderingOp::*;
 use deriving::generic::*;
 use deriving::generic::ty::*;
 
-use syntax::ast;
-use syntax::ast::{MetaItem, Expr};
+use syntax::ast::{MetaItem, Expr, BinOpKind, self};
 use syntax::codemap::Span;
 use syntax::ext::base::{ExtCtxt, Annotatable};
 use syntax::ext::build::AstBuilder;
@@ -161,7 +160,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
 
             let assign = cx.stmt_let(span, false, test_id, new);
 
-            let cond = cx.expr_binary(span, ast::BiEq,
+            let cond = cx.expr_binary(span, BinOpKind::Eq,
                                       cx.expr_ident(span, test_id),
                                       equals_expr.clone());
             let if_ = cx.expr_if(span,
@@ -183,7 +182,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
 /// Strict inequality.
 fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
          span: Span, substr: &Substructure) -> P<Expr> {
-    let op = if less {ast::BiLt} else {ast::BiGt};
+    let op = if less { BinOpKind::Lt } else { BinOpKind::Gt };
     cs_fold(
         false, // need foldr,
         |cx, span, subexpr, self_f, other_fs| {
@@ -211,11 +210,11 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
 
             let cmp = cx.expr_binary(span, op, self_f.clone(), other_f.clone());
 
-            let not_cmp = cx.expr_unary(span, ast::UnNot,
+            let not_cmp = cx.expr_unary(span, ast::UnOp::Not,
                                         cx.expr_binary(span, op, other_f.clone(), self_f));
 
-            let and = cx.expr_binary(span, ast::BiAnd, not_cmp, subexpr);
-            cx.expr_binary(span, ast::BiOr, cmp, and)
+            let and = cx.expr_binary(span, BinOpKind::And, not_cmp, subexpr);
+            cx.expr_binary(span, BinOpKind::Or, cmp, and)
         },
         cx.expr_bool(span, equal),
         Box::new(|cx, span, (self_args, tag_tuple), _non_self_args| {
diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs
index 008067f39a3..858066cb626 100644
--- a/src/libsyntax_ext/deriving/debug.rs
+++ b/src/libsyntax_ext/deriving/debug.rs
@@ -27,7 +27,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt,
 {
     // &mut ::std::fmt::Formatter
     let fmtr = Ptr(Box::new(Literal(path_std!(cx, core::fmt::Formatter))),
-                   Borrowed(None, ast::MutMutable));
+                   Borrowed(None, ast::Mutability::Mutable));
 
     let trait_def = TraitDef {
         span: span,
@@ -71,8 +71,7 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span,
 
     // We want to make sure we have the expn_id set so that we can use unstable methods
     let span = Span { expn_id: cx.backtrace(), .. span };
-    let name = cx.expr_lit(span, ast::Lit_::LitStr(ident.name.as_str(),
-                                                   ast::StrStyle::CookedStr));
+    let name = cx.expr_lit(span, ast::LitKind::Str(ident.name.as_str(), ast::StrStyle::Cooked));
     let builder = token::str_to_ident("builder");
     let builder_expr = cx.expr_ident(span, builder.clone());
 
@@ -112,9 +111,9 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span,
                 stmts.push(cx.stmt_let(DUMMY_SP, true, builder, expr));
 
                 for field in fields {
-                    let name = cx.expr_lit(field.span, ast::Lit_::LitStr(
+                    let name = cx.expr_lit(field.span, ast::LitKind::Str(
                             field.name.unwrap().name.as_str(),
-                            ast::StrStyle::CookedStr));
+                            ast::StrStyle::Cooked));
 
                     // Use double indirection to make sure this works for unsized types
                     let field = cx.expr_addr_of(field.span, field.self_.clone());
@@ -151,6 +150,6 @@ fn stmt_let_undescore(cx: &mut ExtCtxt,
         span: sp,
         attrs: None,
     });
-    let decl = respan(sp, ast::DeclLocal(local));
-    P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
+    let decl = respan(sp, ast::DeclKind::Local(local));
+    P(respan(sp, ast::StmtKind::Decl(P(decl), ast::DUMMY_NODE_ID)))
 }
diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/libsyntax_ext/deriving/decodable.rs
index 4ea4f04623a..092f8548966 100644
--- a/src/libsyntax_ext/deriving/decodable.rs
+++ b/src/libsyntax_ext/deriving/decodable.rs
@@ -14,7 +14,7 @@ use deriving::generic::*;
 use deriving::generic::ty::*;
 
 use syntax::ast;
-use syntax::ast::{MetaItem, Expr, MutMutable};
+use syntax::ast::{MetaItem, Expr, Mutability};
 use syntax::codemap::Span;
 use syntax::ext::base::{ExtCtxt, Annotatable};
 use syntax::ext::build::AstBuilder;
@@ -72,7 +72,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
                 },
                 explicit_self: None,
                 args: vec!(Ptr(Box::new(Literal(Path::new_local("__D"))),
-                            Borrowed(None, MutMutable))),
+                            Borrowed(None, Mutability::Mutable))),
                 ret_ty: Literal(Path::new_(
                     pathvec_std!(cx, core::result::Result),
                     None,
diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs
index 02747d38c00..614a6381962 100644
--- a/src/libsyntax_ext/deriving/encodable.rs
+++ b/src/libsyntax_ext/deriving/encodable.rs
@@ -91,7 +91,7 @@
 use deriving::generic::*;
 use deriving::generic::ty::*;
 
-use syntax::ast::{MetaItem, Expr, ExprRet, MutMutable};
+use syntax::ast::{MetaItem, Expr, ExprKind, Mutability};
 use syntax::codemap::Span;
 use syntax::ext::base::{ExtCtxt,Annotatable};
 use syntax::ext::build::AstBuilder;
@@ -148,7 +148,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
                 },
                 explicit_self: borrowed_explicit_self(),
                 args: vec!(Ptr(Box::new(Literal(Path::new_local("__S"))),
-                            Borrowed(None, MutMutable))),
+                            Borrowed(None, Mutability::Mutable))),
                 ret_ty: Literal(Path::new_(
                     pathvec_std!(cx, core::result::Result),
                     None,
@@ -208,16 +208,15 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                 let call = if i != last {
                     cx.expr_try(span, call)
                 } else {
-                    cx.expr(span, ExprRet(Some(call)))
+                    cx.expr(span, ExprKind::Ret(Some(call)))
                 };
                 stmts.push(cx.stmt_expr(call));
             }
 
             // unit structs have no fields and need to return Ok()
             if stmts.is_empty() {
-                let ret_ok = cx.expr(trait_span,
-                                     ExprRet(Some(cx.expr_ok(trait_span,
-                                                             cx.expr_tuple(trait_span, vec![])))));
+                let ok = cx.expr_ok(trait_span, cx.expr_tuple(trait_span, vec![]));
+                let ret_ok = cx.expr(trait_span, ExprKind::Ret(Some(ok)));
                 stmts.push(cx.stmt_expr(ret_ok));
             }
 
@@ -254,14 +253,13 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                     let call = if i != last {
                         cx.expr_try(span, call)
                     } else {
-                        cx.expr(span, ExprRet(Some(call)))
+                        cx.expr(span, ExprKind::Ret(Some(call)))
                     };
                     stmts.push(cx.stmt_expr(call));
                 }
             } else {
-                let ret_ok = cx.expr(trait_span,
-                                     ExprRet(Some(cx.expr_ok(trait_span,
-                                                             cx.expr_tuple(trait_span, vec![])))));
+                let ok = cx.expr_ok(trait_span, cx.expr_tuple(trait_span, vec![]));
+                let ret_ok = cx.expr(trait_span, ExprKind::Ret(Some(ok)));
                 stmts.push(cx.stmt_expr(ret_ok));
             }
 
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index 3af701739b4..1e4babfac1e 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -193,9 +193,7 @@ use std::collections::HashSet;
 use std::vec;
 
 use syntax::abi::Abi;
-use syntax::abi;
-use syntax::ast;
-use syntax::ast::{EnumDef, Expr, Ident, Generics, VariantData};
+use syntax::ast::{EnumDef, Expr, Ident, Generics, VariantData, BinOpKind, self};
 use syntax::ast_util;
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
@@ -356,7 +354,7 @@ fn find_type_parameters(ty: &ast::Ty, ty_param_names: &[ast::Name]) -> Vec<P<ast
     impl<'a> visit::Visitor<'a> for Visitor<'a> {
         fn visit_ty(&mut self, ty: &'a ast::Ty) {
             match ty.node {
-                ast::TyPath(_, ref path) if !path.global => {
+                ast::TyKind::Path(_, ref path) if !path.global => {
                     match path.segments.first() {
                         Some(segment) => {
                             if self.ty_param_names.contains(&segment.identifier.name) {
@@ -393,13 +391,13 @@ impl<'a> TraitDef<'a> {
         match *item {
             Annotatable::Item(ref item) => {
                 let newitem = match item.node {
-                    ast::ItemStruct(ref struct_def, ref generics) => {
+                    ast::ItemKind::Struct(ref struct_def, ref generics) => {
                         self.expand_struct_def(cx,
                                                &struct_def,
                                                item.ident,
                                                generics)
                     }
-                    ast::ItemEnum(ref enum_def, ref generics) => {
+                    ast::ItemKind::Enum(ref enum_def, ref generics) => {
                         self.expand_enum_def(cx,
                                              enum_def,
                                              &item.attrs,
@@ -477,7 +475,7 @@ impl<'a> TraitDef<'a> {
                 id: ast::DUMMY_NODE_ID,
                 span: self.span,
                 ident: ident,
-                vis: ast::Inherited,
+                vis: ast::Visibility::Inherited,
                 attrs: Vec::new(),
                 node: ast::ImplItemKind::Type(type_def.to_ty(cx,
                     self.span,
@@ -559,7 +557,7 @@ impl<'a> TraitDef<'a> {
 
                 for ty in tys {
                     // if we have already handled this type, skip it
-                    if let ast::TyPath(_, ref p) = ty.node {
+                    if let ast::TyKind::Path(_, ref p) = ty.node {
                         if p.segments.len() == 1
                             && ty_param_names.contains(&p.segments[0].identifier.name)
                             || processed_field_types.contains(&p.segments) {
@@ -639,12 +637,12 @@ impl<'a> TraitDef<'a> {
             self.span,
             ident,
             a,
-            ast::ItemImpl(unsafety,
-                          ast::ImplPolarity::Positive,
-                          trait_generics,
-                          opt_trait_ref,
-                          self_type,
-                          methods.into_iter().chain(associated_types).collect()))
+            ast::ItemKind::Impl(unsafety,
+                                ast::ImplPolarity::Positive,
+                                trait_generics,
+                                opt_trait_ref,
+                                self_type,
+                                methods.into_iter().chain(associated_types).collect()))
     }
 
     fn expand_struct_def(&self,
@@ -682,7 +680,7 @@ impl<'a> TraitDef<'a> {
                                      self,
                                      type_ident,
                                      generics,
-                                     abi::Rust,
+                                     Abi::Rust,
                                      explicit_self,
                                      tys,
                                      body)
@@ -731,7 +729,7 @@ impl<'a> TraitDef<'a> {
                                      self,
                                      type_ident,
                                      generics,
-                                     abi::Rust,
+                                     Abi::Rust,
                                      explicit_self,
                                      tys,
                                      body)
@@ -750,17 +748,17 @@ fn find_repr_type_name(diagnostic: &Handler,
                 attr::ReprAny | attr::ReprPacked | attr::ReprSimd => continue,
                 attr::ReprExtern => "i32",
 
-                attr::ReprInt(_, attr::SignedInt(ast::TyIs)) => "isize",
-                attr::ReprInt(_, attr::SignedInt(ast::TyI8)) => "i8",
-                attr::ReprInt(_, attr::SignedInt(ast::TyI16)) => "i16",
-                attr::ReprInt(_, attr::SignedInt(ast::TyI32)) => "i32",
-                attr::ReprInt(_, attr::SignedInt(ast::TyI64)) => "i64",
-
-                attr::ReprInt(_, attr::UnsignedInt(ast::TyUs)) => "usize",
-                attr::ReprInt(_, attr::UnsignedInt(ast::TyU8)) => "u8",
-                attr::ReprInt(_, attr::UnsignedInt(ast::TyU16)) => "u16",
-                attr::ReprInt(_, attr::UnsignedInt(ast::TyU32)) => "u32",
-                attr::ReprInt(_, attr::UnsignedInt(ast::TyU64)) => "u64",
+                attr::ReprInt(_, attr::SignedInt(ast::IntTy::Is)) => "isize",
+                attr::ReprInt(_, attr::SignedInt(ast::IntTy::I8)) => "i8",
+                attr::ReprInt(_, attr::SignedInt(ast::IntTy::I16)) => "i16",
+                attr::ReprInt(_, attr::SignedInt(ast::IntTy::I32)) => "i32",
+                attr::ReprInt(_, attr::SignedInt(ast::IntTy::I64)) => "i64",
+
+                attr::ReprInt(_, attr::UnsignedInt(ast::UintTy::Us)) => "usize",
+                attr::ReprInt(_, attr::UnsignedInt(ast::UintTy::U8)) => "u8",
+                attr::ReprInt(_, attr::UnsignedInt(ast::UintTy::U16)) => "u16",
+                attr::ReprInt(_, attr::UnsignedInt(ast::UintTy::U32)) => "u32",
+                attr::ReprInt(_, attr::UnsignedInt(ast::UintTy::U64)) => "u64",
             }
         }
     }
@@ -823,7 +821,7 @@ impl<'a> MethodDef<'a> {
 
                 explicit_self
             }
-            None => codemap::respan(trait_.span, ast::SelfStatic),
+            None => codemap::respan(trait_.span, ast::SelfKind::Static),
         };
 
         for (i, ty) in self.args.iter().enumerate() {
@@ -864,9 +862,11 @@ impl<'a> MethodDef<'a> {
         let fn_generics = self.generics.to_generics(cx, trait_.span, type_ident, generics);
 
         let self_arg = match explicit_self.node {
-            ast::SelfStatic => None,
+            ast::SelfKind::Static => None,
             // creating fresh self id
-            _ => Some(ast::Arg::new_self(trait_.span, ast::MutImmutable, special_idents::self_))
+            _ => Some(ast::Arg::new_self(trait_.span,
+                                         ast::Mutability::Immutable,
+                                         special_idents::self_))
         };
         let args = {
             let args = arg_types.into_iter().map(|(name, ty)| {
@@ -892,7 +892,7 @@ impl<'a> MethodDef<'a> {
             id: ast::DUMMY_NODE_ID,
             attrs: self.attributes.clone(),
             span: trait_.span,
-            vis: ast::Inherited,
+            vis: ast::Visibility::Inherited,
             ident: method_ident,
             node: ast::ImplItemKind::Method(ast::MethodSig {
                 generics: fn_generics,
@@ -944,7 +944,7 @@ impl<'a> MethodDef<'a> {
                                              struct_def,
                                              &format!("__self_{}",
                                                      i),
-                                             ast::MutImmutable);
+                                             ast::Mutability::Immutable);
             patterns.push(pat);
             raw_fields.push(ident_expr);
         }
@@ -1137,11 +1137,12 @@ impl<'a> MethodDef<'a> {
         let mut match_arms: Vec<ast::Arm> = variants.iter().enumerate()
             .map(|(index, variant)| {
                 let mk_self_pat = |cx: &mut ExtCtxt, self_arg_name: &str| {
-                    let (p, idents) = trait_.create_enum_variant_pattern(cx, type_ident,
-                                                                         &**variant,
-                                                                         self_arg_name,
-                                                                         ast::MutImmutable);
-                    (cx.pat(sp, ast::PatRegion(p, ast::MutImmutable)), idents)
+                    let (p, idents) = trait_.create_enum_variant_pattern(
+                        cx, type_ident,
+                        &**variant,
+                        self_arg_name,
+                        ast::Mutability::Immutable);
+                    (cx.pat(sp, ast::PatRegion(p, ast::Mutability::Immutable)), idents)
                 };
 
                 // A single arm has form (&VariantK, &VariantK, ...) => BodyK
@@ -1267,7 +1268,7 @@ impl<'a> MethodDef<'a> {
                     stmts: vec![],
                     expr: Some(call),
                     id: ast::DUMMY_NODE_ID,
-                    rules: ast::UnsafeBlock(ast::CompilerGenerated),
+                    rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
                     span: sp }));
 
                 let target_ty = cx.ty_ident(sp, cx.ident_of(target_type_name));
@@ -1279,8 +1280,9 @@ impl<'a> MethodDef<'a> {
                     Some(first) => {
                         let first_expr = cx.expr_ident(sp, first);
                         let id = cx.expr_ident(sp, ident);
-                        let test = cx.expr_binary(sp, ast::BiEq, first_expr, id);
-                        discriminant_test = cx.expr_binary(sp, ast::BiAnd, discriminant_test, test)
+                        let test = cx.expr_binary(sp, BinOpKind::Eq, first_expr, id);
+                        discriminant_test = cx.expr_binary(sp, BinOpKind::And,
+                                                           discriminant_test, test)
                     }
                     None => {
                         first_ident = Some(ident);
@@ -1302,7 +1304,7 @@ impl<'a> MethodDef<'a> {
                 stmts: vec![],
                 expr: Some(call),
                 id: ast::DUMMY_NODE_ID,
-                rules: ast::UnsafeBlock(ast::CompilerGenerated),
+                rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
                 span: sp }));
             match_arms.push(cx.arm(sp, vec![cx.pat_wild(sp)], unreachable));
 
@@ -1312,7 +1314,7 @@ impl<'a> MethodDef<'a> {
             // expression; here add a layer of borrowing, turning
             // `(*self, *__arg_0, ...)` into `(&*self, &*__arg_0, ...)`.
             let borrowed_self_args = self_args.move_map(|self_arg| cx.expr_addr_of(sp, self_arg));
-            let match_arg = cx.expr(sp, ast::ExprTup(borrowed_self_args));
+            let match_arg = cx.expr(sp, ast::ExprKind::Tup(borrowed_self_args));
 
             //Lastly we create an expression which branches on all discriminants being equal
             //  if discriminant_test {
@@ -1390,7 +1392,7 @@ impl<'a> MethodDef<'a> {
             // expression; here add a layer of borrowing, turning
             // `(*self, *__arg_0, ...)` into `(&*self, &*__arg_0, ...)`.
             let borrowed_self_args = self_args.move_map(|self_arg| cx.expr_addr_of(sp, self_arg));
-            let match_arg = cx.expr(sp, ast::ExprTup(borrowed_self_args));
+            let match_arg = cx.expr(sp, ast::ExprKind::Tup(borrowed_self_args));
             cx.expr_match(sp, match_arg, match_arms)
         }
     }
@@ -1510,8 +1512,8 @@ impl<'a> TraitDef<'a> {
             };
             let ident = cx.ident_of(&format!("{}_{}", prefix, i));
             paths.push(codemap::Spanned{span: sp, node: ident});
-            let val = cx.expr(
-                sp, ast::ExprParen(cx.expr_deref(sp, cx.expr_path(cx.path_ident(sp,ident)))));
+            let val = cx.expr_deref(sp, cx.expr_path(cx.path_ident(sp,ident)));
+            let val = cx.expr(sp, ast::ExprKind::Paren(val));
             ident_expr.push((sp, opt_id, val, &struct_field.node.attrs[..]));
         }
 
diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/libsyntax_ext/deriving/generic/ty.rs
index 10564b5f698..a924cc06953 100644
--- a/src/libsyntax_ext/deriving/generic/ty.rs
+++ b/src/libsyntax_ext/deriving/generic/ty.rs
@@ -98,7 +98,7 @@ pub enum Ty<'a> {
 }
 
 pub fn borrowed_ptrty<'r>() -> PtrTy<'r> {
-    Borrowed(None, ast::MutImmutable)
+    Borrowed(None, ast::Mutability::Immutable)
 }
 pub fn borrowed<'r>(ty: Box<Ty<'r>>) -> Ty<'r> {
     Ptr(ty, borrowed_ptrty())
@@ -153,7 +153,7 @@ impl<'a> Ty<'a> {
                 cx.ty_path(self.to_path(cx, span, self_ty, self_generics))
             }
             Tuple(ref fields) => {
-                let ty = ast::TyTup(fields.iter()
+                let ty = ast::TyKind::Tup(fields.iter()
                     .map(|f| f.to_ty(cx, span, self_ty, self_generics))
                     .collect());
                 cx.ty(span, ty)
@@ -264,7 +264,7 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
     let self_path = cx.expr_self(span);
     match *self_ptr {
         None => {
-            (self_path, respan(span, ast::SelfValue(special_idents::self_)))
+            (self_path, respan(span, ast::SelfKind::Value(special_idents::self_)))
         }
         Some(ref ptr) => {
             let self_ty = respan(
@@ -272,7 +272,7 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
                 match *ptr {
                     Borrowed(ref lt, mutbl) => {
                         let lt = lt.map(|s| cx.lifetime(span, cx.ident_of(s).name));
-                        ast::SelfRegion(lt, mutbl, special_idents::self_)
+                        ast::SelfKind::Region(lt, mutbl, special_idents::self_)
                     }
                     Raw(_) => cx.span_bug(span, "attempted to use *self in deriving definition")
                 });
diff --git a/src/libsyntax_ext/deriving/hash.rs b/src/libsyntax_ext/deriving/hash.rs
index 6bd21f7c0e0..371ba732b48 100644
--- a/src/libsyntax_ext/deriving/hash.rs
+++ b/src/libsyntax_ext/deriving/hash.rs
@@ -11,7 +11,7 @@
 use deriving::generic::*;
 use deriving::generic::ty::*;
 
-use syntax::ast::{MetaItem, Expr, MutMutable};
+use syntax::ast::{MetaItem, Expr, Mutability};
 use syntax::codemap::Span;
 use syntax::ext::base::{ExtCtxt, Annotatable};
 use syntax::ext::build::AstBuilder;
@@ -43,7 +43,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
                                   vec![path_std!(cx, core::hash::Hasher)])],
                 },
                 explicit_self: borrowed_explicit_self(),
-                args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, MutMutable))),
+                args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, Mutability::Mutable))),
                 ret_ty: nil_ty(),
                 attributes: vec![],
                 is_unsafe: false,
diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs
index dcaa9644603..4e2142f1fb4 100644
--- a/src/libsyntax_ext/deriving/mod.rs
+++ b/src/libsyntax_ext/deriving/mod.rs
@@ -13,7 +13,7 @@
 //! FIXME (#2810): hygiene. Search for "__" strings (in other files too). We also assume "extra" is
 //! the standard library, and "std" is the core library.
 
-use syntax::ast::{MetaItem, MetaWord};
+use syntax::ast::{MetaItem, MetaItemKind};
 use syntax::attr::AttrMetaMethods;
 use syntax::ext::base::{ExtCtxt, SyntaxEnv, Annotatable};
 use syntax::ext::base::{MultiDecorator, MultiItemDecorator, MultiModifier};
@@ -94,7 +94,7 @@ fn expand_derive(cx: &mut ExtCtxt,
 
             for titem in traits.iter().rev() {
                 let tname = match titem.node {
-                    MetaWord(ref tname) => tname,
+                    MetaItemKind::Word(ref tname) => tname,
                     _ => {
                         cx.span_err(titem.span, "malformed `derive` entry");
                         continue;