about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-07-22 08:19:32 -0700
committerbors <bors@rust-lang.org>2013-07-22 08:19:32 -0700
commit52b7fc14fe4444f0de91a474c70cbf248f96b763 (patch)
tree3eb8238a1e8ab4f9999d1185077e2bec74707ed5 /src/libsyntax
parent7a3eaf8f27bd626a9667a574bc62464a815a6ad4 (diff)
parent5aee3e01a02e0b31ad225e70899a671937ab65ee (diff)
downloadrust-52b7fc14fe4444f0de91a474c70cbf248f96b763.tar.gz
rust-52b7fc14fe4444f0de91a474c70cbf248f96b763.zip
auto merge of #7903 : michaelwoerister/rust/end_of_spanned, r=jdm
Continuation of https://github.com/mozilla/rust/pull/7826.

AST spanned<T> refactoring, AST type renamings:

`crate => Crate`
`local => Local`
`blk => Block`
`crate_num => CrateNum`
`crate_cfg => CrateConfig`
`field => Field`

Also, Crate, Field and Local are not wrapped in spanned<T> anymore.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs49
-rw-r--r--src/libsyntax/ast_map.rs8
-rw-r--r--src/libsyntax/ast_util.rs10
-rw-r--r--src/libsyntax/ext/base.rs6
-rw-r--r--src/libsyntax/ext/build.rs72
-rw-r--r--src/libsyntax/ext/expand.rs12
-rw-r--r--src/libsyntax/ext/quote.rs4
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs4
-rw-r--r--src/libsyntax/fold.rs56
-rw-r--r--src/libsyntax/parse/classify.rs2
-rw-r--r--src/libsyntax/parse/mod.rs36
-rw-r--r--src/libsyntax/parse/parser.rs69
-rw-r--r--src/libsyntax/parse/token.rs2
-rw-r--r--src/libsyntax/print/pprust.rs48
-rw-r--r--src/libsyntax/util/parser_testing.rs2
-rw-r--r--src/libsyntax/visit.rs38
16 files changed, 206 insertions, 212 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index f2974423a1a..95691c334b1 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -113,17 +113,17 @@ pub struct Path {
     types: ~[Ty],
 }
 
-pub type crate_num = int;
+pub type CrateNum = int;
 
 pub type node_id = int;
 
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
 pub struct def_id {
-    crate: crate_num,
+    crate: CrateNum,
     node: node_id,
 }
 
-pub static local_crate: crate_num = 0;
+pub static local_crate: CrateNum = 0;
 pub static crate_node_id: node_id = 0;
 
 // The AST represents all type param bounds as types.
@@ -195,15 +195,14 @@ pub enum def {
 
 // The set of MetaItems that define the compilation environment of the crate,
 // used to drive conditional compilation
-pub type crate_cfg = ~[@MetaItem];
-
-pub type crate = spanned<crate_>;
+pub type CrateConfig = ~[@MetaItem];
 
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
-pub struct crate_ {
+pub struct Crate {
     module: _mod,
     attrs: ~[Attribute],
-    config: crate_cfg,
+    config: CrateConfig,
+    span: span,
 }
 
 pub type MetaItem = spanned<MetaItem_>;
@@ -240,10 +239,8 @@ impl Eq for MetaItem_ {
     }
 }
 
-//pub type blk = spanned<blk_>;
-
 #[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
-pub struct blk {
+pub struct Block {
     view_items: ~[view_item],
     stmts: ~[@stmt],
     expr: Option<@expr>,
@@ -385,22 +382,21 @@ pub enum stmt_ {
 // FIXME (pending discussion of #1697, #2178...): local should really be
 // a refinement on pat.
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
-pub struct local_ {
+pub struct Local {
     is_mutbl: bool,
     ty: Ty,
     pat: @pat,
     init: Option<@expr>,
     id: node_id,
+    span: span,
 }
 
-pub type local = spanned<local_>;
-
 pub type decl = spanned<decl_>;
 
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub enum decl_ {
     // a local (let) binding:
-    decl_local(@local),
+    decl_local(@Local),
     // an item binding:
     decl_item(@item),
 }
@@ -409,17 +405,16 @@ pub enum decl_ {
 pub struct arm {
     pats: ~[@pat],
     guard: Option<@expr>,
-    body: blk,
+    body: Block,
 }
 
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
-pub struct field_ {
+pub struct Field {
     ident: ident,
     expr: @expr,
+    span: span,
 }
 
-pub type field = spanned<field_>;
-
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
 pub enum blk_check_mode {
     default_blk,
@@ -464,21 +459,21 @@ pub enum expr_ {
     expr_unary(node_id, unop, @expr),
     expr_lit(@lit),
     expr_cast(@expr, Ty),
-    expr_if(@expr, blk, Option<@expr>),
-    expr_while(@expr, blk),
+    expr_if(@expr, Block, Option<@expr>),
+    expr_while(@expr, Block),
     /* Conditionless loop (can be exited with break, cont, or ret)
        Same semantics as while(true) { body }, but typestate knows that the
        (implicit) condition is always true. */
-    expr_loop(blk, Option<ident>),
+    expr_loop(Block, Option<ident>),
     expr_match(@expr, ~[arm]),
-    expr_fn_block(fn_decl, blk),
+    expr_fn_block(fn_decl, Block),
     // Inner expr is always an expr_fn_block. We need the wrapping node to
     // easily type this (a function returning nil on the inside but bool on
     // the outside).
     expr_loop_body(@expr),
     // Like expr_loop_body but for 'do' blocks
     expr_do_body(@expr),
-    expr_block(blk),
+    expr_block(Block),
 
     expr_assign(@expr, @expr),
     expr_assign_op(node_id, binop, @expr, @expr),
@@ -499,7 +494,7 @@ pub enum expr_ {
     expr_mac(mac),
 
     // A struct literal expression.
-    expr_struct(Path, ~[field], Option<@expr>),
+    expr_struct(Path, ~[Field], Option<@expr>),
 
     // A vector literal constructed from one repeated element.
     expr_repeat(@expr /* element */, @expr /* count */, mutability),
@@ -863,7 +858,7 @@ pub struct method {
     explicit_self: explicit_self,
     purity: purity,
     decl: fn_decl,
-    body: blk,
+    body: Block,
     id: node_id,
     span: span,
     self_id: node_id,
@@ -1051,7 +1046,7 @@ pub struct item {
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
 pub enum item_ {
     item_static(Ty, mutability, @expr),
-    item_fn(fn_decl, purity, AbiSet, Generics, blk),
+    item_fn(fn_decl, purity, AbiSet, Generics, Block),
     item_mod(_mod),
     item_foreign_mod(foreign_mod),
     item_ty(Ty, Generics),
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index aef201a0232..2981336466e 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -73,7 +73,7 @@ pub enum ast_node {
     node_stmt(@stmt),
     node_arg,
     node_local(ident),
-    node_block(blk),
+    node_block(Block),
     node_struct_ctor(@struct_def, @item, @path),
     node_callee_scope(@expr)
 }
@@ -104,7 +104,7 @@ pub fn mk_ast_map_visitor() -> vt {
     });
 }
 
-pub fn map_crate(diag: @span_handler, c: &crate) -> map {
+pub fn map_crate(diag: @span_handler, c: &Crate) -> map {
     let cx = @mut Ctx {
         map: @mut HashMap::new(),
         path: ~[],
@@ -157,7 +157,7 @@ pub fn map_decoded_item(diag: @span_handler,
 pub fn map_fn(
     fk: &visit::fn_kind,
     decl: &fn_decl,
-    body: &blk,
+    body: &Block,
     sp: codemap::span,
     id: node_id,
     (cx,v): (@mut Ctx,
@@ -169,7 +169,7 @@ pub fn map_fn(
     visit::visit_fn(fk, decl, body, sp, id, (cx, v));
 }
 
-pub fn map_block(b: &blk, (cx,v): (@mut Ctx, visit::vt<@mut Ctx>)) {
+pub fn map_block(b: &Block, (cx,v): (@mut Ctx, visit::vt<@mut Ctx>)) {
     cx.map.insert(b.id, node_block(/* FIXME (#2543) */ (*b).clone()));
     visit::visit_block(b, (cx, v));
 }
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 15ac50b917c..37112a533c8 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -195,7 +195,7 @@ pub fn is_call_expr(e: @expr) -> bool {
     match e.node { expr_call(*) => true, _ => false }
 }
 
-pub fn block_from_expr(e: @expr) -> blk {
+pub fn block_from_expr(e: @expr) -> Block {
     let mut blk = default_block(~[], option::Some::<@expr>(e), e.id);
     blk.span = e.span;
     return blk;
@@ -205,8 +205,8 @@ pub fn default_block(
     stmts1: ~[@stmt],
     expr1: Option<@expr>,
     id1: node_id
-) -> blk {
-    ast::blk {
+) -> Block {
+    ast::Block {
         view_items: ~[],
         stmts: stmts1,
         expr: expr1,
@@ -443,7 +443,7 @@ pub fn id_visitor<T: Clone>(vfn: @fn(node_id, T)) -> visit::vt<T> {
         },
 
         visit_local: |l, (t, vt)| {
-            vfn(l.node.id, t.clone());
+            vfn(l.id, t.clone());
             visit::visit_local(l, (t, vt));
         },
         visit_block: |b, (t, vt)| {
@@ -570,7 +570,7 @@ pub trait EachViewItem {
     pub fn each_view_item(&self, f: @fn(&ast::view_item) -> bool) -> bool;
 }
 
-impl EachViewItem for ast::crate {
+impl EachViewItem for ast::Crate {
     fn each_view_item(&self, f: @fn(&ast::view_item) -> bool) -> bool {
         let broke = @mut false;
         let vtor: visit::vt<()> = visit::mk_simple_visitor(@visit::SimpleVisitor {
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 753d32fee5a..e831e32f23d 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -212,7 +212,7 @@ pub fn syntax_expander_table() -> SyntaxEnv {
 // -> expn_info of their expansion context stored into their span.
 pub struct ExtCtxt {
     parse_sess: @mut parse::ParseSess,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     backtrace: @mut Option<@ExpnInfo>,
 
     // These two @mut's should really not be here,
@@ -225,7 +225,7 @@ pub struct ExtCtxt {
 }
 
 impl ExtCtxt {
-    pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg)
+    pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::CrateConfig)
                -> @ExtCtxt {
         @ExtCtxt {
             parse_sess: parse_sess,
@@ -238,7 +238,7 @@ impl ExtCtxt {
 
     pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
     pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
-    pub fn cfg(&self) -> ast::crate_cfg { self.cfg.clone() }
+    pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() }
     pub fn call_site(&self) -> span {
         match *self.backtrace {
             Some(@ExpnInfo {call_site: cs, _}) => cs,
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index df5f3d8d895..b3d65dfa9e2 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -76,12 +76,12 @@ pub trait AstBuilder {
     fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt;
 
     // blocks
-    fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::blk;
-    fn blk_expr(&self, expr: @ast::expr) -> ast::blk;
+    fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block;
+    fn blk_expr(&self, expr: @ast::expr) -> ast::Block;
     fn blk_all(&self, span: span,
                view_items: ~[ast::view_item],
                stmts: ~[@ast::stmt],
-               expr: Option<@ast::expr>) -> ast::blk;
+               expr: Option<@ast::expr>) -> ast::Block;
 
     // expressions
     fn expr(&self, span: span, node: ast::expr_) -> @ast::expr;
@@ -105,11 +105,11 @@ pub trait AstBuilder {
     fn expr_method_call(&self, span: span,
                         expr: @ast::expr, ident: ast::ident,
                         args: ~[@ast::expr]) -> @ast::expr;
-    fn expr_blk(&self, b: ast::blk) -> @ast::expr;
+    fn expr_blk(&self, b: ast::Block) -> @ast::expr;
 
-    fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::field;
-    fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::field]) -> @ast::expr;
-    fn expr_struct_ident(&self, span: span, id: ast::ident, fields: ~[ast::field]) -> @ast::expr;
+    fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field;
+    fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr;
+    fn expr_struct_ident(&self, span: span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr;
 
     fn expr_lit(&self, sp: span, lit: ast::lit_) -> @ast::expr;
 
@@ -147,11 +147,11 @@ pub trait AstBuilder {
     fn expr_if(&self, span: span,
                cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr;
 
-    fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::blk) -> @ast::expr;
+    fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr;
 
-    fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::blk) -> @ast::expr;
-    fn lambda0(&self, span: span, blk: ast::blk) -> @ast::expr;
-    fn lambda1(&self, span: span, blk: ast::blk, ident: ast::ident) -> @ast::expr;
+    fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr;
+    fn lambda0(&self, span: span, blk: ast::Block) -> @ast::expr;
+    fn lambda1(&self, span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr;
 
     fn lambda_expr(&self, span: span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr;
     fn lambda_expr_0(&self, span: span, expr: @ast::expr) -> @ast::expr;
@@ -175,13 +175,13 @@ pub trait AstBuilder {
                     inputs: ~[ast::arg],
                     output: ast::Ty,
                     generics: Generics,
-                    body: ast::blk) -> @ast::item;
+                    body: ast::Block) -> @ast::item;
     fn item_fn(&self,
                span: span,
                name: ident,
                inputs: ~[ast::arg],
                output: ast::Ty,
-               body: ast::blk) -> @ast::item;
+               body: ast::Block) -> @ast::item;
 
     fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant;
     fn item_enum_poly(&self,
@@ -375,31 +375,31 @@ impl AstBuilder for @ExtCtxt {
 
     fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
         let pat = self.pat_ident(sp, ident);
-        let local = @respan(sp,
-                            ast::local_ {
-                                is_mutbl: mutbl,
-                                ty: self.ty_infer(sp),
-                                pat: pat,
-                                init: Some(ex),
-                                id: self.next_id(),
-                            });
+        let local = @ast::Local {
+            is_mutbl: mutbl,
+            ty: self.ty_infer(sp),
+            pat: pat,
+            init: Some(ex),
+            id: self.next_id(),
+            span: sp,
+        };
         let decl = respan(sp, ast::decl_local(local));
         @respan(sp, ast::stmt_decl(@decl, self.next_id()))
     }
 
-    fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::blk {
+    fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::Block {
         self.blk_all(span, ~[], stmts, expr)
     }
 
-    fn blk_expr(&self, expr: @ast::expr) -> ast::blk {
+    fn blk_expr(&self, expr: @ast::expr) -> ast::Block {
         self.blk_all(expr.span, ~[], ~[], Some(expr))
     }
     fn blk_all(&self,
                span: span,
                view_items: ~[ast::view_item],
                stmts: ~[@ast::stmt],
-               expr: Option<@ast::expr>) -> ast::blk {
-           ast::blk {
+               expr: Option<@ast::expr>) -> ast::Block {
+           ast::Block {
                view_items: view_items,
                stmts: stmts,
                expr: expr,
@@ -474,17 +474,17 @@ impl AstBuilder for @ExtCtxt {
         self.expr(span,
                   ast::expr_method_call(self.next_id(), expr, ident, ~[], args, ast::NoSugar))
     }
-    fn expr_blk(&self, b: ast::blk) -> @ast::expr {
+    fn expr_blk(&self, b: ast::Block) -> @ast::expr {
         self.expr(b.span, ast::expr_block(b))
     }
-    fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::field {
-        respan(span, ast::field_ { ident: name, expr: e })
+    fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field {
+        ast::Field { ident: name, expr: e, span: span }
     }
-    fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::field]) -> @ast::expr {
+    fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr {
         self.expr(span, ast::expr_struct(path, fields, None))
     }
     fn expr_struct_ident(&self, span: span,
-                         id: ast::ident, fields: ~[ast::field]) -> @ast::expr {
+                         id: ast::ident, fields: ~[ast::Field]) -> @ast::expr {
         self.expr_struct(span, self.path_ident(span, id), fields)
     }
 
@@ -595,23 +595,23 @@ impl AstBuilder for @ExtCtxt {
         self.expr(span, ast::expr_if(cond, self.blk_expr(then), els))
     }
 
-    fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::blk) -> @ast::expr {
+    fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr {
         self.expr(span, ast::expr_fn_block(fn_decl, blk))
     }
-    fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::blk) -> @ast::expr {
+    fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr {
         let fn_decl = self.fn_decl(
             ids.map(|id| self.arg(span, *id, self.ty_infer(span))),
             self.ty_infer(span));
 
         self.expr(span, ast::expr_fn_block(fn_decl, blk))
     }
-    fn lambda0(&self, _span: span, blk: ast::blk) -> @ast::expr {
+    fn lambda0(&self, _span: span, blk: ast::Block) -> @ast::expr {
         let ext_cx = *self;
         let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
         quote_expr!(|| $blk_e )
     }
 
-    fn lambda1(&self, _span: span, blk: ast::blk, ident: ast::ident) -> @ast::expr {
+    fn lambda1(&self, _span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr {
         let ext_cx = *self;
         let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
         quote_expr!(|$ident| $blk_e )
@@ -674,7 +674,7 @@ impl AstBuilder for @ExtCtxt {
                     inputs: ~[ast::arg],
                     output: ast::Ty,
                     generics: Generics,
-                    body: ast::blk) -> @ast::item {
+                    body: ast::Block) -> @ast::item {
         self.item(span,
                   name,
                   ~[],
@@ -690,7 +690,7 @@ impl AstBuilder for @ExtCtxt {
                name: ident,
                inputs: ~[ast::arg],
                output: ast::Ty,
-               body: ast::blk
+               body: ast::Block
               ) -> @ast::item {
         self.item_fn_poly(
             span,
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index e78254f11f5..af05f726860 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::{blk, crate, expr_, expr_mac, mac_invoc_tt};
+use ast::{Block, Crate, expr_, expr_mac, mac_invoc_tt};
 use ast::{item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi};
 use ast::{illegal_ctxt};
 use ast;
@@ -395,10 +395,10 @@ pub fn new_name_finder() -> @Visitor<@mut ~[ast::ident]> {
 
 pub fn expand_block(extsbox: @mut SyntaxEnv,
                     _cx: @ExtCtxt,
-                    blk: &blk,
+                    blk: &Block,
                     fld: @ast_fold,
-                    orig: @fn(&blk, @ast_fold) -> blk)
-                 -> blk {
+                    orig: @fn(&Block, @ast_fold) -> Block)
+                 -> Block {
     // see note below about treatment of exts table
     with_exts_frame!(extsbox,false,orig(blk,fld))
 }
@@ -691,7 +691,7 @@ pub fn std_macros() -> @str {
 // add a bunch of macros as though they were placed at the head of the
 // program (ick). This should run before cfg stripping.
 pub fn inject_std_macros(parse_sess: @mut parse::ParseSess,
-                         cfg: ast::crate_cfg, c: &crate) -> @crate {
+                         cfg: ast::CrateConfig, c: &Crate) -> @Crate {
     let sm = match parse_item_from_source_str(@"<std-macros>",
                                               std_macros(),
                                               cfg.clone(),
@@ -718,7 +718,7 @@ pub fn inject_std_macros(parse_sess: @mut parse::ParseSess,
 }
 
 pub fn expand_crate(parse_sess: @mut parse::ParseSess,
-                    cfg: ast::crate_cfg, c: &crate) -> @crate {
+                    cfg: ast::CrateConfig, c: &Crate) -> @Crate {
     // adding *another* layer of indirection here so that the block
     // visitor can swap out one exts table for another for the duration
     // of the block.  The cleaner alternative would be to thread the
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index d8ac2ede29e..1439f4cabab 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -110,7 +110,7 @@ pub mod rt {
         }
     }
 
-    impl ToSource for ast::blk {
+    impl ToSource for ast::Block {
         fn to_source(&self) -> @str {
             pprust::block_to_str(self, get_ident_interner()).to_managed()
         }
@@ -238,7 +238,7 @@ pub mod rt {
         }
     }
 
-    impl ToTokens for ast::blk {
+    impl ToTokens for ast::Block {
         fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source())
         }
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 54ccd489171..9d9155ff0d5 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -223,7 +223,7 @@ pub enum parse_result {
 
 pub fn parse_or_else(
     sess: @mut ParseSess,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     rdr: @reader,
     ms: ~[matcher]
 ) -> HashMap<ident, @named_match> {
@@ -236,7 +236,7 @@ pub fn parse_or_else(
 
 pub fn parse(
     sess: @mut ParseSess,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     rdr: @reader,
     ms: &[matcher]
 ) -> parse_result {
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 63cb3cf38f6..f27e68641e3 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -15,14 +15,14 @@ use parse::token;
 use opt_vec::OptVec;
 
 pub trait ast_fold {
-    fn fold_crate(@self, &crate) -> crate;
+    fn fold_crate(@self, &Crate) -> Crate;
     fn fold_view_item(@self, &view_item) -> view_item;
     fn fold_foreign_item(@self, @foreign_item) -> @foreign_item;
     fn fold_item(@self, @item) -> Option<@item>;
     fn fold_struct_field(@self, @struct_field) -> @struct_field;
     fn fold_item_underscore(@self, &item_) -> item_;
     fn fold_method(@self, @method) -> @method;
-    fn fold_block(@self, &blk) -> blk;
+    fn fold_block(@self, &Block) -> Block;
     fn fold_stmt(@self, &stmt) -> Option<@stmt>;
     fn fold_arm(@self, &arm) -> arm;
     fn fold_pat(@self, @pat) -> @pat;
@@ -34,7 +34,7 @@ pub trait ast_fold {
     fn fold_variant(@self, &variant) -> variant;
     fn fold_ident(@self, ident) -> ident;
     fn fold_path(@self, &Path) -> Path;
-    fn fold_local(@self, @local) -> @local;
+    fn fold_local(@self, @Local) -> @Local;
     fn map_exprs(@self, @fn(@expr) -> @expr, &[@expr]) -> ~[@expr];
     fn new_id(@self, node_id) -> node_id;
     fn new_span(@self, span) -> span;
@@ -44,14 +44,14 @@ pub trait ast_fold {
 
 pub struct AstFoldFns {
     //unlike the others, item_ is non-trivial
-    fold_crate: @fn(&crate_, span, @ast_fold) -> (crate_, span),
+    fold_crate: @fn(&Crate, @ast_fold) -> Crate,
     fold_view_item: @fn(&view_item_, @ast_fold) -> view_item_,
     fold_foreign_item: @fn(@foreign_item, @ast_fold) -> @foreign_item,
     fold_item: @fn(@item, @ast_fold) -> Option<@item>,
     fold_struct_field: @fn(@struct_field, @ast_fold) -> @struct_field,
     fold_item_underscore: @fn(&item_, @ast_fold) -> item_,
     fold_method: @fn(@method, @ast_fold) -> @method,
-    fold_block: @fn(&blk, @ast_fold) -> blk,
+    fold_block: @fn(&Block, @ast_fold) -> Block,
     fold_stmt: @fn(&stmt_, span, @ast_fold) -> (Option<stmt_>, span),
     fold_arm: @fn(&arm, @ast_fold) -> arm,
     fold_pat: @fn(&pat_, span, @ast_fold) -> (pat_, span),
@@ -63,7 +63,7 @@ pub struct AstFoldFns {
     fold_variant: @fn(&variant_, span, @ast_fold) -> (variant_, span),
     fold_ident: @fn(ident, @ast_fold) -> ident,
     fold_path: @fn(&Path, @ast_fold) -> Path,
-    fold_local: @fn(&local_, span, @ast_fold) -> (local_, span),
+    fold_local: @fn(@Local, @ast_fold) -> @Local,
     map_exprs: @fn(@fn(@expr) -> @expr, &[@expr]) -> ~[@expr],
     new_id: @fn(node_id) -> node_id,
     new_span: @fn(span) -> span
@@ -196,14 +196,15 @@ pub fn fold_generics(generics: &Generics, fld: @ast_fold) -> Generics {
               lifetimes: fold_lifetimes(&generics.lifetimes, fld)}
 }
 
-pub fn noop_fold_crate(c: &crate_, fld: @ast_fold) -> crate_ {
+pub fn noop_fold_crate(c: &Crate, fld: @ast_fold) -> Crate {
     let fold_meta_item = |x| fold_meta_item_(x, fld);
     let fold_attribute = |x| fold_attribute_(x, fld);
 
-    crate_ {
+    Crate {
         module: fld.fold_mod(&c.module),
         attrs: c.attrs.map(|x| fold_attribute(*x)),
         config: c.config.map(|x| fold_meta_item(*x)),
+        span: fld.new_span(c.span),
     }
 }
 
@@ -376,7 +377,7 @@ fn noop_fold_method(m: @method, fld: @ast_fold) -> @method {
 }
 
 
-pub fn noop_fold_block(b: &blk, fld: @ast_fold) -> blk {
+pub fn noop_fold_block(b: &Block, fld: @ast_fold) -> Block {
     let view_items = b.view_items.map(|x| fld.fold_view_item(x));
     let mut stmts = ~[];
     for b.stmts.iter().advance |stmt| {
@@ -385,7 +386,7 @@ pub fn noop_fold_block(b: &blk, fld: @ast_fold) -> blk {
             Some(stmt) => stmts.push(stmt)
         }
     }
-    ast::blk {
+    ast::Block {
         view_items: view_items,
         stmts: stmts,
         expr: b.expr.map(|x| fld.fold_expr(*x)),
@@ -487,12 +488,10 @@ pub fn wrap<T>(f: @fn(&T, @ast_fold) -> T)
 }
 
 pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
-    fn fold_field_(field: field, fld: @ast_fold) -> field {
-        spanned {
-            node: ast::field_ {
-                ident: fld.fold_ident(field.node.ident),
-                expr: fld.fold_expr(field.node.expr),
-            },
+    fn fold_field_(field: Field, fld: @ast_fold) -> Field {
+        ast::Field {
+            ident: fld.fold_ident(field.ident),
+            expr: fld.fold_expr(field.expr),
             span: fld.new_span(field.span),
         }
     }
@@ -771,13 +770,14 @@ fn noop_fold_path(p: &Path, fld: @ast_fold) -> Path {
     }
 }
 
-fn noop_fold_local(l: &local_, fld: @ast_fold) -> local_ {
-    local_ {
+fn noop_fold_local(l: @Local, fld: @ast_fold) -> @Local {
+    @Local {
         is_mutbl: l.is_mutbl,
         ty: fld.fold_ty(&l.ty),
         pat: fld.fold_pat(l.pat),
         init: l.init.map(|e| fld.fold_expr(*e)),
         id: fld.new_id(l.id),
+        span: fld.new_span(l.span),
     }
 }
 
@@ -793,7 +793,7 @@ fn noop_span(sp: span) -> span { return sp; }
 
 pub fn default_ast_fold() -> ast_fold_fns {
     @AstFoldFns {
-        fold_crate: wrap(noop_fold_crate),
+        fold_crate: noop_fold_crate,
         fold_view_item: noop_fold_view_item,
         fold_foreign_item: noop_fold_foreign_item,
         fold_item: noop_fold_item,
@@ -812,7 +812,7 @@ pub fn default_ast_fold() -> ast_fold_fns {
         fold_variant: wrap(noop_fold_variant),
         fold_ident: noop_fold_ident,
         fold_path: noop_fold_path,
-        fold_local: wrap(noop_fold_local),
+        fold_local: noop_fold_local,
         map_exprs: noop_map_exprs,
         new_id: noop_id,
         new_span: noop_span,
@@ -821,9 +821,8 @@ pub fn default_ast_fold() -> ast_fold_fns {
 
 impl ast_fold for AstFoldFns {
     /* naturally, a macro to write these would be nice */
-    fn fold_crate(@self, c: &crate) -> crate {
-        let (n, s) = (self.fold_crate)(&c.node, c.span, self as @ast_fold);
-        spanned { node: n, span: (self.new_span)(s) }
+    fn fold_crate(@self, c: &Crate) -> Crate {
+        (self.fold_crate)(c, self as @ast_fold)
     }
     fn fold_view_item(@self, x: &view_item) -> view_item {
         ast::view_item {
@@ -856,7 +855,7 @@ impl ast_fold for AstFoldFns {
     fn fold_method(@self, x: @method) -> @method {
         (self.fold_method)(x, self as @ast_fold)
     }
-    fn fold_block(@self, x: &blk) -> blk {
+    fn fold_block(@self, x: &Block) -> Block {
         (self.fold_block)(x, self as @ast_fold)
     }
     fn fold_stmt(@self, x: &stmt) -> Option<@stmt> {
@@ -916,9 +915,8 @@ impl ast_fold for AstFoldFns {
     fn fold_path(@self, x: &Path) -> Path {
         (self.fold_path)(x, self as @ast_fold)
     }
-    fn fold_local(@self, x: @local) -> @local {
-        let (n, s) = (self.fold_local)(&x.node, x.span, self as @ast_fold);
-        @spanned { node: n, span: (self.new_span)(s) }
+    fn fold_local(@self, x: @Local) -> @Local {
+        (self.fold_local)(x, self as @ast_fold)
     }
     fn map_exprs(@self,
                  f: @fn(@expr) -> @expr,
@@ -969,8 +967,8 @@ mod test {
     }
 
     // this version doesn't care about getting comments or docstrings in.
-    fn fake_print_crate(s: @pprust::ps, crate: &ast::crate) {
-        pprust::print_mod(s, &crate.node.module, crate.node.attrs);
+    fn fake_print_crate(s: @pprust::ps, crate: &ast::Crate) {
+        pprust::print_mod(s, &crate.module, crate.attrs);
     }
 
     // change every identifier to "zz"
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs
index 44497f72003..e31b0ccff80 100644
--- a/src/libsyntax/parse/classify.rs
+++ b/src/libsyntax/parse/classify.rs
@@ -39,7 +39,7 @@ pub fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
 pub fn expr_is_simple_block(e: @ast::expr) -> bool {
     match e.node {
         ast::expr_block(
-            ast::blk { rules: ast::default_blk, _ }
+            ast::Block { rules: ast::default_blk, _ }
         ) => true,
       _ => false
     }
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index c7a65c80de1..bd57f123cc5 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -76,9 +76,9 @@ pub fn new_parse_sess_special_handler(sh: @span_handler,
 
 pub fn parse_crate_from_file(
     input: &Path,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     sess: @mut ParseSess
-) -> @ast::crate {
+) -> @ast::Crate {
     new_parser_from_file(sess, /*bad*/ cfg.clone(), input).parse_crate_mod()
     // why is there no p.abort_if_errors here?
 }
@@ -86,9 +86,9 @@ pub fn parse_crate_from_file(
 pub fn parse_crate_from_source_str(
     name: @str,
     source: @str,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     sess: @mut ParseSess
-) -> @ast::crate {
+) -> @ast::Crate {
     let p = new_parser_from_source_str(sess,
                                        /*bad*/ cfg.clone(),
                                        name,
@@ -99,7 +99,7 @@ pub fn parse_crate_from_source_str(
 pub fn parse_expr_from_source_str(
     name: @str,
     source: @str,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     sess: @mut ParseSess
 ) -> @ast::expr {
     let p = new_parser_from_source_str(
@@ -114,7 +114,7 @@ pub fn parse_expr_from_source_str(
 pub fn parse_item_from_source_str(
     name: @str,
     source: @str,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     attrs: ~[ast::Attribute],
     sess: @mut ParseSess
 ) -> Option<@ast::item> {
@@ -130,7 +130,7 @@ pub fn parse_item_from_source_str(
 pub fn parse_meta_from_source_str(
     name: @str,
     source: @str,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     sess: @mut ParseSess
 ) -> @ast::MetaItem {
     let p = new_parser_from_source_str(
@@ -145,7 +145,7 @@ pub fn parse_meta_from_source_str(
 pub fn parse_stmt_from_source_str(
     name: @str,
     source: @str,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     attrs: ~[ast::Attribute],
     sess: @mut ParseSess
 ) -> @ast::stmt {
@@ -161,7 +161,7 @@ pub fn parse_stmt_from_source_str(
 pub fn parse_tts_from_source_str(
     name: @str,
     source: @str,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     sess: @mut ParseSess
 ) -> ~[ast::token_tree] {
     let p = new_parser_from_source_str(
@@ -184,7 +184,7 @@ pub fn parse_from_source_str<T>(
     f: &fn(&Parser) -> T,
     name: @str, ss: codemap::FileSubstr,
     source: @str,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     sess: @mut ParseSess
 ) -> T {
     let p = new_parser_from_source_substr(
@@ -212,7 +212,7 @@ pub fn next_node_id(sess: @mut ParseSess) -> node_id {
 
 // Create a new parser from a source string
 pub fn new_parser_from_source_str(sess: @mut ParseSess,
-                                  cfg: ast::crate_cfg,
+                                  cfg: ast::CrateConfig,
                                   name: @str,
                                   source: @str)
                                -> Parser {
@@ -222,7 +222,7 @@ pub fn new_parser_from_source_str(sess: @mut ParseSess,
 // Create a new parser from a source string where the origin
 // is specified as a substring of another file.
 pub fn new_parser_from_source_substr(sess: @mut ParseSess,
-                                  cfg: ast::crate_cfg,
+                                  cfg: ast::CrateConfig,
                                   name: @str,
                                   ss: codemap::FileSubstr,
                                   source: @str)
@@ -234,7 +234,7 @@ pub fn new_parser_from_source_substr(sess: @mut ParseSess,
 /// if the file doesn't exist
 pub fn new_parser_from_file(
     sess: @mut ParseSess,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     path: &Path
 ) -> Parser {
     filemap_to_parser(sess,file_to_filemap(sess,path,None),cfg)
@@ -245,7 +245,7 @@ pub fn new_parser_from_file(
 /// On an error, use the given span as the source of the problem.
 pub fn new_sub_parser_from_file(
     sess: @mut ParseSess,
-    cfg: ast::crate_cfg,
+    cfg: ast::CrateConfig,
     path: &Path,
     sp: span
 ) -> Parser {
@@ -255,14 +255,14 @@ pub fn new_sub_parser_from_file(
 /// Given a filemap and config, return a parser
 pub fn filemap_to_parser(sess: @mut ParseSess,
                          filemap: @FileMap,
-                         cfg: ast::crate_cfg) -> Parser {
+                         cfg: ast::CrateConfig) -> Parser {
     tts_to_parser(sess,filemap_to_tts(sess,filemap),cfg)
 }
 
 // must preserve old name for now, because quote! from the *existing*
 // compiler expands into it
 pub fn new_parser_from_tts(sess: @mut ParseSess,
-                     cfg: ast::crate_cfg,
+                     cfg: ast::CrateConfig,
                      tts: ~[ast::token_tree]) -> Parser {
     tts_to_parser(sess,tts,cfg)
 }
@@ -313,7 +313,7 @@ pub fn filemap_to_tts(sess: @mut ParseSess, filemap: @FileMap)
 // given tts and cfg, produce a parser
 pub fn tts_to_parser(sess: @mut ParseSess,
                      tts: ~[ast::token_tree],
-                     cfg: ast::crate_cfg) -> Parser {
+                     cfg: ast::CrateConfig) -> Parser {
     let trdr = lexer::new_tt_reader(sess.span_diagnostic, None, tts);
     Parser(sess, cfg, trdr as @reader)
 }
@@ -551,7 +551,7 @@ mod test {
                                         lifetimes: opt_vec::Empty,
                                         ty_params: opt_vec::Empty,
                                     },
-                                    ast::blk {
+                                    ast::Block {
                                         view_items: ~[],
                                         stmts: ~[@spanned{
                                             node: ast::stmt_semi(@ast::expr{
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index b2a1a8a73bd..a4fd4929400 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -16,9 +16,9 @@ use ast::{TyBareFn, TyClosure};
 use ast::{RegionTyParamBound, TraitTyParamBound};
 use ast::{provided, public, purity};
 use ast::{_mod, add, arg, arm, Attribute, bind_by_ref, bind_infer};
-use ast::{bitand, bitor, bitxor, blk};
+use ast::{bitand, bitor, bitxor, Block};
 use ast::{blk_check_mode, box};
-use ast::{crate, crate_cfg, decl, decl_item};
+use ast::{Crate, CrateConfig, decl, decl_item};
 use ast::{decl_local, default_blk, deref, div, enum_def, explicit_self};
 use ast::{expr, expr_, expr_addr_of, expr_match, expr_again};
 use ast::{expr_assign, expr_assign_op, expr_binary, expr_block};
@@ -29,14 +29,14 @@ use ast::{expr_method_call, expr_paren, expr_path, expr_repeat};
 use ast::{expr_ret, expr_self, expr_struct, expr_tup, expr_unary};
 use ast::{expr_vec, expr_vstore, expr_vstore_mut_box};
 use ast::{expr_vstore_slice, expr_vstore_box};
-use ast::{expr_vstore_mut_slice, expr_while, extern_fn, field, fn_decl};
+use ast::{expr_vstore_mut_slice, expr_while, extern_fn, Field, fn_decl};
 use ast::{expr_vstore_uniq, Onceness, Once, Many};
 use ast::{foreign_item, foreign_item_static, foreign_item_fn, foreign_mod};
 use ast::{ident, impure_fn, inherited, item, item_, item_static};
 use ast::{item_enum, item_fn, item_foreign_mod, item_impl};
 use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_};
 use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int};
-use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const};
+use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, Local, m_const};
 use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal};
 use ast::{match_seq, match_tok, method, mt, mul, mutability};
 use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum};
@@ -261,7 +261,7 @@ struct ParsedItemsAndViewItems {
 /* ident is handled by common.rs */
 
 pub fn Parser(sess: @mut ParseSess,
-              cfg: ast::crate_cfg,
+              cfg: ast::CrateConfig,
               rdr: @reader)
            -> Parser {
     let tok0 = rdr.next_token();
@@ -299,7 +299,7 @@ pub fn Parser(sess: @mut ParseSess,
 // ooh, nasty mutable fields everywhere....
 pub struct Parser {
     sess: @mut ParseSess,
-    cfg: crate_cfg,
+    cfg: CrateConfig,
     // the current token:
     token: @mut token::Token,
     // the span of the current token:
@@ -1498,15 +1498,16 @@ impl Parser {
     }
 
     // parse ident COLON expr
-    pub fn parse_field(&self) -> field {
+    pub fn parse_field(&self) -> Field {
         let lo = self.span.lo;
         let i = self.parse_ident();
         self.expect(&token::COLON);
         let e = self.parse_expr();
-        spanned(lo, e.span.hi, ast::field_ {
+        ast::Field {
             ident: i,
-            expr: e
-        })
+            expr: e,
+            span: mk_sp(lo, e.span.hi),
+        }
     }
 
     pub fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
@@ -2294,7 +2295,7 @@ impl Parser {
         let lo = self.last_span.lo;
         let decl = parse_decl();
         let body = parse_body();
-        let fakeblock = ast::blk {
+        let fakeblock = ast::Block {
             view_items: ~[],
             stmts: ~[],
             expr: Some(body),
@@ -2460,7 +2461,7 @@ impl Parser {
                 self.eat(&token::COMMA);
             }
 
-            let blk = ast::blk {
+            let blk = ast::Block {
                 view_items: ~[],
                 stmts: ~[],
                 expr: Some(expr),
@@ -2916,7 +2917,7 @@ impl Parser {
     }
 
     // parse a local variable declaration
-    fn parse_local(&self, is_mutbl: bool) -> @local {
+    fn parse_local(&self, is_mutbl: bool) -> @Local {
         let lo = self.span.lo;
         let pat = self.parse_pat();
 
@@ -2931,17 +2932,14 @@ impl Parser {
         };
         if self.eat(&token::COLON) { ty = self.parse_ty(false); }
         let init = self.parse_initializer();
-        @spanned(
-            lo,
-            self.last_span.hi,
-            ast::local_ {
-                is_mutbl: is_mutbl,
-                ty: ty,
-                pat: pat,
-                init: init,
-                id: self.get_id(),
-            }
-        )
+        @ast::Local {
+            is_mutbl: is_mutbl,
+            ty: ty,
+            pat: pat,
+            init: init,
+            id: self.get_id(),
+            span: mk_sp(lo, self.last_span.hi),
+        }
     }
 
     // parse a "let" stmt
@@ -3077,7 +3075,7 @@ impl Parser {
     }
 
     // parse a block. No inner attrs are allowed.
-    pub fn parse_block(&self) -> blk {
+    pub fn parse_block(&self) -> Block {
         maybe_whole!(self, nt_block);
 
         let lo = self.span.lo;
@@ -3091,7 +3089,7 @@ impl Parser {
 
     // parse a block. Inner attrs are allowed.
     fn parse_inner_attrs_and_block(&self)
-        -> (~[Attribute], blk) {
+        -> (~[Attribute], Block) {
 
         maybe_whole!(pair_empty self, nt_block);
 
@@ -3109,13 +3107,13 @@ impl Parser {
     // I guess that also means "already parsed the 'impure'" if
     // necessary, and this should take a qualifier.
     // some blocks start with "#{"...
-    fn parse_block_tail(&self, lo: BytePos, s: blk_check_mode) -> blk {
+    fn parse_block_tail(&self, lo: BytePos, s: blk_check_mode) -> Block {
         self.parse_block_tail_(lo, s, ~[])
     }
 
     // parse the rest of a block expression or function body
     fn parse_block_tail_(&self, lo: BytePos, s: blk_check_mode,
-                         first_item_attrs: ~[Attribute]) -> blk {
+                         first_item_attrs: ~[Attribute]) -> Block {
         let mut stmts = ~[];
         let mut expr = None;
 
@@ -3237,7 +3235,7 @@ impl Parser {
 
         let hi = self.span.hi;
         self.bump();
-        ast::blk {
+        ast::Block {
             view_items: view_items,
             stmts: stmts,
             expr: expr,
@@ -4946,7 +4944,7 @@ impl Parser {
 
     // Parses a source module as a crate. This is the main
     // entry point for the parser.
-    pub fn parse_crate_mod(&self) -> @crate {
+    pub fn parse_crate_mod(&self) -> @Crate {
         let lo = self.span.lo;
         // parse the crate's inner attrs, maybe (oops) one
         // of the attrs of an item:
@@ -4954,10 +4952,13 @@ impl Parser {
         let first_item_outer_attrs = next;
         // parse the items inside the crate:
         let m = self.parse_mod_items(token::EOF, first_item_outer_attrs);
-        @spanned(lo, self.span.lo,
-                 ast::crate_ { module: m,
-                               attrs: inner,
-                               config: self.cfg.clone() })
+
+        @ast::Crate {
+            module: m,
+            attrs: inner,
+            config: self.cfg.clone(),
+            span: mk_sp(lo, self.span.lo)
+        }
     }
 
     pub fn parse_str(&self) -> @str {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 322424b90fb..2d15d0ab7e8 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -99,7 +99,7 @@ pub enum Token {
 /// For interpolation during macro expansion.
 pub enum nonterminal {
     nt_item(@ast::item),
-    nt_block(ast::blk),
+    nt_block(ast::Block),
     nt_stmt(@ast::stmt),
     nt_pat( @ast::pat),
     nt_expr(@ast::expr),
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index f5e66bfd898..8e2c24cacfe 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -33,7 +33,7 @@ use std::uint;
 
 // The @ps is stored here to prevent recursive type.
 pub enum ann_node<'self> {
-    node_block(@ps, &'self ast::blk),
+    node_block(@ps, &'self ast::Block),
     node_item(@ps, &'self ast::item),
     node_expr(@ps, &'self ast::expr),
     node_pat(@ps, &'self ast::pat),
@@ -106,7 +106,7 @@ pub static default_columns: uint = 78u;
 pub fn print_crate(cm: @CodeMap,
                    intr: @ident_interner,
                    span_diagnostic: @diagnostic::span_handler,
-                   crate: &ast::crate,
+                   crate: &ast::Crate,
                    filename: @str,
                    in: @io::Reader,
                    out: @io::Writer,
@@ -140,8 +140,8 @@ pub fn print_crate(cm: @CodeMap,
     print_crate_(s, crate);
 }
 
-pub fn print_crate_(s: @ps, crate: &ast::crate) {
-    print_mod(s, &crate.node.module, crate.node.attrs);
+pub fn print_crate_(s: @ps, crate: &ast::Crate) {
+    print_mod(s, &crate.module, crate.attrs);
     print_remaining_comments(s);
     eof(s.s);
 }
@@ -200,7 +200,7 @@ pub fn fun_to_str(decl: &ast::fn_decl, purity: ast::purity, name: ast::ident,
     }
 }
 
-pub fn block_to_str(blk: &ast::blk, intr: @ident_interner) -> ~str {
+pub fn block_to_str(blk: &ast::Block, intr: @ident_interner) -> ~str {
     do io::with_str_writer |wr| {
         let s = rust_printer(wr, intr);
         // containing cbox, will be closed by print-block at }
@@ -910,22 +910,22 @@ pub fn print_stmt(s: @ps, st: &ast::stmt) {
     maybe_print_trailing_comment(s, st.span, None);
 }
 
-pub fn print_block(s: @ps, blk: &ast::blk) {
+pub fn print_block(s: @ps, blk: &ast::Block) {
     print_possibly_embedded_block(s, blk, block_normal, indent_unit);
 }
 
-pub fn print_block_unclosed(s: @ps, blk: &ast::blk) {
+pub fn print_block_unclosed(s: @ps, blk: &ast::Block) {
     print_possibly_embedded_block_(s, blk, block_normal, indent_unit, &[],
                                  false);
 }
 
-pub fn print_block_unclosed_indent(s: @ps, blk: &ast::blk, indented: uint) {
+pub fn print_block_unclosed_indent(s: @ps, blk: &ast::Block, indented: uint) {
     print_possibly_embedded_block_(s, blk, block_normal, indented, &[],
                                    false);
 }
 
 pub fn print_block_with_attrs(s: @ps,
-                              blk: &ast::blk,
+                              blk: &ast::Block,
                               attrs: &[ast::Attribute]) {
     print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs,
                                   true);
@@ -934,7 +934,7 @@ pub fn print_block_with_attrs(s: @ps,
 pub enum embed_type { block_block_fn, block_normal, }
 
 pub fn print_possibly_embedded_block(s: @ps,
-                                     blk: &ast::blk,
+                                     blk: &ast::Block,
                                      embedded: embed_type,
                                      indented: uint) {
     print_possibly_embedded_block_(
@@ -942,7 +942,7 @@ pub fn print_possibly_embedded_block(s: @ps,
 }
 
 pub fn print_possibly_embedded_block_(s: @ps,
-                                      blk: &ast::blk,
+                                      blk: &ast::Block,
                                       embedded: embed_type,
                                       indented: uint,
                                       attrs: &[ast::Attribute],
@@ -977,7 +977,7 @@ pub fn print_possibly_embedded_block_(s: @ps,
     (s.ann.post)(ann_node);
 }
 
-pub fn print_if(s: @ps, test: &ast::expr, blk: &ast::blk,
+pub fn print_if(s: @ps, test: &ast::expr, blk: &ast::Block,
                 elseopt: Option<@ast::expr>, chk: bool) {
     head(s, "if");
     if chk { word_nbsp(s, "check"); }
@@ -1103,14 +1103,14 @@ pub fn print_call_post(s: @ps,
 }
 
 pub fn print_expr(s: @ps, expr: &ast::expr) {
-    fn print_field(s: @ps, field: &ast::field) {
+    fn print_field(s: @ps, field: &ast::Field) {
         ibox(s, indent_unit);
-        print_ident(s, field.node.ident);
+        print_ident(s, field.ident);
         word_space(s, ":");
-        print_expr(s, field.node.expr);
+        print_expr(s, field.expr);
         end(s);
     }
-    fn get_span(field: &ast::field) -> codemap::span { return field.span; }
+    fn get_span(field: &ast::Field) -> codemap::span { return field.span; }
 
     maybe_print_comment(s, expr.span.lo);
     ibox(s, indent_unit);
@@ -1447,11 +1447,11 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
     end(s);
 }
 
-pub fn print_local_decl(s: @ps, loc: &ast::local) {
-    print_pat(s, loc.node.pat);
-    match loc.node.ty.node {
+pub fn print_local_decl(s: @ps, loc: &ast::Local) {
+    print_pat(s, loc.pat);
+    match loc.ty.node {
       ast::ty_infer => (),
-      _ => { word_space(s, ":"); print_type(s, &loc.node.ty); }
+      _ => { word_space(s, ":"); print_type(s, &loc.ty); }
     }
 }
 
@@ -1463,15 +1463,15 @@ pub fn print_decl(s: @ps, decl: &ast::decl) {
         ibox(s, indent_unit);
         word_nbsp(s, "let");
 
-        if loc.node.is_mutbl {
+        if loc.is_mutbl {
             word_nbsp(s, "mut");
         }
 
-        fn print_local(s: @ps, loc: &ast::local) {
+        fn print_local(s: @ps, loc: &ast::Local) {
             ibox(s, indent_unit);
             print_local_decl(s, loc);
             end(s);
-            match loc.node.init {
+            match loc.init {
               Some(init) => {
                 nbsp(s);
                 word_space(s, "=");
@@ -1492,7 +1492,7 @@ pub fn print_ident(s: @ps, ident: ast::ident) {
     word(s.s, ident_to_str(&ident));
 }
 
-pub fn print_for_decl(s: @ps, loc: &ast::local, coll: &ast::expr) {
+pub fn print_for_decl(s: @ps, loc: &ast::Local, coll: &ast::expr) {
     print_local_decl(s, loc);
     space(s.s);
     word_space(s, "in");
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs
index 4340d6bb6a2..de97396e453 100644
--- a/src/libsyntax/util/parser_testing.rs
+++ b/src/libsyntax/util/parser_testing.rs
@@ -33,7 +33,7 @@ pub fn string_to_parser(source_str: @str) -> Parser {
     p
 }
 
-pub fn string_to_crate (source_str : @str) -> @ast::crate {
+pub fn string_to_crate (source_str : @str) -> @ast::Crate {
     string_to_parser(source_str).parse_crate_mod()
 }
 
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index f57dcb1588e..7e86adfcb63 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -75,8 +75,8 @@ pub struct Visitor<E> {
     visit_view_item: @fn(&view_item, (E, vt<E>)),
     visit_foreign_item: @fn(@foreign_item, (E, vt<E>)),
     visit_item: @fn(@item, (E, vt<E>)),
-    visit_local: @fn(@local, (E, vt<E>)),
-    visit_block: @fn(&blk, (E, vt<E>)),
+    visit_local: @fn(@Local, (E, vt<E>)),
+    visit_block: @fn(&Block, (E, vt<E>)),
     visit_stmt: @fn(@stmt, (E, vt<E>)),
     visit_arm: @fn(&arm, (E, vt<E>)),
     visit_pat: @fn(@pat, (E, vt<E>)),
@@ -85,7 +85,7 @@ pub struct Visitor<E> {
     visit_expr_post: @fn(@expr, (E, vt<E>)),
     visit_ty: @fn(&Ty, (E, vt<E>)),
     visit_generics: @fn(&Generics, (E, vt<E>)),
-    visit_fn: @fn(&fn_kind, &fn_decl, &blk, span, node_id, (E, vt<E>)),
+    visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, node_id, (E, vt<E>)),
     visit_ty_method: @fn(&ty_method, (E, vt<E>)),
     visit_trait_method: @fn(&trait_method, (E, vt<E>)),
     visit_struct_def: @fn(@struct_def, ident, &Generics, node_id, (E, vt<E>)),
@@ -118,8 +118,8 @@ pub fn default_visitor<E:Clone>() -> visitor<E> {
     };
 }
 
-pub fn visit_crate<E:Clone>(c: &crate, (e, v): (E, vt<E>)) {
-    (v.visit_mod)(&c.node.module, c.span, crate_node_id, (e, v));
+pub fn visit_crate<E:Clone>(c: &Crate, (e, v): (E, vt<E>)) {
+    (v.visit_mod)(&c.module, c.span, crate_node_id, (e, v));
 }
 
 pub fn visit_mod<E:Clone>(m: &_mod,
@@ -136,10 +136,10 @@ pub fn visit_mod<E:Clone>(m: &_mod,
 
 pub fn visit_view_item<E>(_vi: &view_item, (_e, _v): (E, vt<E>)) { }
 
-pub fn visit_local<E:Clone>(loc: &local, (e, v): (E, vt<E>)) {
-    (v.visit_pat)(loc.node.pat, (e.clone(), v));
-    (v.visit_ty)(&loc.node.ty, (e.clone(), v));
-    match loc.node.init {
+pub fn visit_local<E:Clone>(loc: &Local, (e, v): (E, vt<E>)) {
+    (v.visit_pat)(loc.pat, (e.clone(), v));
+    (v.visit_ty)(&loc.ty, (e.clone(), v));
+    match loc.init {
       None => (),
       Some(ex) => (v.visit_expr)(ex, (e, v))
     }
@@ -386,7 +386,7 @@ pub fn visit_method_helper<E:Clone>(m: &method, (e, v): (E, vt<E>)) {
                  (e, v));
 }
 
-pub fn visit_fn<E:Clone>(fk: &fn_kind, decl: &fn_decl, body: &blk, _sp: span,
+pub fn visit_fn<E:Clone>(fk: &fn_kind, decl: &fn_decl, body: &Block, _sp: span,
                          _id: node_id, (e, v): (E, vt<E>)) {
     visit_fn_decl(decl, (e.clone(), v));
     let generics = generics_of_fn(fk);
@@ -425,7 +425,7 @@ pub fn visit_struct_field<E:Clone>(sf: &struct_field, (e, v): (E, vt<E>)) {
     (v.visit_ty)(&sf.node.ty, (e, v));
 }
 
-pub fn visit_block<E:Clone>(b: &blk, (e, v): (E, vt<E>)) {
+pub fn visit_block<E:Clone>(b: &Block, (e, v): (E, vt<E>)) {
     for b.view_items.iter().advance |vi| {
         (v.visit_view_item)(vi, (e.clone(), v));
     }
@@ -474,7 +474,7 @@ pub fn visit_expr<E:Clone>(ex: @expr, (e, v): (E, vt<E>)) {
         expr_struct(ref p, ref flds, base) => {
             visit_path(p, (e.clone(), v));
             for flds.iter().advance |f| {
-                (v.visit_expr)(f.node.expr, (e.clone(), v));
+                (v.visit_expr)(f.expr, (e.clone(), v));
             }
             visit_expr_opt(base, (e.clone(), v));
         }
@@ -583,8 +583,8 @@ pub struct SimpleVisitor {
     visit_view_item: @fn(&view_item),
     visit_foreign_item: @fn(@foreign_item),
     visit_item: @fn(@item),
-    visit_local: @fn(@local),
-    visit_block: @fn(&blk),
+    visit_local: @fn(@Local),
+    visit_block: @fn(&Block),
     visit_stmt: @fn(@stmt),
     visit_arm: @fn(&arm),
     visit_pat: @fn(@pat),
@@ -593,7 +593,7 @@ pub struct SimpleVisitor {
     visit_expr_post: @fn(@expr),
     visit_ty: @fn(&Ty),
     visit_generics: @fn(&Generics),
-    visit_fn: @fn(&fn_kind, &fn_decl, &blk, span, node_id),
+    visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, node_id),
     visit_ty_method: @fn(&ty_method),
     visit_trait_method: @fn(&trait_method),
     visit_struct_def: @fn(@struct_def, ident, &Generics, node_id),
@@ -653,11 +653,11 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
         f(i);
         visit_item(i, (e, v));
     }
-    fn v_local(f: @fn(@local), l: @local, (e, v): ((), vt<()>)) {
+    fn v_local(f: @fn(@Local), l: @Local, (e, v): ((), vt<()>)) {
         f(l);
         visit_local(l, (e, v));
     }
-    fn v_block(f: @fn(&ast::blk), bl: &ast::blk, (e, v): ((), vt<()>)) {
+    fn v_block(f: @fn(&ast::Block), bl: &ast::Block, (e, v): ((), vt<()>)) {
         f(bl);
         visit_block(bl, (e, v));
     }
@@ -718,10 +718,10 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
         visit_generics(ps, (e, v));
     }
     fn v_fn(
-        f: @fn(&fn_kind, &fn_decl, &blk, span, node_id),
+        f: @fn(&fn_kind, &fn_decl, &Block, span, node_id),
         fk: &fn_kind,
         decl: &fn_decl,
-        body: &blk,
+        body: &Block,
         sp: span,
         id: node_id,
         (e, v): ((), vt<()>)