summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-05-05 15:11:04 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-05-05 15:11:04 -0400
commit4300d4d2fa9d35ac73742c7d815ee157ce0f9c17 (patch)
tree9e5db5a04493a573f280b2c8863d0eaf0ca47c0d /src/libsyntax
parent6cb273ed4efb6724b1c713c3ac35d14e52999fb1 (diff)
parent063851ffa1b8388a0b70446c0209af16264e8181 (diff)
downloadrust-4300d4d2fa9d35ac73742c7d815ee157ce0f9c17.tar.gz
rust-4300d4d2fa9d35ac73742c7d815ee157ce0f9c17.zip
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze
Conflicts:
	src/libcore/core.rc
	src/libcore/hashmap.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/num/float.rs
	src/libcore/num/int-template.rs
	src/libcore/num/num.rs
	src/libcore/num/strconv.rs
	src/libcore/num/uint-template.rs
	src/libcore/ops.rs
	src/libcore/os.rs
	src/libcore/prelude.rs
	src/libcore/rt/mod.rs
	src/libcore/unstable/lang.rs
	src/librustc/driver/session.rs
	src/librustc/middle/astencode.rs
	src/librustc/middle/borrowck/check_loans.rs
	src/librustc/middle/borrowck/gather_loans.rs
	src/librustc/middle/borrowck/loan.rs
	src/librustc/middle/borrowck/preserve.rs
	src/librustc/middle/liveness.rs
	src/librustc/middle/mem_categorization.rs
	src/librustc/middle/region.rs
	src/librustc/middle/trans/base.rs
	src/librustc/middle/trans/inline.rs
	src/librustc/middle/trans/reachable.rs
	src/librustc/middle/typeck/check/_match.rs
	src/librustc/middle/typeck/check/regionck.rs
	src/librustc/util/ppaux.rs
	src/libstd/arena.rs
	src/libstd/ebml.rs
	src/libstd/json.rs
	src/libstd/serialize.rs
	src/libstd/std.rc
	src/libsyntax/ast_map.rs
	src/libsyntax/parse/parser.rs
	src/test/compile-fail/borrowck-uniq-via-box.rs
	src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
	src/test/run-pass/borrowck-nested-calls.rs
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs51
-rw-r--r--src/libsyntax/ast_map.rs37
-rw-r--r--src/libsyntax/ast_util.rs48
-rw-r--r--src/libsyntax/attr.rs10
-rw-r--r--src/libsyntax/codemap.rs18
-rw-r--r--src/libsyntax/ext/asm.rs12
-rw-r--r--src/libsyntax/ext/auto_encode.rs304
-rw-r--r--src/libsyntax/ext/base.rs12
-rw-r--r--src/libsyntax/ext/deriving/decodable.rs49
-rw-r--r--src/libsyntax/ext/deriving/encodable.rs42
-rw-r--r--src/libsyntax/ext/env.rs10
-rw-r--r--src/libsyntax/ext/expand.rs10
-rw-r--r--src/libsyntax/ext/fmt.rs15
-rw-r--r--src/libsyntax/ext/pipes/check.rs1
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs1
-rw-r--r--src/libsyntax/ext/pipes/mod.rs1
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs4
-rw-r--r--src/libsyntax/ext/pipes/proto.rs1
-rw-r--r--src/libsyntax/ext/quote.rs1
-rw-r--r--src/libsyntax/ext/source_util.rs10
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs8
-rw-r--r--src/libsyntax/fold.rs43
-rw-r--r--src/libsyntax/parse/attr.rs10
-rw-r--r--src/libsyntax/parse/lexer.rs10
-rw-r--r--src/libsyntax/parse/mod.rs15
-rw-r--r--src/libsyntax/parse/obsolete.rs7
-rw-r--r--src/libsyntax/parse/parser.rs196
-rw-r--r--src/libsyntax/parse/token.rs155
-rw-r--r--src/libsyntax/print/pp.rs11
-rw-r--r--src/libsyntax/print/pprust.rs18
-rw-r--r--src/libsyntax/syntax.rc2
-rw-r--r--src/libsyntax/visit.rs52
32 files changed, 456 insertions, 708 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index ba6fe1cda4f..2216226ecb3 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -71,20 +71,21 @@ pub type Name = uint;
 pub type Mrk = uint;
 
 impl<S:Encoder> Encodable<S> for ident {
-    fn encode(&self, s: &S) {
-        let intr = match unsafe {
-            task::local_data::local_data_get(interner_key!())
-        } {
-            None => fail!(~"encode: TLS interner not set up"),
-            Some(intr) => intr
-        };
-
-        s.emit_str(*(*intr).get(*self));
+    fn encode(&self, s: &mut S) {
+        unsafe {
+            let intr =
+                match task::local_data::local_data_get(interner_key!()) {
+                    None => fail!(~"encode: TLS interner not set up"),
+                    Some(intr) => intr
+                };
+
+            s.emit_str(*(*intr).get(*self));
+        }
     }
 }
 
 impl<D:Decoder> Decodable<D> for ident {
-    fn decode(d: &D) -> ident {
+    fn decode(d: &mut D) -> ident {
         let intr = match unsafe {
             task::local_data::local_data_get(interner_key!())
         } {
@@ -389,7 +390,7 @@ pub enum binop {
     add,
     subtract,
     mul,
-    quot,
+    div,
     rem,
     and,
     or,
@@ -1158,6 +1159,7 @@ pub struct struct_field_ {
     kind: struct_field_kind,
     id: node_id,
     ty: @Ty,
+    attrs: ~[attribute],
 }
 
 pub type struct_field = spanned<struct_field_>;
@@ -1174,10 +1176,7 @@ pub enum struct_field_kind {
 #[auto_decode]
 #[deriving(Eq)]
 pub struct struct_def {
-    fields: ~[@struct_field], /* fields */
-    /* (not including ctor or dtor) */
-    /* dtor is optional */
-    dtor: Option<struct_dtor>,
+    fields: ~[@struct_field], /* fields, not including ctor */
     /* ID of the constructor. This is only used for tuple- or enum-like
      * structs. */
     ctor_id: Option<node_id>
@@ -1230,18 +1229,6 @@ impl to_bytes::IterBytes for struct_mutability {
     }
 }
 
-pub type struct_dtor = spanned<struct_dtor_>;
-
-#[auto_encode]
-#[auto_decode]
-#[deriving(Eq)]
-pub struct struct_dtor_ {
-    id: node_id,
-    attrs: ~[attribute],
-    self_id: node_id,
-    body: blk,
-}
-
 #[auto_encode]
 #[auto_decode]
 #[deriving(Eq)]
@@ -1272,7 +1259,6 @@ pub enum inlined_item {
     ii_item(@item),
     ii_method(def_id /* impl id */, @method),
     ii_foreign(@foreign_item),
-    ii_dtor(struct_dtor, ident, Generics, def_id /* parent id */)
 }
 
 /* hold off on tests ... they appear in a later merge.
@@ -1361,12 +1347,3 @@ mod test {
 }
 
 */
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index eb131b17c2f..77a02adbafb 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -14,7 +14,6 @@ use ast;
 use ast_util::{inlined_item_utils, stmt_id};
 use ast_util;
 use codemap;
-use codemap::spanned;
 use diagnostic::span_handler;
 use parse::token::ident_interner;
 use print::pprust;
@@ -92,8 +91,6 @@ pub enum ast_node {
     node_stmt(@stmt),
     node_arg,
     node_local(ident),
-    // Destructor for a struct
-    node_dtor(Generics, @struct_dtor, def_id, @path),
     node_block(blk),
     node_struct_ctor(@struct_def, @item, @path),
     node_callee_scope(@expr)
@@ -159,7 +156,7 @@ pub fn map_decoded_item(diag: @span_handler,
     // don't decode and instantiate the impl, but just the method, we have to
     // add it to the table now:
     match *ii {
-      ii_item(*) | ii_dtor(*) => { /* fallthrough */ }
+      ii_item(*) => { /* fallthrough */ }
       ii_foreign(i) => {
         cx.map.insert(i.id, node_foreign_item(i,
                                               AbiSet::Intrinsic(),
@@ -187,27 +184,6 @@ pub fn map_fn(
     for decl.inputs.each |a| {
         cx.map.insert(a.id, node_arg);
     }
-    match *fk {
-        visit::fk_dtor(generics, ref attrs, self_id, parent_id) => {
-            let dt = @spanned {
-                node: ast::struct_dtor_ {
-                    id: id,
-                    attrs: /* FIXME (#2543) */ vec::from_slice(*attrs),
-                    self_id: self_id,
-                    body: /* FIXME (#2543) */ copy *body,
-                },
-                span: sp,
-            };
-            cx.map.insert(
-                id,
-                node_dtor(
-                    /* FIXME (#2543) */ copy *generics,
-                    dt,
-                    parent_id,
-                    @/* FIXME (#2543) */ copy cx.path));
-      }
-      _ => ()
-    }
     visit::visit_fn(fk, decl, body, sp, id, cx, v);
 }
 
@@ -410,9 +386,6 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
       Some(&node_local(ident)) => {
         fmt!("local (id=%?, name=%s)", id, *itr.get(ident))
       }
-      Some(&node_dtor(*)) => { // add more info here
-        fmt!("node_dtor (id=%?)", id)
-      }
       Some(&node_block(_)) => {
         fmt!("block")
       }
@@ -430,11 +403,3 @@ pub fn node_item_query<Result>(items: map, id: node_id,
         _ => fail!(error_msg)
     }
 }
-
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 7e24adabdb0..a6094903d7b 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -11,7 +11,7 @@
 use ast::*;
 use ast;
 use ast_util;
-use codemap::{span, dummy_sp, spanned};
+use codemap::{span, spanned};
 use parse::token;
 use visit;
 use opt_vec;
@@ -41,12 +41,12 @@ pub fn stmt_id(s: &stmt) -> node_id {
     }
 }
 
-pub fn variant_def_ids(d: def) -> (def_id, def_id) {
+pub fn variant_def_ids(d: def) -> Option<(def_id, def_id)> {
     match d {
       def_variant(enum_id, var_id) => {
-        return (enum_id, var_id);
+          Some((enum_id, var_id))
       }
-      _ => fail!(~"non-variant in variant_def_ids")
+      _ => None
     }
 }
 
@@ -73,7 +73,7 @@ pub fn binop_to_str(op: binop) -> ~str {
       add => return ~"+",
       subtract => return ~"-",
       mul => return ~"*",
-      quot => return ~"/",
+      div => return ~"/",
       rem => return ~"%",
       and => return ~"&&",
       or => return ~"||",
@@ -96,7 +96,7 @@ pub fn binop_to_method_name(op: binop) -> Option<~str> {
       add => return Some(~"add"),
       subtract => return Some(~"sub"),
       mul => return Some(~"mul"),
-      quot => return Some(~"quot"),
+      div => return Some(~"div"),
       rem => return Some(~"rem"),
       bitxor => return Some(~"bitxor"),
       bitand => return Some(~"bitand"),
@@ -302,7 +302,6 @@ impl inlined_item_utils for inlined_item {
             ii_item(i) => /* FIXME (#2543) */ copy i.ident,
             ii_foreign(i) => /* FIXME (#2543) */ copy i.ident,
             ii_method(_, m) => /* FIXME (#2543) */ copy m.ident,
-            ii_dtor(_, nm, _, _) => /* FIXME (#2543) */ copy nm
         }
     }
 
@@ -311,7 +310,6 @@ impl inlined_item_utils for inlined_item {
             ii_item(i) => i.id,
             ii_foreign(i) => i.id,
             ii_method(_, m) => m.id,
-            ii_dtor(ref dtor, _, _, _) => (*dtor).node.id
         }
     }
 
@@ -320,10 +318,6 @@ impl inlined_item_utils for inlined_item {
             ii_item(i) => (v.visit_item)(i, e, v),
             ii_foreign(i) => (v.visit_foreign_item)(i, e, v),
             ii_method(_, m) => visit::visit_method_helper(m, e, v),
-            ii_dtor(/*bad*/ copy dtor, _, ref generics, parent_id) => {
-                visit::visit_struct_dtor_helper(dtor, generics,
-                                                parent_id, e, v);
-            }
         }
     }
 }
@@ -341,7 +335,7 @@ pub fn is_self(d: ast::def) -> bool {
 /// Maps a binary operator to its precedence
 pub fn operator_prec(op: ast::binop) -> uint {
   match op {
-      mul | quot | rem   => 12u,
+      mul | div | rem   => 12u,
       // 'as' sits between here with 11
       add | subtract    => 10u,
       shl | shr         =>  9u,
@@ -359,20 +353,6 @@ pub fn operator_prec(op: ast::binop) -> uint {
 /// not appearing in the prior table.
 pub static as_prec: uint = 11u;
 
-pub fn dtor_ty() -> @ast::Ty {
-    @ast::Ty {id: 0, node: ty_nil, span: dummy_sp()}
-}
-
-pub fn dtor_dec() -> fn_decl {
-    let nil_t = dtor_ty();
-    // dtor has no args
-    ast::fn_decl {
-        inputs: ~[],
-        output: nil_t,
-        cf: return_val,
-    }
-}
-
 pub fn empty_generics() -> Generics {
     Generics {lifetimes: opt_vec::Empty,
               ty_params: opt_vec::Empty}
@@ -469,12 +449,6 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
             vfn(id);
 
             match *fk {
-                visit::fk_dtor(generics, _, self_id, parent_id) => {
-                    visit_generics(generics);
-                    vfn(id);
-                    vfn(self_id);
-                    vfn(parent_id.node);
-                }
                 visit::fk_item_fn(_, generics, _, _) => {
                     visit_generics(generics);
                 }
@@ -868,11 +842,3 @@ mod test {
     }
 
 }
-
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 2f8405c6e96..f4f0def2843 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -341,13 +341,3 @@ pub fn require_unique_names(diagnostic: @span_handler,
         }
     }
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 1c822b520f6..846097550d1 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -127,11 +127,13 @@ impl cmp::Eq for span {
 
 impl<S:Encoder> Encodable<S> for span {
     /* Note #1972 -- spans are encoded but not decoded */
-    fn encode(&self, _s: &S) { _s.emit_nil() }
+    fn encode(&self, s: &mut S) {
+        s.emit_nil()
+    }
 }
 
 impl<D:Decoder> Decodable<D> for span {
-    fn decode(_d: &D) -> span {
+    fn decode(_d: &mut D) -> span {
         dummy_sp()
     }
 }
@@ -522,15 +524,3 @@ mod test {
         fm.next_line(BytePos(2));
     }
 }
-
-
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index dfebf6f786a..53f40113532 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -187,15 +187,3 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
         span: sp
     })
 }
-
-
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index 2ceb6f0c4bb..bdf0a2a1dd0 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -238,7 +238,8 @@ trait ExtCtxtMethods {
     fn stmt(&self, expr: @ast::expr) -> @ast::stmt;
     fn lit_str(&self, span: span, s: @~str) -> @ast::expr;
     fn lit_uint(&self, span: span, i: uint) -> @ast::expr;
-    fn lambda(&self, blk: ast::blk) -> @ast::expr;
+    fn lambda0(&self, blk: ast::blk) -> @ast::expr;
+    fn lambda1(&self, blk: ast::blk, ident: ast::ident) -> @ast::expr;
     fn blk(&self, span: span, stmts: ~[@ast::stmt]) -> ast::blk;
     fn expr_blk(&self, expr: @ast::expr) -> ast::blk;
     fn expr_path(&self, span: span, strs: ~[ast::ident]) -> @ast::expr;
@@ -254,8 +255,15 @@ trait ExtCtxtMethods {
                         ident: ast::ident,
                         args: ~[@ast::expr])
                         -> @ast::expr;
-    fn lambda_expr(&self, expr: @ast::expr) -> @ast::expr;
-    fn lambda_stmts(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr;
+    fn lambda_expr_0(&self, expr: @ast::expr) -> @ast::expr;
+    fn lambda_expr_1(&self, expr: @ast::expr, ident: ast::ident)
+                    -> @ast::expr;
+    fn lambda_stmts_0(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr;
+    fn lambda_stmts_1(&self,
+                      span: span,
+                      stmts: ~[@ast::stmt],
+                      ident: ast::ident)
+                      -> @ast::expr;
 }
 
 impl ExtCtxtMethods for @ext_ctxt {
@@ -388,12 +396,18 @@ impl ExtCtxtMethods for @ext_ctxt {
                                 span: span}))
     }
 
-    fn lambda(&self, blk: ast::blk) -> @ast::expr {
+    fn lambda0(&self, blk: ast::blk) -> @ast::expr {
         let ext_cx = *self;
         let blk_e = self.expr(copy blk.span, ast::expr_block(copy blk));
         quote_expr!( || $blk_e )
     }
 
+    fn lambda1(&self, blk: ast::blk, ident: ast::ident) -> @ast::expr {
+        let ext_cx = *self;
+        let blk_e = self.expr(copy blk.span, ast::expr_block(copy blk));
+        quote_expr!( |$ident| $blk_e )
+    }
+
     fn blk(&self, span: span, stmts: ~[@ast::stmt]) -> ast::blk {
         codemap::spanned {
             node: ast::blk_ {
@@ -461,15 +475,29 @@ impl ExtCtxtMethods for @ext_ctxt {
         ident: ast::ident,
         args: ~[@ast::expr]
     ) -> @ast::expr {
-        self.expr(span, ast::expr_method_call(expr, ident, ~[], args, ast::NoSugar))
+        self.expr(span,
+                  ast::expr_method_call(expr, ident, ~[], args, ast::NoSugar))
+    }
+
+    fn lambda_expr_0(&self, expr: @ast::expr) -> @ast::expr {
+        self.lambda0(self.expr_blk(expr))
+    }
+
+    fn lambda_expr_1(&self, expr: @ast::expr, ident: ast::ident)
+                    -> @ast::expr {
+        self.lambda1(self.expr_blk(expr), ident)
     }
 
-    fn lambda_expr(&self, expr: @ast::expr) -> @ast::expr {
-        self.lambda(self.expr_blk(expr))
+    fn lambda_stmts_0(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr {
+        self.lambda0(self.blk(span, stmts))
     }
 
-    fn lambda_stmts(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr {
-        self.lambda(self.blk(span, stmts))
+    fn lambda_stmts_1(&self,
+                      span: span,
+                      stmts: ~[@ast::stmt],
+                      ident: ast::ident)
+                      -> @ast::expr {
+        self.lambda1(self.blk(span, stmts), ident)
     }
 }
 
@@ -644,7 +672,7 @@ fn mk_ser_method(
             None,
             ast::mt {
                 ty: cx.ty_path(span, ~[cx.ident_of(~"__S")], ~[]),
-                mutbl: ast::m_imm
+                mutbl: ast::m_mutbl
             }
         ),
         span: span,
@@ -706,7 +734,7 @@ fn mk_deser_method(
             None,
             ast::mt {
                 ty: cx.ty_path(span, ~[cx.ident_of(~"__D")], ~[]),
-                mutbl: ast::m_imm
+                mutbl: ast::m_mutbl
             }
         ),
         span: span,
@@ -758,8 +786,8 @@ fn mk_struct_ser_impl(
     generics: &ast::Generics
 ) -> @ast::item {
     let fields = do mk_struct_fields(fields).mapi |idx, field| {
-        // ast for `|| self.$(name).encode(__s)`
-        let expr_lambda = cx.lambda_expr(
+        // ast for `|__s| self.$(name).encode(__s)`
+        let expr_lambda = cx.lambda_expr_1(
             cx.expr_method_call(
                 span,
                 cx.expr_field(
@@ -769,7 +797,8 @@ fn mk_struct_ser_impl(
                 ),
                 cx.ident_of(~"encode"),
                 ~[cx.expr_var(span, ~"__s")]
-            )
+            ),
+            cx.ident_of(~"__s")
         );
 
         // ast for `__s.emit_struct_field($(name), $(idx), $(expr_lambda))`
@@ -787,7 +816,7 @@ fn mk_struct_ser_impl(
         )
     };
 
-    // ast for `__s.emit_struct($(name), || $(fields))`
+    // ast for `__s.emit_struct($(name), |__s| $(fields))`
     let ser_body = cx.expr_method_call(
         span,
         cx.expr_var(span, ~"__s"),
@@ -795,7 +824,7 @@ fn mk_struct_ser_impl(
         ~[
             cx.lit_str(span, @cx.str_of(ident)),
             cx.lit_uint(span, vec::len(fields)),
-            cx.lambda_stmts(span, fields),
+            cx.lambda_stmts_1(span, fields, cx.ident_of(~"__s")),
         ]
     );
 
@@ -810,8 +839,8 @@ fn mk_struct_deser_impl(
     generics: &ast::Generics
 ) -> @ast::item {
     let fields = do mk_struct_fields(fields).mapi |idx, field| {
-        // ast for `|| std::serialize::decode(__d)`
-        let expr_lambda = cx.lambda(
+        // ast for `|__d| std::serialize::decode(__d)`
+        let expr_lambda = cx.lambda1(
             cx.expr_blk(
                 cx.expr_call(
                     span,
@@ -823,7 +852,8 @@ fn mk_struct_deser_impl(
                     ]),
                     ~[cx.expr_var(span, ~"__d")]
                 )
-            )
+            ),
+            cx.ident_of(~"__d")
         );
 
         // ast for `__d.read_struct_field($(name), $(idx), $(expr_lambda))`
@@ -848,7 +878,7 @@ fn mk_struct_deser_impl(
         }
     };
 
-    // ast for `read_struct($(name), || $(fields))`
+    // ast for `read_struct($(name), |__d| $(fields))`
     let body = cx.expr_method_call(
         span,
         cx.expr_var(span, ~"__d"),
@@ -856,7 +886,7 @@ fn mk_struct_deser_impl(
         ~[
             cx.lit_str(span, @cx.str_of(ident)),
             cx.lit_uint(span, vec::len(fields)),
-            cx.lambda_expr(
+            cx.lambda_expr_1(
                 cx.expr(
                     span,
                     ast::expr_struct(
@@ -864,7 +894,8 @@ fn mk_struct_deser_impl(
                         fields,
                         None
                     )
-                )
+                ),
+                cx.ident_of(~"__d")
             ),
         ]
     );
@@ -974,14 +1005,15 @@ fn ser_variant(
             cx.ident_of(~"emit_enum_variant_arg")
         );
 
-        // ast for `|| $(v).encode(__s)`
-        let expr_encode = cx.lambda_expr(
-             cx.expr_method_call(
+        // ast for `|__s| $(v).encode(__s)`
+        let expr_encode = cx.lambda_expr_1(
+            cx.expr_method_call(
                 span,
                  cx.expr_path(span, ~[names[a_idx]]),
                  cx.ident_of(~"encode"),
                 ~[cx.expr_var(span, ~"__s")]
-            )
+            ),
+            cx.ident_of(~"__s")
         );
 
         // ast for `$(expr_emit)($(a_idx), $(expr_encode))`
@@ -1003,7 +1035,7 @@ fn ser_variant(
             cx.lit_str(span, @cx.str_of(v_name)),
             cx.lit_uint(span, v_idx),
             cx.lit_uint(span, stmts.len()),
-            cx.lambda_stmts(span, stmts),
+            cx.lambda_stmts_1(span, stmts, cx.ident_of(~"__s")),
         ]
     );
 
@@ -1050,7 +1082,7 @@ fn mk_enum_ser_body(
         cx.ident_of(~"emit_enum"),
         ~[
             cx.lit_str(span, @cx.str_of(name)),
-            cx.lambda_expr(match_expr),
+            cx.lambda_expr_1(match_expr, cx.ident_of(~"__s")),
         ]
     )
 }
@@ -1062,8 +1094,8 @@ fn mk_enum_deser_variant_nary(
     args: ~[ast::variant_arg]
 ) -> @ast::expr {
     let args = do args.mapi |idx, _arg| {
-        // ast for `|| std::serialize::decode(__d)`
-        let expr_lambda = cx.lambda_expr(
+        // ast for `|__s| std::serialize::decode(__d)`
+        let expr_lambda = cx.lambda_expr_1(
             cx.expr_call(
                 span,
                 cx.expr_path_global(span, ~[
@@ -1073,7 +1105,8 @@ fn mk_enum_deser_variant_nary(
                     cx.ident_of(~"decode"),
                 ]),
                 ~[cx.expr_var(span, ~"__d")]
-            )
+            ),
+            cx.ident_of(~"__d")
         );
 
         // ast for `__d.read_enum_variant_arg($(a_idx), $(expr_lambda))`
@@ -1163,24 +1196,44 @@ fn mk_enum_deser_body(
         span,
         ast::expr_fn_block(
             ast::fn_decl {
-                inputs: ~[ast::arg {
-                    is_mutbl: false,
-                    ty: @ast::Ty {
+                inputs: ~[
+                    ast::arg {
+                        is_mutbl: false,
+                        ty: @ast::Ty {
+                            id: ext_cx.next_id(),
+                            node: ast::ty_infer,
+                            span: span
+                        },
+                        pat: @ast::pat {
+                            id: ext_cx.next_id(),
+                            node: ast::pat_ident(
+                                ast::bind_by_copy,
+                                ast_util::ident_to_path(span,
+                                    ext_cx.ident_of(~"__d")),
+                                None),
+                            span: span,
+                        },
                         id: ext_cx.next_id(),
-                        node: ast::ty_infer,
-                        span: span
                     },
-                    pat: @ast::pat {
+                    ast::arg {
+                        is_mutbl: false,
+                        ty: @ast::Ty {
+                            id: ext_cx.next_id(),
+                            node: ast::ty_infer,
+                            span: span
+                        },
+                        pat: @ast::pat {
+                            id: ext_cx.next_id(),
+                            node: ast::pat_ident(
+                                ast::bind_by_copy,
+                                ast_util::ident_to_path(span,
+                                    ext_cx.ident_of(~"i")),
+                                None),
+                            span: span,
+                        },
                         id: ext_cx.next_id(),
-                        node: ast::pat_ident(
-                            ast::bind_by_copy,
-                            ast_util::ident_to_path(span,
-                                ext_cx.ident_of(~"i")),
-                            None),
-                        span: span,
-                    },
-                    id: ext_cx.next_id(),
-                }],
+                    }
+                ],
                 output: @ast::Ty {
                     id: ext_cx.next_id(),
                     node: ast::ty_infer,
@@ -1198,13 +1251,14 @@ fn mk_enum_deser_body(
     );
 
     // ast for `__d.read_enum_variant($expr_arm_names, $(expr_lambda))`
-    let expr_lambda = ext_cx.lambda_expr(
+    let expr_lambda = ext_cx.lambda_expr_1(
         ext_cx.expr_method_call(
             span,
             ext_cx.expr_var(span, ~"__d"),
             ext_cx.ident_of(~"read_enum_variant"),
             ~[expr_arm_names, expr_lambda]
-        )
+        ),
+        ext_cx.ident_of(~"__d")
     );
 
     // ast for `__d.read_enum($(e_name), $(expr_lambda))`
@@ -1256,105 +1310,147 @@ mod test {
     }
 
     impl Encoder for TestEncoder {
-        fn emit_nil(&self) { self.add_to_log(CallToEmitNil) }
+        fn emit_nil(&mut self) { self.add_to_log(CallToEmitNil) }
 
-        fn emit_uint(&self, v: uint) {self.add_to_log(CallToEmitUint(v)); }
-        fn emit_u64(&self, _v: u64) { self.add_unknown_to_log(); }
-        fn emit_u32(&self, _v: u32) { self.add_unknown_to_log(); }
-        fn emit_u16(&self, _v: u16) { self.add_unknown_to_log(); }
-        fn emit_u8(&self, _v: u8)   { self.add_unknown_to_log(); }
+        fn emit_uint(&mut self, v: uint) {
+            self.add_to_log(CallToEmitUint(v));
+        }
+        fn emit_u64(&mut self, _v: u64) { self.add_unknown_to_log(); }
+        fn emit_u32(&mut self, _v: u32) { self.add_unknown_to_log(); }
+        fn emit_u16(&mut self, _v: u16) { self.add_unknown_to_log(); }
+        fn emit_u8(&mut self, _v: u8)   { self.add_unknown_to_log(); }
 
-        fn emit_int(&self, _v: int) { self.add_unknown_to_log(); }
-        fn emit_i64(&self, _v: i64) { self.add_unknown_to_log(); }
-        fn emit_i32(&self, _v: i32) { self.add_unknown_to_log(); }
-        fn emit_i16(&self, _v: i16) { self.add_unknown_to_log(); }
-        fn emit_i8(&self, _v: i8)   { self.add_unknown_to_log(); }
+        fn emit_int(&mut self, _v: int) { self.add_unknown_to_log(); }
+        fn emit_i64(&mut self, _v: i64) { self.add_unknown_to_log(); }
+        fn emit_i32(&mut self, _v: i32) { self.add_unknown_to_log(); }
+        fn emit_i16(&mut self, _v: i16) { self.add_unknown_to_log(); }
+        fn emit_i8(&mut self, _v: i8)   { self.add_unknown_to_log(); }
 
-        fn emit_bool(&self, _v: bool) { self.add_unknown_to_log(); }
+        fn emit_bool(&mut self, _v: bool) { self.add_unknown_to_log(); }
 
-        fn emit_f64(&self, _v: f64) { self.add_unknown_to_log(); }
-        fn emit_f32(&self, _v: f32) { self.add_unknown_to_log(); }
-        fn emit_float(&self, _v: float) { self.add_unknown_to_log(); }
+        fn emit_f64(&mut self, _v: f64) { self.add_unknown_to_log(); }
+        fn emit_f32(&mut self, _v: f32) { self.add_unknown_to_log(); }
+        fn emit_float(&mut self, _v: float) { self.add_unknown_to_log(); }
 
-        fn emit_char(&self, _v: char) { self.add_unknown_to_log(); }
-        fn emit_str(&self, _v: &str) { self.add_unknown_to_log(); }
+        fn emit_char(&mut self, _v: char) { self.add_unknown_to_log(); }
+        fn emit_str(&mut self, _v: &str) { self.add_unknown_to_log(); }
 
-        fn emit_enum(&self, name: &str, f: &fn()) {
-            self.add_to_log(CallToEmitEnum(name.to_str())); f(); }
+        fn emit_enum(&mut self, name: &str, f: &fn(&mut TestEncoder)) {
+            self.add_to_log(CallToEmitEnum(name.to_str()));
+            f(self);
+        }
 
-        fn emit_enum_variant(&self, name: &str, id: uint,
-                             cnt: uint, f: &fn()) {
-            self.add_to_log(CallToEmitEnumVariant (name.to_str(),id,cnt));
-            f();
+        fn emit_enum_variant(&mut self,
+                             name: &str,
+                             id: uint,
+                             cnt: uint,
+                             f: &fn(&mut TestEncoder)) {
+            self.add_to_log(CallToEmitEnumVariant(name.to_str(), id, cnt));
+            f(self);
         }
 
-        fn emit_enum_variant_arg(&self, idx: uint, f: &fn()) {
-            self.add_to_log(CallToEmitEnumVariantArg (idx)); f();
+        fn emit_enum_variant_arg(&mut self,
+                                 idx: uint,
+                                 f: &fn(&mut TestEncoder)) {
+            self.add_to_log(CallToEmitEnumVariantArg(idx));
+            f(self);
         }
 
-        fn emit_enum_struct_variant(&self, name: &str, id: uint, cnt: uint, f: &fn()) {
+        fn emit_enum_struct_variant(&mut self,
+                                    name: &str,
+                                    id: uint,
+                                    cnt: uint,
+                                    f: &fn(&mut TestEncoder)) {
             self.emit_enum_variant(name, id, cnt, f)
         }
 
-        fn emit_enum_struct_variant_field(&self, _name: &str, idx: uint, f: &fn()) {
+        fn emit_enum_struct_variant_field(&mut self,
+                                          _name: &str,
+                                          idx: uint,
+                                          f: &fn(&mut TestEncoder)) {
             self.emit_enum_variant_arg(idx, f)
         }
 
-        fn emit_struct(&self, name: &str, len: uint, f: &fn()) {
-            self.add_to_log(CallToEmitStruct (name.to_str(),len)); f();
+        fn emit_struct(&mut self,
+                       name: &str,
+                       len: uint,
+                       f: &fn(&mut TestEncoder)) {
+            self.add_to_log(CallToEmitStruct (name.to_str(),len));
+            f(self);
         }
-        fn emit_struct_field(&self, name: &str, idx: uint, f: &fn()) {
-            self.add_to_log(CallToEmitField (name.to_str(),idx)); f();
+        fn emit_struct_field(&mut self,
+                             name: &str,
+                             idx: uint,
+                             f: &fn(&mut TestEncoder)) {
+            self.add_to_log(CallToEmitField (name.to_str(),idx));
+            f(self);
         }
 
-        fn emit_tuple(&self, _len: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_tuple(&mut self, _len: uint, f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
-        fn emit_tuple_arg(&self, _idx: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_tuple_arg(&mut self, _idx: uint, f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
 
-        fn emit_tuple_struct(&self, _name: &str, _len: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_tuple_struct(&mut self,
+                             _name: &str,
+                             _len: uint,
+                             f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
-        fn emit_tuple_struct_arg(&self, _idx: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+
+        fn emit_tuple_struct_arg(&mut self,
+                                 _idx: uint,
+                                 f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
 
-        fn emit_option(&self, f: &fn()) {
+        fn emit_option(&mut self, f: &fn(&mut TestEncoder)) {
             self.add_to_log(CallToEmitOption);
-            f();
+            f(self);
         }
-        fn emit_option_none(&self) {
+        fn emit_option_none(&mut self) {
             self.add_to_log(CallToEmitOptionNone);
         }
-        fn emit_option_some(&self, f: &fn()) {
+        fn emit_option_some(&mut self, f: &fn(&mut TestEncoder)) {
             self.add_to_log(CallToEmitOptionSome);
-            f();
+            f(self);
         }
 
-        fn emit_seq(&self, _len: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_seq(&mut self, _len: uint, f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
-        fn emit_seq_elt(&self, _idx: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_seq_elt(&mut self, _idx: uint, f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
 
-        fn emit_map(&self, _len: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_map(&mut self, _len: uint, f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
-        fn emit_map_elt_key(&self, _idx: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_map_elt_key(&mut self, _idx: uint, f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
-        fn emit_map_elt_val(&self, _idx: uint, f: &fn()) {
-            self.add_unknown_to_log(); f();
+        fn emit_map_elt_val(&mut self, _idx: uint, f: &fn(&mut TestEncoder)) {
+            self.add_unknown_to_log();
+            f(self);
         }
     }
 
 
     fn to_call_log<E:Encodable<TestEncoder>>(val: E) -> ~[call] {
-        let mut te = TestEncoder {call_log: @mut ~[]};
-        val.encode(&te);
+        let mut te = TestEncoder {
+            call_log: @mut ~[]
+        };
+        val.encode(&mut te);
         copy *te.call_log
     }
 
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 7d058f22e4c..da8f87d3891 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -348,7 +348,7 @@ pub fn expr_to_str(cx: @ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
 
 pub fn expr_to_ident(cx: @ext_ctxt,
                      expr: @ast::expr,
-                     err_msg: ~str) -> ast::ident {
+                     err_msg: &str) -> ast::ident {
     match expr.node {
       ast::expr_path(p) => {
         if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
@@ -538,13 +538,3 @@ mod test {
         assert_eq!(*(m.find(&@~"def").get()),16);
     }
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs
index 48f6d5baa8b..fe270abc2e4 100644
--- a/src/libsyntax/ext/deriving/decodable.rs
+++ b/src/libsyntax/ext/deriving/decodable.rs
@@ -96,7 +96,7 @@ fn create_decode_method(
         cx,
         span,
         build::mk_simple_ty_path(cx, span, cx.ident_of(~"__D")),
-        ast::m_imm
+        ast::m_mutbl
     );
     let d_ident = cx.ident_of(~"__d");
     let d_arg = build::mk_arg(cx, span, d_ident, d_arg_type);
@@ -219,6 +219,11 @@ fn create_read_struct_field(
     // Call the substructure method.
     let decode_expr = call_substructure_decode_method(cx, span);
 
+    let d_arg = build::mk_arg(cx,
+                              span,
+                              cx.ident_of(~"__d"),
+                              build::mk_ty_infer(cx, span));
+
     let call_expr = build::mk_method_call(
         cx,
         span,
@@ -227,7 +232,11 @@ fn create_read_struct_field(
         ~[
             build::mk_base_str(cx, span, cx.str_of(ident)),
             build::mk_uint(cx, span, idx),
-            build::mk_lambda_no_args(cx, span, decode_expr),
+            build::mk_lambda(cx,
+                             span,
+                             build::mk_fn_decl(~[d_arg],
+                                               build::mk_ty_infer(cx, span)),
+                             decode_expr),
         ]
     );
 
@@ -282,6 +291,11 @@ fn expand_deriving_decodable_struct_method(
         i += 1;
     }
 
+    let d_arg = build::mk_arg(cx,
+                              span,
+                              cx.ident_of(~"__d"),
+                              build::mk_ty_infer(cx, span));
+
     let read_struct_expr = build::mk_method_call(
         cx,
         span,
@@ -294,9 +308,10 @@ fn expand_deriving_decodable_struct_method(
         ~[
             build::mk_base_str(cx, span, cx.str_of(type_ident)),
             build::mk_uint(cx, span, fields.len()),
-            build::mk_lambda_no_args(
+            build::mk_lambda(
                 cx,
                 span,
+                build::mk_fn_decl(~[d_arg], build::mk_ty_infer(cx, span)),
                 build::mk_struct_e(
                     cx,
                     span,
@@ -334,6 +349,12 @@ fn create_read_variant_arg(
             // Call the substructure method.
             let expr = call_substructure_decode_method(cx, span);
 
+            let d_arg = build::mk_arg(cx,
+                                      span,
+                                      cx.ident_of(~"__d"),
+                                      build::mk_ty_infer(cx, span));
+            let t_infer = build::mk_ty_infer(cx, span);
+
             let call_expr = build::mk_method_call(
                 cx,
                 span,
@@ -341,7 +362,10 @@ fn create_read_variant_arg(
                 cx.ident_of(~"read_enum_variant_arg"),
                 ~[
                     build::mk_uint(cx, span, j),
-                    build::mk_lambda_no_args(cx, span, expr),
+                    build::mk_lambda(cx,
+                                     span,
+                                     build::mk_fn_decl(~[d_arg], t_infer),
+                                     expr),
                 ]
             );
 
@@ -402,6 +426,12 @@ fn create_read_enum_variant(
                         build::mk_arg(
                             cx,
                             span,
+                            cx.ident_of(~"__d"),
+                            build::mk_ty_infer(cx, span)
+                        ),
+                        build::mk_arg(
+                            cx,
+                            span,
                             cx.ident_of(~"__i"),
                             build::mk_ty_infer(cx, span)
                         )
@@ -434,6 +464,11 @@ fn expand_deriving_decodable_enum_method(
         enum_definition
     );
 
+    let d_arg = build::mk_arg(cx,
+                              span,
+                              cx.ident_of(~"__d"),
+                              build::mk_ty_infer(cx, span));
+
     // Create the read_enum expression
     let read_enum_expr = build::mk_method_call(
         cx,
@@ -442,7 +477,11 @@ fn expand_deriving_decodable_enum_method(
         cx.ident_of(~"read_enum"),
         ~[
             build::mk_base_str(cx, span, cx.str_of(type_ident)),
-            build::mk_lambda_no_args(cx, span, read_enum_variant_expr),
+            build::mk_lambda(cx,
+                             span,
+                             build::mk_fn_decl(~[d_arg],
+                                               build::mk_ty_infer(cx, span)),
+                             read_enum_variant_expr),
         ]
     );
 
diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs
index 640d0d0ff2d..8f8139790ad 100644
--- a/src/libsyntax/ext/deriving/encodable.rs
+++ b/src/libsyntax/ext/deriving/encodable.rs
@@ -94,10 +94,9 @@ fn create_encode_method(
         cx,
         span,
         build::mk_simple_ty_path(cx, span, cx.ident_of(~"__E")),
-        ast::m_imm
+        ast::m_mutbl
     );
-    let e_ident = cx.ident_of(~"__e");
-    let e_arg = build::mk_arg(cx, span, e_ident, e_arg_type);
+    let e_arg = build::mk_arg(cx, span, cx.ident_of(~"__e"), e_arg_type);
 
     // Create the type of the return value.
     let output_type = @ast::Ty { id: cx.next_id(), node: ty_nil, span: span };
@@ -226,10 +225,16 @@ fn expand_deriving_encodable_struct_method(
                     self_field
                 );
 
+                let e_ident = cx.ident_of(~"__e");
+                let e_arg = build::mk_arg(cx,
+                                          span,
+                                          e_ident,
+                                          build::mk_ty_infer(cx, span));
+
                 let blk_expr = build::mk_lambda(
                     cx,
                     span,
-                    build::mk_fn_decl(~[], build::mk_ty_infer(cx, span)),
+                    build::mk_fn_decl(~[e_arg], build::mk_ty_infer(cx, span)),
                     encode_expr
                 );
 
@@ -257,6 +262,11 @@ fn expand_deriving_encodable_struct_method(
         idx += 1;
     }
 
+    let e_arg = build::mk_arg(cx,
+                              span,
+                              cx.ident_of(~"__e"),
+                              build::mk_ty_infer(cx, span));
+
     let emit_struct_stmt = build::mk_method_call(
         cx,
         span,
@@ -272,7 +282,7 @@ fn expand_deriving_encodable_struct_method(
             build::mk_lambda_stmts(
                 cx,
                 span,
-                build::mk_fn_decl(~[], build::mk_ty_infer(cx, span)),
+                build::mk_fn_decl(~[e_arg], build::mk_ty_infer(cx, span)),
                 statements
             ),
         ]
@@ -309,10 +319,16 @@ fn expand_deriving_encodable_enum_method(
             // Call the substructure method.
             let expr = call_substructure_encode_method(cx, span, field);
 
+            let e_ident = cx.ident_of(~"__e");
+            let e_arg = build::mk_arg(cx,
+                                      span,
+                                      e_ident,
+                                      build::mk_ty_infer(cx, span));
+
             let blk_expr = build::mk_lambda(
                 cx,
                 span,
-                build::mk_fn_decl(~[], build::mk_ty_infer(cx, span)),
+                build::mk_fn_decl(~[e_arg], build::mk_ty_infer(cx, span)),
                 expr
             );
 
@@ -331,6 +347,10 @@ fn expand_deriving_encodable_enum_method(
         }
 
         // Create the pattern body.
+        let e_arg = build::mk_arg(cx,
+                                  span,
+                                  cx.ident_of(~"__e"),
+                                  build::mk_ty_infer(cx, span));
         let call_expr = build::mk_method_call(
             cx,
             span,
@@ -343,7 +363,7 @@ fn expand_deriving_encodable_enum_method(
                 build::mk_lambda_stmts(
                     cx,
                     span,
-                    build::mk_fn_decl(~[], build::mk_ty_infer(cx, span)),
+                    build::mk_fn_decl(~[e_arg], build::mk_ty_infer(cx, span)),
                     stmts
                 )
             ]
@@ -359,11 +379,17 @@ fn expand_deriving_encodable_enum_method(
         }
     };
 
+    let e_ident = cx.ident_of(~"__e");
+    let e_arg = build::mk_arg(cx,
+                              span,
+                              e_ident,
+                              build::mk_ty_infer(cx, span));
+
     // Create the method body.
     let lambda_expr = build::mk_lambda(
         cx,
         span,
-        build::mk_fn_decl(~[], build::mk_ty_infer(cx, span)),
+        build::mk_fn_decl(~[e_arg], build::mk_ty_infer(cx, span)),
         expand_enum_or_struct_match(cx, span, arms)
     );
 
diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs
index 5e5fd7d97b1..5b1e3737b23 100644
--- a/src/libsyntax/ext/env.rs
+++ b/src/libsyntax/ext/env.rs
@@ -34,13 +34,3 @@ pub fn expand_syntax_ext(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     };
     MRExpr(e)
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 841f64e0b05..965d95789c4 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -490,7 +490,7 @@ pub fn core_macros() -> ~str {
 
         { $c:ident: $in:ty -> $out:ty; } => {
 
-            mod $c {
+            pub mod $c {
                 fn key(_x: @::core::condition::Handler<$in,$out>) { }
 
                 pub static cond :
@@ -724,11 +724,3 @@ mod test {
     }
 
 }
-
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 9bbe617eb07..e9eebe5b2ac 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -273,15 +273,13 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
         match pc {
             /* Raw strings get appended via str::push_str */
             PieceString(s) => {
-                let portion = mk_uniq_str(cx, fmt_sp, s);
-
                 /* If this is the first portion, then initialize the local
                    buffer with it directly. If it's actually the only piece,
                    then there's no need for it to be mutable */
                 if i == 0 {
-                    stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, portion));
+                    stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, mk_uniq_str(cx, fmt_sp, s)));
                 } else {
-                    let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), portion];
+                    let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), mk_base_str(cx, fmt_sp, s)];
                     let call = mk_call_global(cx,
                                               fmt_sp,
                                               ~[str_ident, push_ident],
@@ -322,12 +320,3 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
 
     return mk_block(cx, fmt_sp, ~[], stms, Some(buf()));
 }
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs
index c2c0c06342b..38e43d1ade5 100644
--- a/src/libsyntax/ext/pipes/check.rs
+++ b/src/libsyntax/ext/pipes/check.rs
@@ -80,4 +80,3 @@ impl proto::visitor<(), (), ()> for @ext_ctxt {
         }
     }
 }
-
diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs
index 7843db55789..bd5353b2100 100644
--- a/src/libsyntax/ext/pipes/liveness.rs
+++ b/src/libsyntax/ext/pipes/liveness.rs
@@ -104,4 +104,3 @@ pub fn analyze(proto: &mut protocol_, _cx: @ext_ctxt) {
         proto.bounded = Some(true);
     }
 }
-
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index 81b2442ea82..85c578bc2ce 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -85,4 +85,3 @@ pub fn expand_proto(cx: @ext_ctxt, _sp: span, id: ast::ident,
     // compile
     base::MRItem(proto.compile(cx))
 }
-
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 3311c61de8b..e876972fe68 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -415,7 +415,8 @@ impl gen_init for protocol {
                             ast::struct_immutable,
                             ast::inherited),
                     id: cx.next_id(),
-                    ty: fty
+                    ty: fty,
+                    attrs: ~[],
                 },
                 span: dummy_sp()
             }
@@ -431,7 +432,6 @@ impl gen_init for protocol {
             dummy_sp(),
             ast::struct_def {
                 fields: fields,
-                dtor: None,
                 ctor_id: None
             },
             cx.strip_bounds(&generics))
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index ffb55ee50d9..647c7741bd8 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -217,4 +217,3 @@ pub fn visit<Tproto, Tstate, Tmessage, V: visitor<Tproto, Tstate, Tmessage>>(
     };
     visitor.visit_proto(proto, states)
 }
-
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index f7412a4502c..2bf4b05aa6b 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -760,4 +760,3 @@ fn expand_parse_call(cx: @ext_ctxt,
                           id_ext(cx, parse_method),
                           arg_exprs)
 }
-
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 70aa9472c85..ab22b3152f4 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -150,13 +150,3 @@ fn res_rel_file(cx: @ext_ctxt, sp: codemap::span, arg: &Path) -> Path {
         copy *arg
     }
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index e4e033e0fff..0c1e619985d 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -438,11 +438,3 @@ pub fn parse_nt(p: &Parser, name: ~str) -> nonterminal {
       _ => p.fatal(~"Unsupported builtin nonterminal parser: " + name)
     }
 }
-
-// Local Variables:
-// mode: rust;
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index d82608846ab..229a8664d0c 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -222,9 +222,12 @@ pub fn noop_fold_item(i: @item, fld: @ast_fold) -> Option<@item> {
 
 fn noop_fold_struct_field(sf: @struct_field, fld: @ast_fold)
                        -> @struct_field {
+    let fold_attribute = |x| fold_attribute_(x, fld);
+
     @spanned { node: ast::struct_field_ { kind: copy sf.node.kind,
                                           id: sf.node.id,
-                                          ty: fld.fold_ty(sf.node.ty) },
+                                          ty: fld.fold_ty(sf.node.ty),
+                                          attrs: sf.node.attrs.map(|e| fold_attribute(*e)) },
                span: sf.span }
 }
 
@@ -290,21 +293,8 @@ pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ {
 
 fn fold_struct_def(struct_def: @ast::struct_def, fld: @ast_fold)
                 -> @ast::struct_def {
-    let dtor = do struct_def.dtor.map |dtor| {
-        let dtor_body = fld.fold_block(&dtor.node.body);
-        let dtor_id   = fld.new_id(dtor.node.id);
-        spanned {
-            node: ast::struct_dtor_ {
-                body: dtor_body,
-                id: dtor_id,
-                .. copy dtor.node
-            },
-            span: copy dtor.span
-        }
-    };
     @ast::struct_def {
         fields: struct_def.fields.map(|f| fold_struct_field(*f, fld)),
-        dtor: dtor,
         ctor_id: struct_def.ctor_id.map(|cid| fld.new_id(*cid)),
     }
 }
@@ -322,6 +312,7 @@ fn fold_struct_field(f: @struct_field, fld: @ast_fold) -> @struct_field {
             kind: copy f.node.kind,
             id: fld.new_id(f.node.id),
             ty: fld.fold_ty(f.node.ty),
+            attrs: /* FIXME (#2543) */ copy f.node.attrs,
         },
         span: fld.new_span(f.span),
     }
@@ -655,22 +646,9 @@ fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ {
             })
         }
         struct_variant_kind(struct_def) => {
-            let dtor = do struct_def.dtor.map |dtor| {
-                let dtor_body = fld.fold_block(&dtor.node.body);
-                let dtor_id   = fld.new_id(dtor.node.id);
-                spanned {
-                    node: ast::struct_dtor_ {
-                        body: dtor_body,
-                        id: dtor_id,
-                        .. copy dtor.node
-                    },
-                    .. copy *dtor
-                }
-            };
             kind = struct_variant_kind(@ast::struct_def {
                 fields: vec::map(struct_def.fields,
                                  |f| fld.fold_struct_field(*f)),
-                dtor: dtor,
                 ctor_id: struct_def.ctor_id.map(|c| fld.new_id(*c))
             })
         }
@@ -783,6 +761,7 @@ impl ast_fold for AstFoldFns {
                 kind: copy sf.node.kind,
                 id: sf.node.id,
                 ty: (self as @ast_fold).fold_ty(sf.node.ty),
+                attrs: copy sf.node.attrs,
             },
             span: (self.new_span)(sf.span),
         }
@@ -880,13 +859,3 @@ impl AstFoldExtensions for @ast_fold {
 pub fn make_fold(afp: ast_fold_fns) -> @ast_fold {
     afp as @ast_fold
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index cc580155d70..037b2c089f4 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -179,13 +179,3 @@ impl parser_attr for Parser {
         }
     }
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index 163c7852132..8956622a06b 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -892,13 +892,3 @@ mod test {
         assert_eq!(tok, token::LIFETIME(id));
     }
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 5d51a54d770..0c024958a24 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -418,9 +418,10 @@ mod test {
         new_parser_from_source_str(ps,~[],~"bogofile",source_str)
     }
 
-    #[test] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str {
+    #[cfg(test)] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str {
         do io::with_str_writer |writer| {
-            val.encode(~std::json::Encoder(writer));
+            let mut encoder = std::json::Encoder(writer);
+            val.encode(&mut encoder);
         }
     }
 
@@ -674,13 +675,3 @@ mod test {
         string_to_expr(@~"a::z.froob(b,@(987+3))");
     }
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index ce21e0f672d..e486a6254e7 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -18,7 +18,7 @@ removed.
 */
 
 
-use ast::{expr, expr_lit, lit_nil};
+use ast::{expr, expr_lit, lit_nil, attribute};
 use ast;
 use codemap::{span, respan};
 use parse::parser::Parser;
@@ -282,13 +282,13 @@ pub impl Parser {
         }
     }
 
-    fn try_parse_obsolete_priv_section(&self) -> bool {
+    fn try_parse_obsolete_priv_section(&self, attrs: ~[attribute]) -> bool {
         if self.is_keyword(&~"priv") && self.look_ahead(1) == token::LBRACE {
             self.obsolete(copy *self.span, ObsoletePrivSection);
             self.eat_keyword(&~"priv");
             self.bump();
             while *self.token != token::RBRACE {
-                self.parse_single_struct_field(ast::private);
+                self.parse_single_struct_field(ast::private, attrs);
             }
             self.bump();
             true
@@ -298,4 +298,3 @@ pub impl Parser {
     }
 
 }
-
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 457c6df8db2..4839b179723 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -19,7 +19,7 @@ use ast::{_mod, add, arg, arm, attribute, bind_by_ref, bind_infer};
 use ast::{bind_by_copy, bitand, bitor, bitxor, blk};
 use ast::{blk_check_mode, box};
 use ast::{crate, crate_cfg, decl, decl_item};
-use ast::{decl_local, default_blk, deref, quot, enum_def};
+use ast::{decl_local, default_blk, deref, div, enum_def};
 use ast::{expr, expr_, expr_addr_of, expr_match, expr_again};
 use ast::{expr_assign, expr_assign_op, expr_binary, expr_block};
 use ast::{expr_break, expr_call, expr_cast, expr_copy, expr_do_body};
@@ -102,11 +102,6 @@ enum restriction {
     RESTRICT_NO_BAR_OR_DOUBLEBAR_OP,
 }
 
-//  So that we can distinguish a class dtor from other class members
-
-enum class_contents { dtor_decl(blk, ~[attribute], codemap::span),
-                      members(~[@struct_field]) }
-
 type arg_or_capture_item = Either<arg, ()>;
 type item_info = (ident, item_, Option<~[attribute]>);
 
@@ -313,22 +308,22 @@ pub impl Parser {
         }
         return copy self.buffer[(*self.buffer_start + dist - 1) & 3].tok;
     }
-    fn fatal(&self, m: ~str) -> ! {
+    fn fatal(&self, m: &str) -> ! {
         self.sess.span_diagnostic.span_fatal(*copy self.span, m)
     }
-    fn span_fatal(&self, sp: span, m: ~str) -> ! {
+    fn span_fatal(&self, sp: span, m: &str) -> ! {
         self.sess.span_diagnostic.span_fatal(sp, m)
     }
-    fn span_note(&self, sp: span, m: ~str) {
+    fn span_note(&self, sp: span, m: &str) {
         self.sess.span_diagnostic.span_note(sp, m)
     }
-    fn bug(&self, m: ~str) -> ! {
+    fn bug(&self, m: &str) -> ! {
         self.sess.span_diagnostic.span_bug(*copy self.span, m)
     }
-    fn warn(&self, m: ~str) {
+    fn warn(&self, m: &str) {
         self.sess.span_diagnostic.span_warn(*copy self.span, m)
     }
-    fn span_err(&self, sp: span, m: ~str) {
+    fn span_err(&self, sp: span, m: &str) {
         self.sess.span_diagnostic.span_err(sp, m)
     }
     fn abort_if_errors(&self) {
@@ -937,7 +932,7 @@ pub impl Parser {
         loop {
             match *self.token {
                 token::MOD_SEP => {
-                    match self.look_ahead(1u) {
+                    match self.look_ahead(1) {
                         token::IDENT(*) => {
                             self.bump();
                             ids.push(self.parse_ident());
@@ -1836,7 +1831,7 @@ pub impl Parser {
                   token::PLUS => aop = add,
                   token::MINUS => aop = subtract,
                   token::STAR => aop = mul,
-                  token::SLASH => aop = quot,
+                  token::SLASH => aop = div,
                   token::PERCENT => aop = rem,
                   token::CARET => aop = bitxor,
                   token::AND => aop = bitand,
@@ -2034,8 +2029,7 @@ pub impl Parser {
             // This is a 'continue' expression
             if opt_ident.is_some() {
                 self.span_err(*self.last_span,
-                              ~"a label may not be used with a `loop` \
-                                expression");
+                              "a label may not be used with a `loop` expression");
             }
 
             let lo = self.span.lo;
@@ -2172,7 +2166,7 @@ pub impl Parser {
                     @ast::pat { node: pat_wild, _ } => (),
                     @ast::pat { node: pat_ident(_, _, _), _ } => (),
                     @ast::pat { span, _ } => self.span_fatal(
-                        span, ~"expected an identifier or `_`"
+                        span, "expected an identifier or `_`"
                     )
                 }
                 slice = Some(subpat);
@@ -2464,7 +2458,7 @@ pub impl Parser {
                        -> ast::pat_ {
         if !is_plain_ident(&*self.token) {
             self.span_fatal(*self.last_span,
-                            ~"expected identifier, found path");
+                            "expected identifier, found path");
         }
         // why a path here, and not just an identifier?
         let name = self.parse_path_without_tps();
@@ -2483,7 +2477,7 @@ pub impl Parser {
         if *self.token == token::LPAREN {
             self.span_fatal(
                 *self.last_span,
-                ~"expected identifier, found enum pattern");
+                "expected identifier, found enum pattern");
         }
 
         pat_ident(binding_mode, name, sub)
@@ -2525,7 +2519,9 @@ pub impl Parser {
     }
 
     // parse a structure field
-    fn parse_name_and_ty(&self, pr: visibility) -> @struct_field {
+    fn parse_name_and_ty(&self,
+                         pr: visibility,
+                         attrs: ~[attribute]) -> @struct_field {
         let mut is_mutbl = struct_immutable;
         let lo = self.span.lo;
         if self.eat_keyword(&~"mut") {
@@ -2540,7 +2536,8 @@ pub impl Parser {
         @spanned(lo, self.last_span.hi, ast::struct_field_ {
             kind: named_field(name, is_mutbl, pr),
             id: self.get_id(),
-            ty: ty
+            ty: ty,
+            attrs: attrs,
         })
     }
 
@@ -2611,19 +2608,19 @@ pub impl Parser {
 
             match self.parse_item_or_view_item(/*bad*/ copy item_attrs,
                                                            false) {
-              iovi_item(i) => {
-                let hi = i.span.hi;
-                let decl = @spanned(lo, hi, decl_item(i));
-                return @spanned(lo, hi, stmt_decl(decl, self.get_id()));
-              }
-              iovi_view_item(vi) => {
-                self.span_fatal(vi.span, ~"view items must be declared at \
-                                           the top of the block");
-              }
-              iovi_foreign_item(_) => {
-                  self.fatal(~"foreign items are not allowed here");
-              }
-              iovi_none() => { /* fallthrough */ }
+                iovi_item(i) => {
+                    let hi = i.span.hi;
+                    let decl = @spanned(lo, hi, decl_item(i));
+                    return @spanned(lo, hi, stmt_decl(decl, self.get_id()));
+                }
+                iovi_view_item(vi) => {
+                    self.span_fatal(vi.span,
+                                    "view items must be declared at the top of the block");
+                }
+                iovi_foreign_item(_) => {
+                    self.fatal(~"foreign items are not allowed here");
+                }
+                iovi_none() => { /* fallthrough */ }
             }
 
             check_expected_item(self, item_attrs);
@@ -2824,8 +2821,7 @@ pub impl Parser {
                         result.push(RegionTyParamBound);
                     } else {
                         self.span_err(*self.span,
-                                      ~"`'static` is the only permissible \
-                                        region bound here");
+                                      "`'static` is the only permissible region bound here");
                     }
                     self.bump();
                 }
@@ -3240,7 +3236,7 @@ pub impl Parser {
                     })
                 }
                 _ => {
-                    self.span_err(*self.span, ~"not a trait");
+                    self.span_err(*self.span, "not a trait");
                     None
                 }
             };
@@ -3299,7 +3295,6 @@ pub impl Parser {
         }
 
         let mut fields: ~[@struct_field];
-        let mut the_dtor: Option<(blk, ~[attribute], codemap::span)> = None;
         let is_tuple_like;
 
         if self.eat(&token::LBRACE) {
@@ -3307,26 +3302,8 @@ pub impl Parser {
             is_tuple_like = false;
             fields = ~[];
             while *self.token != token::RBRACE {
-                match self.parse_struct_decl_field() {
-                  dtor_decl(ref blk, ref attrs, s) => {
-                      match the_dtor {
-                        Some((_, _, s_first)) => {
-                          self.span_note(s, fmt!("Duplicate destructor \
-                                     declaration for class %s",
-                                     *self.interner.get(class_name)));
-                          self.span_fatal(copy s_first, ~"First destructor \
-                                                          declared here");
-                        }
-                        None => {
-                          the_dtor = Some((copy *blk, copy *attrs, s));
-                        }
-                      }
-                  }
-                  members(mms) => {
-                    for mms.each |struct_field| {
-                        fields.push(*struct_field)
-                    }
-                  }
+                for self.parse_struct_decl_field().each |struct_field| {
+                    fields.push(*struct_field)
                 }
             }
             if fields.len() == 0 {
@@ -3342,11 +3319,13 @@ pub impl Parser {
                 &token::RPAREN,
                 seq_sep_trailing_allowed(token::COMMA)
             ) |p| {
+                let attrs = self.parse_outer_attributes();
                 let lo = p.span.lo;
                 let struct_field_ = ast::struct_field_ {
                     kind: unnamed_field,
                     id: self.get_id(),
-                    ty: p.parse_ty(false)
+                    ty: p.parse_ty(false),
+                    attrs: attrs,
                 };
                 @spanned(lo, p.span.hi, struct_field_)
             };
@@ -3365,19 +3344,11 @@ pub impl Parser {
             );
         }
 
-        let actual_dtor = do the_dtor.map |dtor| {
-            let (d_body, d_attrs, d_s) = copy *dtor;
-            codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(),
-                                                     attrs: d_attrs,
-                                                     self_id: self.get_id(),
-                                                     body: d_body},
-                       span: d_s}};
         let _ = self.get_id();  // XXX: Workaround for crazy bug.
         let new_id = self.get_id();
         (class_name,
          item_struct(@ast::struct_def {
              fields: fields,
-             dtor: actual_dtor,
              ctor_id: if is_tuple_like { Some(new_id) } else { None }
          }, generics),
          None)
@@ -3391,12 +3362,14 @@ pub impl Parser {
     }
 
     // parse a structure field declaration
-    fn parse_single_struct_field(&self, vis: visibility) -> @struct_field {
+    fn parse_single_struct_field(&self,
+                                 vis: visibility,
+                                 attrs: ~[attribute]) -> @struct_field {
         if self.eat_obsolete_ident("let") {
             self.obsolete(*self.last_span, ObsoleteLet);
         }
 
-        let a_var = self.parse_name_and_ty(vis);
+        let a_var = self.parse_name_and_ty(vis, attrs);
         match *self.token {
             token::SEMI => {
                 self.obsolete(copy *self.span, ObsoleteFieldTerminator);
@@ -3420,34 +3393,27 @@ pub impl Parser {
     }
 
     // parse an element of a struct definition
-    fn parse_struct_decl_field(&self) -> class_contents {
-
-        if self.try_parse_obsolete_priv_section() {
-            return members(~[]);
-        }
+    fn parse_struct_decl_field(&self) -> ~[@struct_field] {
 
         let attrs = self.parse_outer_attributes();
 
+        if self.try_parse_obsolete_priv_section(attrs) {
+            return ~[];
+        }
+
         if self.eat_keyword(&~"priv") {
-            return members(~[self.parse_single_struct_field(private)])
+            return ~[self.parse_single_struct_field(private, attrs)]
         }
 
         if self.eat_keyword(&~"pub") {
-           return members(~[self.parse_single_struct_field(public)]);
+           return ~[self.parse_single_struct_field(public, attrs)];
         }
 
         if self.try_parse_obsolete_struct_ctor() {
-            return members(~[]);
+            return ~[];
         }
 
-        if self.eat_keyword(&~"drop") {
-            let lo = self.last_span.lo;
-            let body = self.parse_block();
-            return dtor_decl(body, attrs, mk_sp(lo, self.last_span.hi))
-        }
-        else {
-           return members(~[self.parse_single_struct_field(inherited)]);
-        }
+        return ~[self.parse_single_struct_field(inherited, attrs)];
     }
 
     // parse visiility: PUB, PRIV, or nothing
@@ -3499,9 +3465,8 @@ pub impl Parser {
             ) {
               iovi_item(item) => items.push(item),
               iovi_view_item(view_item) => {
-                self.span_fatal(view_item.span, ~"view items must be \
-                                                  declared at the top of the \
-                                                  module");
+                self.span_fatal(view_item.span, "view items must be  declared at the top of the \
+                                                 module");
               }
               _ => {
                 self.fatal(
@@ -3793,7 +3758,7 @@ pub impl Parser {
         }
 
         if opt_abis.is_some() {
-            self.span_err(*self.span, ~"an ABI may not be specified here");
+            self.span_err(*self.span, "an ABI may not be specified here");
         }
 
         // extern mod foo;
@@ -3829,44 +3794,16 @@ pub impl Parser {
     // parse a structure-like enum variant definition
     // this should probably be renamed or refactored...
     fn parse_struct_def(&self) -> @struct_def {
-        let mut the_dtor: Option<(blk, ~[attribute], codemap::span)> = None;
         let mut fields: ~[@struct_field] = ~[];
         while *self.token != token::RBRACE {
-            match self.parse_struct_decl_field() {
-                dtor_decl(ref blk, ref attrs, s) => {
-                    match the_dtor {
-                        Some((_, _, s_first)) => {
-                            self.span_note(s, ~"duplicate destructor \
-                                                declaration");
-                            self.span_fatal(copy s_first,
-                                            ~"first destructor \
-                                              declared here");
-                        }
-                        None => {
-                            the_dtor = Some((copy *blk, copy *attrs, s));
-                        }
-                    }
-                }
-                members(mms) => {
-                    for mms.each |struct_field| {
-                        fields.push(*struct_field);
-                    }
-                }
+            for self.parse_struct_decl_field().each |struct_field| {
+                fields.push(*struct_field);
             }
         }
         self.bump();
-        let actual_dtor = do the_dtor.map |dtor| {
-            let (d_body, d_attrs, d_s) = copy *dtor;
-            codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(),
-                                                     attrs: d_attrs,
-                                                     self_id: self.get_id(),
-                                                     body: d_body },
-                      span: d_s }
-        };
 
         return @ast::struct_def {
             fields: fields,
-            dtor: actual_dtor,
             ctor_id: None
         };
     }
@@ -4456,9 +4393,7 @@ pub impl Parser {
                         view_item_extern_mod(*)
                         if !extern_mod_allowed => {
                             self.span_err(view_item.span,
-                                          ~"\"extern mod\" \
-                                            declarations are not \
-                                            allowed here");
+                                          "\"extern mod\" declarations are not allowed here");
                         }
                         view_item_extern_mod(*) => {}
                     }
@@ -4484,8 +4419,7 @@ pub impl Parser {
                     iovi_none => break,
                     iovi_view_item(view_item) => {
                         self.span_err(view_item.span,
-                                      ~"`use` and `extern mod` declarations \
-                                        must precede items");
+                                      "`use` and `extern mod` declarations must precede items");
                     }
                     iovi_item(item) => {
                         items.push(item)
@@ -4520,8 +4454,7 @@ pub impl Parser {
                 iovi_view_item(view_item) => {
                     // I think this can't occur:
                     self.span_err(view_item.span,
-                                  ~"`use` and `extern mod` declarations \
-                                    must precede items");
+                                  "`use` and `extern mod` declarations must precede items");
                 }
                 iovi_item(_) => {
                     // FIXME #5668: this will occur for a macro invocation:
@@ -4568,14 +4501,3 @@ pub impl Parser {
         }
     }
 }
-
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 0327a3b80da..fe7bd5b3bc1 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -305,50 +305,47 @@ pub fn is_bar(t: &Token) -> bool {
 pub mod special_idents {
     use ast::ident;
 
-    pub static underscore : ident = ident { repr: 0u, ctxt: 0};
-    pub static anon : ident = ident { repr: 1u, ctxt: 0};
-    pub static dtor : ident = ident { repr: 2u, ctxt: 0}; // 'drop', but that's
-                                                 // reserved
-    pub static invalid : ident = ident { repr: 3u, ctxt: 0}; // ''
-    pub static unary : ident = ident { repr: 4u, ctxt: 0};
-    pub static not_fn : ident = ident { repr: 5u, ctxt: 0};
-    pub static idx_fn : ident = ident { repr: 6u, ctxt: 0};
-    pub static unary_minus_fn : ident = ident { repr: 7u, ctxt: 0};
-    pub static clownshoes_extensions : ident = ident { repr: 8u, ctxt: 0};
-
-    pub static self_ : ident = ident { repr: 9u, ctxt: 0}; // 'self'
+    pub static underscore : ident = ident { repr: 0, ctxt: 0};
+    pub static anon : ident = ident { repr: 1, ctxt: 0};
+    pub static invalid : ident = ident { repr: 2, ctxt: 0}; // ''
+    pub static unary : ident = ident { repr: 3, ctxt: 0};
+    pub static not_fn : ident = ident { repr: 4, ctxt: 0};
+    pub static idx_fn : ident = ident { repr: 5, ctxt: 0};
+    pub static unary_minus_fn : ident = ident { repr: 6, ctxt: 0};
+    pub static clownshoes_extensions : ident = ident { repr: 7, ctxt: 0};
+
+    pub static self_ : ident = ident { repr: 8, ctxt: 0}; // 'self'
 
     /* for matcher NTs */
-    pub static item : ident = ident { repr: 10u, ctxt: 0};
-    pub static block : ident = ident { repr: 11u, ctxt: 0};
-    pub static stmt : ident = ident { repr: 12u, ctxt: 0};
-    pub static pat : ident = ident { repr: 13u, ctxt: 0};
-    pub static expr : ident = ident { repr: 14u, ctxt: 0};
-    pub static ty : ident = ident { repr: 15u, ctxt: 0};
-    pub static ident : ident = ident { repr: 16u, ctxt: 0};
-    pub static path : ident = ident { repr: 17u, ctxt: 0};
-    pub static tt : ident = ident { repr: 18u, ctxt: 0};
-    pub static matchers : ident = ident { repr: 19u, ctxt: 0};
-
-    pub static str : ident = ident { repr: 20u, ctxt: 0}; // for the type
+    pub static item : ident = ident { repr: 9, ctxt: 0};
+    pub static block : ident = ident { repr: 10, ctxt: 0};
+    pub static stmt : ident = ident { repr: 11, ctxt: 0};
+    pub static pat : ident = ident { repr: 12, ctxt: 0};
+    pub static expr : ident = ident { repr: 13, ctxt: 0};
+    pub static ty : ident = ident { repr: 14, ctxt: 0};
+    pub static ident : ident = ident { repr: 15, ctxt: 0};
+    pub static path : ident = ident { repr: 16, ctxt: 0};
+    pub static tt : ident = ident { repr: 17, ctxt: 0};
+    pub static matchers : ident = ident { repr: 18, ctxt: 0};
+
+    pub static str : ident = ident { repr: 19, ctxt: 0}; // for the type
 
     /* outside of libsyntax */
-    pub static ty_visitor : ident = ident { repr: 21u, ctxt: 0};
-    pub static arg : ident = ident { repr: 22u, ctxt: 0};
-    pub static descrim : ident = ident { repr: 23u, ctxt: 0};
-    pub static clownshoe_abi : ident = ident { repr: 24u, ctxt: 0};
-    pub static clownshoe_stack_shim : ident = ident { repr: 25u, ctxt: 0};
-    pub static tydesc : ident = ident { repr: 26u, ctxt: 0};
-    pub static literally_dtor : ident = ident { repr: 27u, ctxt: 0};
-    pub static main : ident = ident { repr: 28u, ctxt: 0};
-    pub static opaque : ident = ident { repr: 29u, ctxt: 0};
-    pub static blk : ident = ident { repr: 30u, ctxt: 0};
-    pub static static : ident = ident { repr: 31u, ctxt: 0};
-    pub static intrinsic : ident = ident { repr: 32u, ctxt: 0};
-    pub static clownshoes_foreign_mod: ident = ident { repr: 33u, ctxt: 0};
-    pub static unnamed_field: ident = ident { repr: 34u, ctxt: 0};
-    pub static c_abi: ident = ident { repr: 35u, ctxt: 0};
-    pub static type_self: ident = ident { repr: 36u, ctxt: 0};    // `Self`
+    pub static ty_visitor : ident = ident { repr: 20, ctxt: 0};
+    pub static arg : ident = ident { repr: 21, ctxt: 0};
+    pub static descrim : ident = ident { repr: 22, ctxt: 0};
+    pub static clownshoe_abi : ident = ident { repr: 23, ctxt: 0};
+    pub static clownshoe_stack_shim : ident = ident { repr: 24, ctxt: 0};
+    pub static tydesc : ident = ident { repr: 25, ctxt: 0};
+    pub static main : ident = ident { repr: 26, ctxt: 0};
+    pub static opaque : ident = ident { repr: 27, ctxt: 0};
+    pub static blk : ident = ident { repr: 28, ctxt: 0};
+    pub static static : ident = ident { repr: 29, ctxt: 0};
+    pub static intrinsic : ident = ident { repr: 30, ctxt: 0};
+    pub static clownshoes_foreign_mod: ident = ident { repr: 31, ctxt: 0};
+    pub static unnamed_field: ident = ident { repr: 32, ctxt: 0};
+    pub static c_abi: ident = ident { repr: 33, ctxt: 0};
+    pub static type_self: ident = ident { repr: 34, ctxt: 0};    // `Self`
 }
 
 pub struct StringRef<'self>(&'self str);
@@ -371,7 +368,7 @@ impl<'self> to_bytes::IterBytes for StringRef<'self> {
 pub fn token_to_binop(tok: Token) -> Option<ast::binop> {
   match tok {
       BINOP(STAR)    => Some(ast::mul),
-      BINOP(SLASH)   => Some(ast::quot),
+      BINOP(SLASH)   => Some(ast::div),
       BINOP(PERCENT) => Some(ast::rem),
       BINOP(PLUS)    => Some(ast::add),
       BINOP(MINUS)   => Some(ast::subtract),
@@ -426,41 +423,39 @@ pub fn mk_fresh_ident_interner() -> @ident_interner {
     let init_vec = ~[
         @~"_",                  // 0
         @~"anon",               // 1
-        @~"drop",               // 2
-        @~"",                   // 3
-        @~"unary",              // 4
-        @~"!",                  // 5
-        @~"[]",                 // 6
-        @~"unary-",             // 7
-        @~"__extensions__",     // 8
-        @~"self",               // 9
-        @~"item",               // 10
-        @~"block",              // 11
-        @~"stmt",               // 12
-        @~"pat",                // 13
-        @~"expr",               // 14
-        @~"ty",                 // 15
-        @~"ident",              // 16
-        @~"path",               // 17
-        @~"tt",                 // 18
-        @~"matchers",           // 19
-        @~"str",                // 20
-        @~"TyVisitor",          // 21
-        @~"arg",                // 22
-        @~"descrim",            // 23
-        @~"__rust_abi",         // 24
-        @~"__rust_stack_shim",  // 25
-        @~"TyDesc",             // 26
-        @~"dtor",               // 27
-        @~"main",               // 28
-        @~"<opaque>",           // 29
-        @~"blk",                // 30
-        @~"static",             // 31
-        @~"intrinsic",          // 32
-        @~"__foreign_mod__",    // 33
-        @~"__field__",          // 34
-        @~"C",                  // 35
-        @~"Self",               // 36
+        @~"",                   // 2
+        @~"unary",              // 3
+        @~"!",                  // 4
+        @~"[]",                 // 5
+        @~"unary-",             // 6
+        @~"__extensions__",     // 7
+        @~"self",               // 8
+        @~"item",               // 9
+        @~"block",              // 10
+        @~"stmt",               // 11
+        @~"pat",                // 12
+        @~"expr",               // 13
+        @~"ty",                 // 14
+        @~"ident",              // 15
+        @~"path",               // 16
+        @~"tt",                 // 17
+        @~"matchers",           // 18
+        @~"str",                // 19
+        @~"TyVisitor",          // 20
+        @~"arg",                // 21
+        @~"descrim",            // 22
+        @~"__rust_abi",         // 23
+        @~"__rust_stack_shim",  // 24
+        @~"TyDesc",             // 25
+        @~"main",               // 26
+        @~"<opaque>",           // 27
+        @~"blk",                // 28
+        @~"static",             // 29
+        @~"intrinsic",          // 30
+        @~"__foreign_mod__",    // 31
+        @~"__field__",          // 32
+        @~"C",                  // 33
+        @~"Self",               // 34
     ];
 
     let rv = @ident_interner {
@@ -561,11 +556,3 @@ pub fn reserved_keyword_table() -> HashSet<~str> {
     }
     return words;
 }
-
-
-// Local Variables:
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index c1acee8e2cd..43f62d72a9f 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -587,14 +587,3 @@ pub fn hardbreak_tok_offset(off: int) -> token {
 }
 
 pub fn hardbreak_tok() -> token { return hardbreak_tok_offset(0); }
-
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index ff8259e8996..6f3d6604d5b 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -699,13 +699,6 @@ pub fn print_struct(s: @ps,
         nbsp(s);
         bopen(s);
         hardbreak_if_not_bol(s);
-        for struct_def.dtor.each |dtor| {
-          hardbreak_if_not_bol(s);
-          maybe_print_comment(s, dtor.span.lo);
-          print_outer_attributes(s, dtor.node.attrs);
-          head(s, ~"drop");
-          print_block(s, &dtor.node.body);
-        }
 
         for struct_def.fields.each |field| {
             match field.node.kind {
@@ -713,6 +706,7 @@ pub fn print_struct(s: @ps,
                 ast::named_field(ident, mutability, visibility) => {
                     hardbreak_if_not_bol(s);
                     maybe_print_comment(s, field.span.lo);
+                    print_outer_attributes(s, field.node.attrs);
                     print_visibility(s, visibility);
                     if mutability == ast::struct_mutable {
                         word_nbsp(s, ~"mut");
@@ -2292,13 +2286,3 @@ mod test {
         assert_eq!(&varstr,&~"pub principal_skinner");
     }
 }
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rc
index a401d9eb8ac..b8327de0f13 100644
--- a/src/libsyntax/syntax.rc
+++ b/src/libsyntax/syntax.rc
@@ -22,7 +22,6 @@
 
 #[allow(vecs_implicitly_copyable)];
 #[allow(non_camel_case_types)];
-#[deny(deprecated_mode)];
 #[deny(deprecated_pattern)];
 
 extern mod std(vers = "0.7-pre");
@@ -90,4 +89,3 @@ pub mod ext {
 
     pub mod trace_macros;
 }
-
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index a42f640a175..90dd49d6848 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -11,7 +11,6 @@
 use abi::AbiSet;
 use ast::*;
 use ast;
-use ast_util;
 use codemap::span;
 use parse;
 use opt_vec;
@@ -45,13 +44,6 @@ pub enum fn_kind<'self> {
 
     // |x, y| ...
     fk_fn_block,
-
-    fk_dtor( // class destructor
-        &'self Generics,
-        &'self [attribute],
-        node_id /* self id */,
-        def_id /* parent class id */
-    )
 }
 
 pub fn name_of_fn(fk: &fn_kind) -> ident {
@@ -60,15 +52,13 @@ pub fn name_of_fn(fk: &fn_kind) -> ident {
           name
       }
       fk_anon(*) | fk_fn_block(*) => parse::token::special_idents::anon,
-      fk_dtor(*)                  => parse::token::special_idents::dtor
     }
 }
 
 pub fn generics_of_fn(fk: &fn_kind) -> Generics {
     match *fk {
         fk_item_fn(_, generics, _, _) |
-        fk_method(_, generics, _) |
-        fk_dtor(generics, _, _, _) => {
+        fk_method(_, generics, _) => {
             copy *generics
         }
         fk_anon(*) | fk_fn_block(*) => {
@@ -375,25 +365,6 @@ pub fn visit_method_helper<E: Copy>(m: &method, e: E, v: vt<E>) {
     );
 }
 
-pub fn visit_struct_dtor_helper<E>(dtor: struct_dtor, generics: &Generics,
-                                   parent_id: def_id, e: E, v: vt<E>) {
-    (v.visit_fn)(
-        &fk_dtor(
-            generics,
-            dtor.node.attrs,
-            dtor.node.self_id,
-            parent_id
-        ),
-        &ast_util::dtor_dec(),
-        &dtor.node.body,
-        dtor.span,
-        dtor.node.id,
-        e,
-        v
-    )
-
-}
-
 pub fn visit_fn<E: Copy>(fk: &fn_kind, decl: &fn_decl, body: &blk, _sp: span,
                          _id: node_id, e: E, v: vt<E>) {
     visit_fn_decl(decl, e, v);
@@ -418,23 +389,14 @@ pub fn visit_trait_method<E: Copy>(m: &trait_method, e: E, v: vt<E>) {
 pub fn visit_struct_def<E: Copy>(
     sd: @struct_def,
     _nm: ast::ident,
-    generics: &Generics,
-    id: node_id,
+    _generics: &Generics,
+    _id: node_id,
     e: E,
     v: vt<E>
 ) {
     for sd.fields.each |f| {
         (v.visit_struct_field)(*f, e, v);
     }
-    for sd.dtor.each |dtor| {
-        visit_struct_dtor_helper(
-            *dtor,
-            generics,
-            ast_util::local_def(id),
-            e,
-            v
-        )
-    }
 }
 
 pub fn visit_struct_field<E: Copy>(sf: @struct_field, e: E, v: vt<E>) {
@@ -801,11 +763,3 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
             v_struct_method(v.visit_struct_method, a, b, c)
     });
 }
-
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End: