about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/asm.rs8
-rw-r--r--src/libsyntax/ext/auto_encode.rs32
-rw-r--r--src/libsyntax/ext/base.rs20
-rw-r--r--src/libsyntax/ext/build.rs89
-rw-r--r--src/libsyntax/ext/concat_idents.rs2
-rw-r--r--src/libsyntax/ext/deriving.rs76
-rw-r--r--src/libsyntax/ext/env.rs2
-rw-r--r--src/libsyntax/ext/expand.rs40
-rw-r--r--src/libsyntax/ext/fmt.rs24
-rw-r--r--src/libsyntax/ext/log_syntax.rs2
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/ext/pipes/check.rs5
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs2
-rw-r--r--src/libsyntax/ext/pipes/mod.rs8
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs40
-rw-r--r--src/libsyntax/ext/pipes/proto.rs2
-rw-r--r--src/libsyntax/ext/quote.rs72
-rw-r--r--src/libsyntax/ext/source_util.rs18
-rw-r--r--src/libsyntax/ext/trace_macros.rs8
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs4
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs24
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs4
22 files changed, 247 insertions, 237 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index 8051a67d8fd..4f2fd68ff95 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -41,10 +41,10 @@ fn next_state(s: State) -> Option<State> {
     }
 }
 
-pub fn expand_asm(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
-    -> base::MacResult {
-
-    let p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(),
+pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
+               -> base::MacResult {
+    let p = parse::new_parser_from_tts(cx.parse_sess(),
+                                       cx.cfg(),
                                        vec::from_slice(tts));
 
     let mut asm = ~"";
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index c99d8977643..8c02b432371 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -110,7 +110,7 @@ mod syntax {
 }
 
 pub fn expand_auto_encode(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     _mitem: @ast::meta_item,
     in_items: ~[@ast::item]
@@ -165,7 +165,7 @@ pub fn expand_auto_encode(
 }
 
 pub fn expand_auto_decode(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     _mitem: @ast::meta_item,
     in_items: ~[@ast::item]
@@ -219,7 +219,7 @@ pub fn expand_auto_decode(
     }
 }
 
-priv impl ext_ctxt {
+priv impl @ext_ctxt {
     fn bind_path(
         &self,
         span: span,
@@ -426,7 +426,7 @@ priv impl ext_ctxt {
 }
 
 fn mk_impl(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ident: ast::ident,
     ty_param: ast::TyParam,
@@ -499,7 +499,7 @@ fn mk_impl(
 }
 
 fn mk_ser_impl(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ident: ast::ident,
     generics: &ast::Generics,
@@ -543,7 +543,7 @@ fn mk_ser_impl(
 }
 
 fn mk_deser_impl(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ident: ast::ident,
     generics: &ast::Generics,
@@ -587,7 +587,7 @@ fn mk_deser_impl(
 }
 
 fn mk_ser_method(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     +ser_body: ast::blk
 ) -> @ast::method {
@@ -647,7 +647,7 @@ fn mk_ser_method(
 }
 
 fn mk_deser_method(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ty: @ast::Ty,
     +deser_body: ast::blk
@@ -701,7 +701,7 @@ fn mk_deser_method(
 }
 
 fn mk_struct_ser_impl(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ident: ast::ident,
     fields: &[@ast::struct_field],
@@ -762,7 +762,7 @@ fn mk_struct_ser_impl(
 }
 
 fn mk_struct_deser_impl(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ident: ast::ident,
     fields: ~[@ast::struct_field],
@@ -866,7 +866,7 @@ fn mk_struct_fields(fields: &[@ast::struct_field]) -> ~[field] {
 }
 
 fn mk_enum_ser_impl(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ident: ast::ident,
     +enum_def: ast::enum_def,
@@ -883,7 +883,7 @@ fn mk_enum_ser_impl(
 }
 
 fn mk_enum_deser_impl(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     ident: ast::ident,
     +enum_def: ast::enum_def,
@@ -900,7 +900,7 @@ fn mk_enum_deser_impl(
 }
 
 fn ser_variant(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     v_name: ast::ident,
     v_idx: uint,
@@ -982,7 +982,7 @@ fn ser_variant(
 }
 
 fn mk_enum_ser_body(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     name: ast::ident,
     +variants: ~[ast::variant]
@@ -1032,7 +1032,7 @@ fn mk_enum_ser_body(
 }
 
 fn mk_enum_deser_variant_nary(
-    cx: ext_ctxt,
+    cx: @ext_ctxt,
     span: span,
     name: ast::ident,
     args: ~[ast::variant_arg]
@@ -1069,7 +1069,7 @@ fn mk_enum_deser_variant_nary(
 }
 
 fn mk_enum_deser_body(
-    ext_cx: ext_ctxt,
+    ext_cx: @ext_ctxt,
     span: span,
     name: ast::ident,
     variants: ~[ast::variant]
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index c8363e3daa8..f0822ea4d25 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -36,7 +36,7 @@ pub struct MacroDef {
     ext: SyntaxExtension
 }
 
-pub type ItemDecorator = @fn(ext_ctxt,
+pub type ItemDecorator = @fn(@ext_ctxt,
                              span,
                              @ast::meta_item,
                              ~[@ast::item])
@@ -47,7 +47,7 @@ pub struct SyntaxExpanderTT {
     span: Option<span>
 }
 
-pub type SyntaxExpanderTTFun = @fn(ext_ctxt,
+pub type SyntaxExpanderTTFun = @fn(@ext_ctxt,
                                    span,
                                    &[ast::token_tree])
                                 -> MacResult;
@@ -57,7 +57,7 @@ pub struct SyntaxExpanderTTItem {
     span: Option<span>
 }
 
-pub type SyntaxExpanderTTItemFun = @fn(ext_ctxt,
+pub type SyntaxExpanderTTItemFun = @fn(@ext_ctxt,
                                        span,
                                        ast::ident,
                                        ~[ast::token_tree])
@@ -238,8 +238,8 @@ pub trait ext_ctxt {
     fn ident_of(@mut self, st: ~str) -> ast::ident;
 }
 
-pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
-               +cfg: ast::crate_cfg) -> ext_ctxt {
+pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, +cfg: ast::crate_cfg)
+            -> @ext_ctxt {
     struct CtxtRepr {
         parse_sess: @mut parse::ParseSess,
         cfg: ast::crate_cfg,
@@ -333,7 +333,7 @@ pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
     ((imp) as @ext_ctxt)
 }
 
-pub fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
+pub fn expr_to_str(cx: @ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
     match expr.node {
       ast::expr_lit(l) => match l.node {
         ast::lit_str(s) => copy *s,
@@ -343,7 +343,7 @@ pub fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
     }
 }
 
-pub fn expr_to_ident(cx: ext_ctxt,
+pub fn expr_to_ident(cx: @ext_ctxt,
                      expr: @ast::expr,
                      err_msg: ~str) -> ast::ident {
     match expr.node {
@@ -357,14 +357,14 @@ pub fn expr_to_ident(cx: ext_ctxt,
     }
 }
 
-pub fn check_zero_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
+pub fn check_zero_tts(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree],
                       name: &str) {
     if tts.len() != 0 {
         cx.span_fatal(sp, fmt!("%s takes no arguments", name));
     }
 }
 
-pub fn get_single_str_from_tts(cx: ext_ctxt,
+pub fn get_single_str_from_tts(cx: @ext_ctxt,
                                sp: span,
                                tts: &[ast::token_tree],
                                name: &str) -> ~str {
@@ -379,7 +379,7 @@ pub fn get_single_str_from_tts(cx: ext_ctxt,
     }
 }
 
-pub fn get_exprs_from_tts(cx: ext_ctxt, tts: &[ast::token_tree])
+pub fn get_exprs_from_tts(cx: @ext_ctxt, tts: &[ast::token_tree])
                        -> ~[@ast::expr] {
     let p = parse::new_parser_from_tts(cx.parse_sess(),
                                        cx.cfg(),
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 5d071b8d517..18c7cd3f861 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -25,7 +25,7 @@ pub struct Field {
     ex: @ast::expr
 }
 
-pub fn mk_expr(cx: ext_ctxt,
+pub fn mk_expr(cx: @ext_ctxt,
                sp: codemap::span,
                +expr: ast::expr_)
             -> @ast::expr {
@@ -37,28 +37,28 @@ pub fn mk_expr(cx: ext_ctxt,
     }
 }
 
-pub fn mk_lit(cx: ext_ctxt, sp: span, lit: ast::lit_) -> @ast::expr {
+pub fn mk_lit(cx: @ext_ctxt, sp: span, lit: ast::lit_) -> @ast::expr {
     let sp_lit = @codemap::spanned { node: lit, span: sp };
     mk_expr(cx, sp, ast::expr_lit(sp_lit))
 }
-pub fn mk_int(cx: ext_ctxt, sp: span, i: int) -> @ast::expr {
+pub fn mk_int(cx: @ext_ctxt, sp: span, i: int) -> @ast::expr {
     let lit = ast::lit_int(i as i64, ast::ty_i);
     return mk_lit(cx, sp, lit);
 }
-pub fn mk_uint(cx: ext_ctxt, sp: span, u: uint) -> @ast::expr {
+pub fn mk_uint(cx: @ext_ctxt, sp: span, u: uint) -> @ast::expr {
     let lit = ast::lit_uint(u as u64, ast::ty_u);
     return mk_lit(cx, sp, lit);
 }
-pub fn mk_u8(cx: ext_ctxt, sp: span, u: u8) -> @ast::expr {
+pub fn mk_u8(cx: @ext_ctxt, sp: span, u: u8) -> @ast::expr {
     let lit = ast::lit_uint(u as u64, ast::ty_u8);
     return mk_lit(cx, sp, lit);
 }
-pub fn mk_binary(cx: ext_ctxt, sp: span, op: ast::binop,
+pub fn mk_binary(cx: @ext_ctxt, sp: span, op: ast::binop,
                  lhs: @ast::expr, rhs: @ast::expr) -> @ast::expr {
     cx.next_id(); // see ast_util::op_expr_callee_id
     mk_expr(cx, sp, ast::expr_binary(op, lhs, rhs))
 }
-pub fn mk_unary(cx: ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
+pub fn mk_unary(cx: @ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
              -> @ast::expr {
     cx.next_id(); // see ast_util::op_expr_callee_id
     mk_expr(cx, sp, ast::expr_unary(op, e))
@@ -88,69 +88,70 @@ pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::path {
                  rp: None,
                  types: ~[] }
 }
-pub fn mk_path(cx: ext_ctxt, sp: span, +idents: ~[ast::ident]) -> @ast::expr {
+pub fn mk_path(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident])
+            -> @ast::expr {
     mk_expr(cx, sp, ast::expr_path(mk_raw_path(sp, idents)))
 }
-pub fn mk_path_global(cx: ext_ctxt, sp: span, +idents: ~[ast::ident])
+pub fn mk_path_global(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident])
                    -> @ast::expr {
     mk_expr(cx, sp, ast::expr_path(mk_raw_path_global(sp, idents)))
 }
-pub fn mk_access_(cx: ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)
+pub fn mk_access_(cx: @ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)
                -> @ast::expr {
     mk_expr(cx, sp, ast::expr_field(p, m, ~[]))
 }
-pub fn mk_access(cx: ext_ctxt, sp: span, +p: ~[ast::ident], m: ast::ident)
+pub fn mk_access(cx: @ext_ctxt, sp: span, +p: ~[ast::ident], m: ast::ident)
               -> @ast::expr {
     let pathexpr = mk_path(cx, sp, p);
     return mk_access_(cx, sp, pathexpr, m);
 }
-pub fn mk_addr_of(cx: ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
+pub fn mk_addr_of(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
     return mk_expr(cx, sp, ast::expr_addr_of(ast::m_imm, e));
 }
-pub fn mk_call_(cx: ext_ctxt, sp: span, fn_expr: @ast::expr,
+pub fn mk_call_(cx: @ext_ctxt, sp: span, fn_expr: @ast::expr,
                 +args: ~[@ast::expr]) -> @ast::expr {
     mk_expr(cx, sp, ast::expr_call(fn_expr, args, ast::NoSugar))
 }
-pub fn mk_call(cx: ext_ctxt, sp: span, +fn_path: ~[ast::ident],
+pub fn mk_call(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident],
                +args: ~[@ast::expr]) -> @ast::expr {
     let pathexpr = mk_path(cx, sp, fn_path);
     return mk_call_(cx, sp, pathexpr, args);
 }
-pub fn mk_call_global(cx: ext_ctxt, sp: span, +fn_path: ~[ast::ident],
+pub fn mk_call_global(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident],
                       +args: ~[@ast::expr]) -> @ast::expr {
     let pathexpr = mk_path_global(cx, sp, fn_path);
     return mk_call_(cx, sp, pathexpr, args);
 }
 // e = expr, t = type
-pub fn mk_base_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
+pub fn mk_base_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
                   -> @ast::expr {
     let vecexpr = ast::expr_vec(exprs, ast::m_imm);
     mk_expr(cx, sp, vecexpr)
 }
-pub fn mk_vstore_e(cx: ext_ctxt, sp: span, expr: @ast::expr,
+pub fn mk_vstore_e(cx: @ext_ctxt, sp: span, expr: @ast::expr,
                    vst: ast::expr_vstore) ->
    @ast::expr {
     mk_expr(cx, sp, ast::expr_vstore(expr, vst))
 }
-pub fn mk_uniq_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
+pub fn mk_uniq_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
                   -> @ast::expr {
     mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs), ast::expr_vstore_uniq)
 }
-pub fn mk_slice_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
+pub fn mk_slice_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
                    -> @ast::expr {
     mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs),
                 ast::expr_vstore_slice)
 }
-pub fn mk_fixed_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
+pub fn mk_fixed_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
                    -> @ast::expr {
     mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs),
                 ast::expr_vstore_fixed(None))
 }
-pub fn mk_base_str(cx: ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
+pub fn mk_base_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
     let lit = ast::lit_str(@s);
     return mk_lit(cx, sp, lit);
 }
-pub fn mk_uniq_str(cx: ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
+pub fn mk_uniq_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
     mk_vstore_e(cx, sp, mk_base_str(cx, sp, s), ast::expr_vstore_uniq)
 }
 pub fn mk_field(sp: span, f: &Field) -> ast::field {
@@ -162,7 +163,7 @@ pub fn mk_field(sp: span, f: &Field) -> ast::field {
 pub fn mk_fields(sp: span, fields: ~[Field]) -> ~[ast::field] {
     fields.map(|f| mk_field(sp, f))
 }
-pub fn mk_struct_e(cx: ext_ctxt,
+pub fn mk_struct_e(cx: @ext_ctxt,
                    sp: span,
                    +ctor_path: ~[ast::ident],
                    +fields: ~[Field])
@@ -172,7 +173,7 @@ pub fn mk_struct_e(cx: ext_ctxt,
                              mk_fields(sp, fields),
                                     option::None::<@ast::expr>))
 }
-pub fn mk_global_struct_e(cx: ext_ctxt,
+pub fn mk_global_struct_e(cx: @ext_ctxt,
                           sp: span,
                           +ctor_path: ~[ast::ident],
                           +fields: ~[Field])
@@ -182,7 +183,7 @@ pub fn mk_global_struct_e(cx: ext_ctxt,
                              mk_fields(sp, fields),
                                     option::None::<@ast::expr>))
 }
-pub fn mk_glob_use(cx: ext_ctxt,
+pub fn mk_glob_use(cx: @ext_ctxt,
                    sp: span,
                    +path: ~[ast::ident]) -> @ast::view_item {
     let glob = @codemap::spanned {
@@ -194,7 +195,7 @@ pub fn mk_glob_use(cx: ext_ctxt,
                       vis: ast::private,
                       span: sp }
 }
-pub fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
+pub fn mk_local(cx: @ext_ctxt, sp: span, mutbl: bool,
                 ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
 
     let pat = @ast::pat {
@@ -219,7 +220,7 @@ pub fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
     let decl = codemap::spanned {node: ast::decl_local(~[local]), span: sp};
     @codemap::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp }
 }
-pub fn mk_block(cx: ext_ctxt, span: span,
+pub fn mk_block(cx: @ext_ctxt, span: span,
                 +view_items: ~[@ast::view_item],
                 +stmts: ~[@ast::stmt],
                 expr: Option<@ast::expr>) -> @ast::expr {
@@ -235,7 +236,7 @@ pub fn mk_block(cx: ext_ctxt, span: span,
     };
     mk_expr(cx, span, ast::expr_block(blk))
 }
-pub fn mk_block_(cx: ext_ctxt,
+pub fn mk_block_(cx: @ext_ctxt,
                  span: span,
                  +stmts: ~[@ast::stmt])
               -> ast::blk {
@@ -250,7 +251,7 @@ pub fn mk_block_(cx: ext_ctxt,
         span: span,
     }
 }
-pub fn mk_simple_block(cx: ext_ctxt,
+pub fn mk_simple_block(cx: @ext_ctxt,
                        span: span,
                        expr: @ast::expr)
                     -> ast::blk {
@@ -265,21 +266,21 @@ pub fn mk_simple_block(cx: ext_ctxt,
         span: span,
     }
 }
-pub fn mk_copy(cx: ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
+pub fn mk_copy(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
     mk_expr(cx, sp, ast::expr_copy(e))
 }
-pub fn mk_managed(cx: ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
+pub fn mk_managed(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
     mk_expr(cx, sp, ast::expr_unary(ast::box(ast::m_imm), e))
 }
-pub fn mk_pat(cx: ext_ctxt, span: span, +pat: ast::pat_) -> @ast::pat {
+pub fn mk_pat(cx: @ext_ctxt, span: span, +pat: ast::pat_) -> @ast::pat {
     @ast::pat { id: cx.next_id(), node: pat, span: span }
 }
-pub fn mk_pat_ident(cx: ext_ctxt,
+pub fn mk_pat_ident(cx: @ext_ctxt,
                     span: span,
                     ident: ast::ident) -> @ast::pat {
     mk_pat_ident_with_binding_mode(cx, span, ident, ast::bind_by_copy)
 }
-pub fn mk_pat_ident_with_binding_mode(cx: ext_ctxt,
+pub fn mk_pat_ident_with_binding_mode(cx: @ext_ctxt,
                                       span: span,
                                       ident: ast::ident,
                                       bm: ast::binding_mode) -> @ast::pat {
@@ -287,7 +288,7 @@ pub fn mk_pat_ident_with_binding_mode(cx: ext_ctxt,
     let pat = ast::pat_ident(bm, path, None);
     mk_pat(cx, span, pat)
 }
-pub fn mk_pat_enum(cx: ext_ctxt,
+pub fn mk_pat_enum(cx: @ext_ctxt,
                    span: span,
                    path: @ast::path,
                    +subpats: ~[@ast::pat])
@@ -295,7 +296,7 @@ pub fn mk_pat_enum(cx: ext_ctxt,
     let pat = ast::pat_enum(path, Some(subpats));
     mk_pat(cx, span, pat)
 }
-pub fn mk_pat_struct(cx: ext_ctxt,
+pub fn mk_pat_struct(cx: @ext_ctxt,
                      span: span,
                      path: @ast::path,
                      +field_pats: ~[ast::field_pat])
@@ -303,17 +304,17 @@ pub fn mk_pat_struct(cx: ext_ctxt,
     let pat = ast::pat_struct(path, field_pats, false);
     mk_pat(cx, span, pat)
 }
-pub fn mk_bool(cx: ext_ctxt, span: span, value: bool) -> @ast::expr {
+pub fn mk_bool(cx: @ext_ctxt, span: span, value: bool) -> @ast::expr {
     let lit_expr = ast::expr_lit(@codemap::spanned {
         node: ast::lit_bool(value),
         span: span });
     build::mk_expr(cx, span, lit_expr)
 }
-pub fn mk_stmt(cx: ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt {
+pub fn mk_stmt(cx: @ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt {
     let stmt_ = ast::stmt_semi(expr, cx.next_id());
     @codemap::spanned { node: stmt_, span: span }
 }
-pub fn mk_ty_path(cx: ext_ctxt,
+pub fn mk_ty_path(cx: @ext_ctxt,
                   span: span,
                   +idents: ~[ ast::ident ])
                -> @ast::Ty {
@@ -322,7 +323,7 @@ pub fn mk_ty_path(cx: ext_ctxt,
     let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span };
     ty
 }
-pub fn mk_ty_path_global(cx: ext_ctxt,
+pub fn mk_ty_path_global(cx: @ext_ctxt,
                          span: span,
                          +idents: ~[ ast::ident ])
                       -> @ast::Ty {
@@ -331,13 +332,13 @@ pub fn mk_ty_path_global(cx: ext_ctxt,
     let ty = @ast::Ty { id: cx.next_id(), node: ty, span: span };
     ty
 }
-pub fn mk_simple_ty_path(cx: ext_ctxt,
+pub fn mk_simple_ty_path(cx: @ext_ctxt,
                          span: span,
                          ident: ast::ident)
                       -> @ast::Ty {
     mk_ty_path(cx, span, ~[ ident ])
 }
-pub fn mk_arg(cx: ext_ctxt,
+pub fn mk_arg(cx: @ext_ctxt,
               span: span,
               ident: ast::ident,
               ty: @ast::Ty)
@@ -354,13 +355,13 @@ pub fn mk_arg(cx: ext_ctxt,
 pub fn mk_fn_decl(+inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl {
     ast::fn_decl { inputs: inputs, output: output, cf: ast::return_val }
 }
-pub fn mk_ty_param(cx: ext_ctxt,
+pub fn mk_ty_param(cx: @ext_ctxt,
                    ident: ast::ident,
                    bounds: @OptVec<ast::TyParamBound>)
                 -> ast::TyParam {
     ast::TyParam { ident: ident, id: cx.next_id(), bounds: bounds }
 }
-pub fn mk_lifetime(cx: ext_ctxt,
+pub fn mk_lifetime(cx: @ext_ctxt,
                    span: span,
                    ident: ast::ident) -> ast::Lifetime
 {
diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs
index 4f53bf62efb..0c3bef56459 100644
--- a/src/libsyntax/ext/concat_idents.rs
+++ b/src/libsyntax/ext/concat_idents.rs
@@ -16,7 +16,7 @@ use ext::base::*;
 use ext::base;
 use parse::token;
 
-pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_syntax_ext(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     let mut res_str = ~"";
     for tts.eachi |i, e| {
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index 093327ec32e..26b5b4566b7 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -45,18 +45,18 @@ pub impl Junction {
     }
 }
 
-type ExpandDerivingStructDefFn = &self/fn(ext_ctxt,
+type ExpandDerivingStructDefFn = &self/fn(@ext_ctxt,
                                           span,
                                           x: &struct_def,
                                           ident,
                                           y: &Generics) -> @item;
-type ExpandDerivingEnumDefFn = &self/fn(ext_ctxt,
+type ExpandDerivingEnumDefFn = &self/fn(@ext_ctxt,
                                         span,
                                         x: &enum_def,
                                         ident,
                                         y: &Generics) -> @item;
 
-pub fn expand_meta_deriving(cx: ext_ctxt,
+pub fn expand_meta_deriving(cx: @ext_ctxt,
                             _span: span,
                             mitem: @meta_item,
                             in_items: ~[@item])
@@ -98,7 +98,7 @@ pub fn expand_meta_deriving(cx: ext_ctxt,
     }
 }
 
-pub fn expand_deriving_eq(cx: ext_ctxt,
+pub fn expand_deriving_eq(cx: @ext_ctxt,
                           span: span,
                           _mitem: @meta_item,
                           in_items: ~[@item])
@@ -110,7 +110,7 @@ pub fn expand_deriving_eq(cx: ext_ctxt,
                     expand_deriving_eq_enum_def)
 }
 
-pub fn expand_deriving_iter_bytes(cx: ext_ctxt,
+pub fn expand_deriving_iter_bytes(cx: @ext_ctxt,
                                   span: span,
                                   _mitem: @meta_item,
                                   in_items: ~[@item])
@@ -122,7 +122,7 @@ pub fn expand_deriving_iter_bytes(cx: ext_ctxt,
                     expand_deriving_iter_bytes_enum_def)
 }
 
-pub fn expand_deriving_clone(cx: ext_ctxt,
+pub fn expand_deriving_clone(cx: @ext_ctxt,
                              span: span,
                              _: @meta_item,
                              in_items: ~[@item])
@@ -134,7 +134,7 @@ pub fn expand_deriving_clone(cx: ext_ctxt,
                     expand_deriving_clone_enum_def)
 }
 
-fn expand_deriving(cx: ext_ctxt,
+fn expand_deriving(cx: @ext_ctxt,
                    span: span,
                    in_items: ~[@item],
                    expand_deriving_struct_def: ExpandDerivingStructDefFn,
@@ -164,7 +164,7 @@ fn expand_deriving(cx: ext_ctxt,
     result
 }
 
-fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item {
+fn create_impl_item(cx: @ext_ctxt, span: span, +item: item_) -> @item {
     @ast::item {
         ident: clownshoes_extensions,
         attrs: ~[],
@@ -177,7 +177,7 @@ fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item {
 
 /// Creates a method from the given expression, the signature of which
 /// conforms to the `eq` or `ne` method.
-fn create_eq_method(cx: ext_ctxt,
+fn create_eq_method(cx: @ext_ctxt,
                     span: span,
                     method_ident: ident,
                     type_ident: ident,
@@ -236,7 +236,7 @@ fn create_eq_method(cx: ext_ctxt,
     }
 }
 
-fn create_self_type_with_params(cx: ext_ctxt,
+fn create_self_type_with_params(cx: @ext_ctxt,
                                 span: span,
                                 type_ident: ident,
                                 generics: &Generics)
@@ -258,7 +258,7 @@ fn create_self_type_with_params(cx: ext_ctxt,
     @ast::Ty { id: cx.next_id(), node: self_type, span: span }
 }
 
-fn create_derived_impl(cx: ext_ctxt,
+fn create_derived_impl(cx: @ext_ctxt,
                        span: span,
                        type_ident: ident,
                        generics: &Generics,
@@ -320,7 +320,7 @@ fn create_derived_impl(cx: ext_ctxt,
     return create_impl_item(cx, span, impl_item);
 }
 
-fn create_derived_eq_impl(cx: ext_ctxt,
+fn create_derived_eq_impl(cx: @ext_ctxt,
                           span: span,
                           type_ident: ident,
                           generics: &Generics,
@@ -336,7 +336,7 @@ fn create_derived_eq_impl(cx: ext_ctxt,
     create_derived_impl(cx, span, type_ident, generics, methods, trait_path)
 }
 
-fn create_derived_iter_bytes_impl(cx: ext_ctxt,
+fn create_derived_iter_bytes_impl(cx: @ext_ctxt,
                                   span: span,
                                   type_ident: ident,
                                   generics: &Generics,
@@ -351,7 +351,7 @@ fn create_derived_iter_bytes_impl(cx: ext_ctxt,
     create_derived_impl(cx, span, type_ident, generics, methods, trait_path)
 }
 
-fn create_derived_clone_impl(cx: ext_ctxt,
+fn create_derived_clone_impl(cx: @ext_ctxt,
                              span: span,
                              type_ident: ident,
                              generics: &Generics,
@@ -368,7 +368,7 @@ fn create_derived_clone_impl(cx: ext_ctxt,
 
 // Creates a method from the given set of statements conforming to the
 // signature of the `iter_bytes` method.
-fn create_iter_bytes_method(cx: ext_ctxt,
+fn create_iter_bytes_method(cx: @ext_ctxt,
                             span: span,
                             +statements: ~[@stmt])
                          -> @method {
@@ -417,7 +417,7 @@ fn create_iter_bytes_method(cx: ext_ctxt,
 
 // Creates a method from the given expression conforming to the signature of
 // the `clone` method.
-fn create_clone_method(cx: ext_ctxt,
+fn create_clone_method(cx: @ext_ctxt,
                        span: span,
                        +type_ident: ast::ident,
                        generics: &Generics,
@@ -467,7 +467,7 @@ fn create_clone_method(cx: ext_ctxt,
     }
 }
 
-fn create_subpatterns(cx: ext_ctxt,
+fn create_subpatterns(cx: @ext_ctxt,
                       span: span,
                       prefix: ~str,
                       n: uint)
@@ -496,7 +496,7 @@ fn is_struct_tuple(struct_def: &struct_def) -> bool {
     })
 }
 
-fn create_enum_variant_pattern(cx: ext_ctxt,
+fn create_enum_variant_pattern(cx: @ext_ctxt,
                                span: span,
                                variant: &variant,
                                prefix: ~str)
@@ -542,7 +542,7 @@ fn create_enum_variant_pattern(cx: ext_ctxt,
     }
 }
 
-fn call_substructure_eq_method(cx: ext_ctxt,
+fn call_substructure_eq_method(cx: @ext_ctxt,
                                span: span,
                                self_field: @expr,
                                other_field_ref: @expr,
@@ -571,7 +571,7 @@ fn call_substructure_eq_method(cx: ext_ctxt,
     };
 }
 
-fn finish_eq_chain_expr(cx: ext_ctxt,
+fn finish_eq_chain_expr(cx: @ext_ctxt,
                         span: span,
                         chain_expr: Option<@expr>,
                         junction: Junction)
@@ -587,7 +587,7 @@ fn finish_eq_chain_expr(cx: ext_ctxt,
     }
 }
 
-fn call_substructure_iter_bytes_method(cx: ext_ctxt,
+fn call_substructure_iter_bytes_method(cx: @ext_ctxt,
                                        span: span,
                                        self_field: @expr)
                                     -> @stmt {
@@ -612,7 +612,7 @@ fn call_substructure_iter_bytes_method(cx: ext_ctxt,
     build::mk_stmt(cx, span, self_call)
 }
 
-fn call_substructure_clone_method(cx: ext_ctxt,
+fn call_substructure_clone_method(cx: @ext_ctxt,
                                   span: span,
                                   self_field: @expr)
                                -> @expr {
@@ -622,7 +622,7 @@ fn call_substructure_clone_method(cx: ext_ctxt,
     build::mk_call_(cx, span, self_method, ~[])
 }
 
-fn variant_arg_count(cx: ext_ctxt, span: span, variant: &variant) -> uint {
+fn variant_arg_count(cx: @ext_ctxt, span: span, variant: &variant) -> uint {
     match variant.node.kind {
         tuple_variant_kind(ref args) => args.len(),
         struct_variant_kind(ref struct_def) => struct_def.fields.len(),
@@ -632,7 +632,7 @@ fn variant_arg_count(cx: ext_ctxt, span: span, variant: &variant) -> uint {
     }
 }
 
-fn expand_deriving_eq_struct_def(cx: ext_ctxt,
+fn expand_deriving_eq_struct_def(cx: @ext_ctxt,
                                  span: span,
                                  struct_def: &struct_def,
                                  type_ident: ident,
@@ -672,7 +672,7 @@ fn expand_deriving_eq_struct_def(cx: ext_ctxt,
                                   ne_method);
 }
 
-fn expand_deriving_eq_enum_def(cx: ext_ctxt,
+fn expand_deriving_eq_enum_def(cx: @ext_ctxt,
                                span: span,
                                enum_definition: &enum_def,
                                type_ident: ident,
@@ -705,7 +705,7 @@ fn expand_deriving_eq_enum_def(cx: ext_ctxt,
                                   ne_method);
 }
 
-fn expand_deriving_iter_bytes_struct_def(cx: ext_ctxt,
+fn expand_deriving_iter_bytes_struct_def(cx: @ext_ctxt,
                                          span: span,
                                          struct_def: &struct_def,
                                          type_ident: ident,
@@ -724,7 +724,7 @@ fn expand_deriving_iter_bytes_struct_def(cx: ext_ctxt,
                                           method);
 }
 
-fn expand_deriving_iter_bytes_enum_def(cx: ext_ctxt,
+fn expand_deriving_iter_bytes_enum_def(cx: @ext_ctxt,
                                        span: span,
                                        enum_definition: &enum_def,
                                        type_ident: ident,
@@ -743,7 +743,7 @@ fn expand_deriving_iter_bytes_enum_def(cx: ext_ctxt,
                                           method);
 }
 
-fn expand_deriving_clone_struct_def(cx: ext_ctxt,
+fn expand_deriving_clone_struct_def(cx: @ext_ctxt,
                                     span: span,
                                     struct_def: &struct_def,
                                     type_ident: ident,
@@ -768,7 +768,7 @@ fn expand_deriving_clone_struct_def(cx: ext_ctxt,
     create_derived_clone_impl(cx, span, type_ident, generics, method)
 }
 
-fn expand_deriving_clone_enum_def(cx: ext_ctxt,
+fn expand_deriving_clone_enum_def(cx: @ext_ctxt,
                                   span: span,
                                   enum_definition: &enum_def,
                                   type_ident: ident,
@@ -785,7 +785,7 @@ fn expand_deriving_clone_enum_def(cx: ext_ctxt,
     create_derived_clone_impl(cx, span, type_ident, generics, method)
 }
 
-fn expand_deriving_eq_struct_method(cx: ext_ctxt,
+fn expand_deriving_eq_struct_method(cx: @ext_ctxt,
                                     span: span,
                                     struct_def: &struct_def,
                                     method_ident: ident,
@@ -841,7 +841,7 @@ fn expand_deriving_eq_struct_method(cx: ext_ctxt,
                             body);
 }
 
-fn expand_deriving_iter_bytes_struct_method(cx: ext_ctxt,
+fn expand_deriving_iter_bytes_struct_method(cx: @ext_ctxt,
                                             span: span,
                                             struct_def: &struct_def)
                                          -> @method {
@@ -875,7 +875,7 @@ fn expand_deriving_iter_bytes_struct_method(cx: ext_ctxt,
     return create_iter_bytes_method(cx, span, statements);
 }
 
-fn expand_deriving_clone_struct_method(cx: ext_ctxt,
+fn expand_deriving_clone_struct_method(cx: @ext_ctxt,
                                        span: span,
                                        struct_def: &struct_def,
                                        type_ident: ident,
@@ -918,7 +918,7 @@ fn expand_deriving_clone_struct_method(cx: ext_ctxt,
     create_clone_method(cx, span, type_ident, generics, struct_literal)
 }
 
-fn expand_deriving_clone_tuple_struct_method(cx: ext_ctxt,
+fn expand_deriving_clone_tuple_struct_method(cx: @ext_ctxt,
                                              span: span,
                                              struct_def: &struct_def,
                                              type_ident: ident,
@@ -962,7 +962,7 @@ fn expand_deriving_clone_tuple_struct_method(cx: ext_ctxt,
     create_clone_method(cx, span, type_ident, generics, self_match_expr)
 }
 
-fn expand_deriving_eq_enum_method(cx: ext_ctxt,
+fn expand_deriving_eq_enum_method(cx: @ext_ctxt,
                                   span: span,
                                   enum_definition: &enum_def,
                                   method_ident: ident,
@@ -1096,7 +1096,7 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
                             self_match_expr);
 }
 
-fn expand_deriving_eq_struct_tuple_method(cx: ext_ctxt,
+fn expand_deriving_eq_struct_tuple_method(cx: @ext_ctxt,
                                           span: span,
                                           struct_def: &struct_def,
                                           method_ident: ident,
@@ -1155,7 +1155,7 @@ fn expand_deriving_eq_struct_tuple_method(cx: ext_ctxt,
         type_ident, generics, self_match_expr)
 }
 
-fn expand_enum_or_struct_match(cx: ext_ctxt,
+fn expand_enum_or_struct_match(cx: @ext_ctxt,
                                span: span,
                                arms: ~[ ast::arm ])
                             -> @expr {
@@ -1166,7 +1166,7 @@ fn expand_enum_or_struct_match(cx: ext_ctxt,
     build::mk_expr(cx, span, self_match_expr)
 }
 
-fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt,
+fn expand_deriving_iter_bytes_enum_method(cx: @ext_ctxt,
                                           span: span,
                                           enum_definition: &enum_def)
                                        -> @method {
@@ -1221,7 +1221,7 @@ fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt,
     create_iter_bytes_method(cx, span, ~[ self_match_stmt ])
 }
 
-fn expand_deriving_clone_enum_method(cx: ext_ctxt,
+fn expand_deriving_clone_enum_method(cx: @ext_ctxt,
                                      span: span,
                                      enum_definition: &enum_def,
                                      type_ident: ident,
diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs
index c8fb83224ac..c21a9fa8739 100644
--- a/src/libsyntax/ext/env.rs
+++ b/src/libsyntax/ext/env.rs
@@ -23,7 +23,7 @@ use ext::base::*;
 use ext::base;
 use ext::build::mk_uniq_str;
 
-pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_syntax_ext(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
 
     let var = get_single_str_from_tts(cx, sp, tts, "env!");
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 831d1140a53..ec693fa1f08 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -26,11 +26,11 @@ use core::option;
 use core::vec;
 
 pub fn expand_expr(extsbox: @mut SyntaxEnv,
-                   cx: ext_ctxt,
+                   cx: @ext_ctxt,
                    e: &expr_,
                    s: span,
-                   fld: ast_fold,
-                   orig: @fn(&expr_, span, ast_fold) -> (expr_, span))
+                   fld: @ast_fold,
+                   orig: @fn(&expr_, span, @ast_fold) -> (expr_, span))
                 -> (expr_, span) {
     match *e {
         // expr_mac should really be expr_ext or something; it's the
@@ -112,10 +112,10 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
 // NB: there is some redundancy between this and expand_item, below, and
 // they might benefit from some amount of semantic and language-UI merger.
 pub fn expand_mod_items(extsbox: @mut SyntaxEnv,
-                        cx: ext_ctxt,
+                        cx: @ext_ctxt,
                         module_: &ast::_mod,
-                        fld: ast_fold,
-                        orig: @fn(&ast::_mod, ast_fold) -> ast::_mod)
+                        fld: @ast_fold,
+                        orig: @fn(&ast::_mod, @ast_fold) -> ast::_mod)
                      -> ast::_mod {
     // Fold the contents first:
     let module_ = orig(module_, fld);
@@ -163,10 +163,10 @@ macro_rules! with_exts_frame (
 
 // When we enter a module, record it, for the sake of `module!`
 pub fn expand_item(extsbox: @mut SyntaxEnv,
-                   cx: ext_ctxt,
+                   cx: @ext_ctxt,
                    it: @ast::item,
-                   fld: ast_fold,
-                   orig: @fn(@ast::item, ast_fold) -> Option<@ast::item>)
+                   fld: @ast_fold,
+                   orig: @fn(@ast::item, @ast_fold) -> Option<@ast::item>)
                 -> Option<@ast::item> {
     // need to do expansion first... it might turn out to be a module.
     let maybe_it = match it.node {
@@ -239,9 +239,9 @@ macro_rules! without_macro_scoping(
 // Support for item-position macro invocations, exactly the same
 // logic as for expression-position macro invocations.
 pub fn expand_item_mac(+extsbox: @mut SyntaxEnv,
-                       cx: ext_ctxt, &&it: @ast::item,
-                       fld: ast_fold) -> Option<@ast::item> {
-
+                       cx: @ext_ctxt, &&it: @ast::item,
+                       fld: @ast_fold)
+                    -> Option<@ast::item> {
     let (pth, tts) = match it.node {
         item_mac(codemap::spanned { node: mac_invoc_tt(pth, ref tts), _}) => {
             (pth, copy *tts)
@@ -307,11 +307,11 @@ pub fn expand_item_mac(+extsbox: @mut SyntaxEnv,
 
 // expand a stmt
 pub fn expand_stmt(extsbox: @mut SyntaxEnv,
-                   cx: ext_ctxt,
+                   cx: @ext_ctxt,
                    s: &stmt_,
                    sp: span,
-                   fld: ast_fold,
-                   orig: @fn(&stmt_, span, ast_fold) -> (stmt_, span))
+                   fld: @ast_fold,
+                   orig: @fn(&stmt_, span, @ast_fold) -> (stmt_, span))
                 -> (stmt_, span) {
     let (mac, pth, tts, semi) = match *s {
         stmt_mac(ref mac, semi) => {
@@ -373,11 +373,11 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
 
 
 pub fn expand_block(extsbox: @mut SyntaxEnv,
-                    cx: ext_ctxt,
+                    cx: @ext_ctxt,
                     blk: &blk_,
                     sp: span,
-                    fld: ast_fold,
-                    orig: @fn(&blk_, span, ast_fold) -> (blk_, span))
+                    fld: @ast_fold,
+                    orig: @fn(&blk_, span, @ast_fold) -> (blk_, span))
                  -> (blk_, span) {
     match (*extsbox).find(&@~" block") {
         // no scope limit on macros in this block, no need
@@ -395,7 +395,7 @@ pub fn expand_block(extsbox: @mut SyntaxEnv,
     }
 }
 
-pub fn new_span(cx: ext_ctxt, sp: span) -> span {
+pub fn new_span(cx: @ext_ctxt, sp: span) -> span {
     /* this discards information in the case of macro-defining macros */
     return span {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()};
 }
@@ -488,7 +488,7 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess,
     // every method/element of AstFoldFns in fold.rs.
     let extsbox = @mut syntax_expander_table();
     let afp = default_ast_fold();
-    let cx: ext_ctxt = mk_ctxt(parse_sess, copy cfg);
+    let cx: @ext_ctxt = mk_ctxt(parse_sess, copy cfg);
     let f_pre = @AstFoldFns {
         fold_expr: |expr,span,recur|
             expand_expr(extsbox, cx, expr, span, recur, afp.fold_expr),
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index ee0de9e48db..f6a6ddefb7e 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -27,7 +27,7 @@ use ext::build::*;
 
 use core::unstable::extfmt::ct::*;
 
-pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_syntax_ext(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     let args = get_exprs_from_tts(cx, tts);
     if args.len() == 0 {
@@ -38,7 +38,7 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
                     ~"first argument to fmt! must be a string literal.");
     let fmtspan = args[0].span;
     debug!("Format string: %s", fmt);
-    fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: &str) -> ! {
+    fn parse_fmt_err_(cx: @ext_ctxt, sp: span, msg: &str) -> ! {
         cx.span_fatal(sp, msg);
     }
     let parse_fmt_err: @fn(&str) -> ! = |s| parse_fmt_err_(cx, fmtspan, s);
@@ -50,23 +50,23 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
 // probably be factored out in common with other code that builds
 // expressions.  Also: Cleanup the naming of these functions.
 // Note: Moved many of the common ones to build.rs --kevina
-fn pieces_to_expr(cx: ext_ctxt, sp: span,
+fn pieces_to_expr(cx: @ext_ctxt, sp: span,
                   pieces: ~[Piece], args: ~[@ast::expr])
    -> @ast::expr {
-    fn make_path_vec(cx: ext_ctxt, ident: @~str) -> ~[ast::ident] {
+    fn make_path_vec(cx: @ext_ctxt, ident: @~str) -> ~[ast::ident] {
         let intr = cx.parse_sess().interner;
         return ~[intr.intern(@~"unstable"), intr.intern(@~"extfmt"),
                  intr.intern(@~"rt"), intr.intern(ident)];
     }
-    fn make_rt_path_expr(cx: ext_ctxt, sp: span, nm: @~str) -> @ast::expr {
+    fn make_rt_path_expr(cx: @ext_ctxt, sp: span, nm: @~str) -> @ast::expr {
         let path = make_path_vec(cx, nm);
         return mk_path_global(cx, sp, path);
     }
     // Produces an AST expression that represents a RT::conv record,
     // which tells the RT::conv* functions how to perform the conversion
 
-    fn make_rt_conv_expr(cx: ext_ctxt, sp: span, cnv: Conv) -> @ast::expr {
-        fn make_flags(cx: ext_ctxt, sp: span, flags: ~[Flag]) -> @ast::expr {
+    fn make_rt_conv_expr(cx: @ext_ctxt, sp: span, cnv: Conv) -> @ast::expr {
+        fn make_flags(cx: @ext_ctxt, sp: span, flags: ~[Flag]) -> @ast::expr {
             let mut tmp_expr = make_rt_path_expr(cx, sp, @~"flag_none");
             for flags.each |f| {
                 let fstr = match *f {
@@ -81,7 +81,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
             }
             return tmp_expr;
         }
-        fn make_count(cx: ext_ctxt, sp: span, cnt: Count) -> @ast::expr {
+        fn make_count(cx: @ext_ctxt, sp: span, cnt: Count) -> @ast::expr {
             match cnt {
               CountImplied => {
                 return make_rt_path_expr(cx, sp, @~"CountImplied");
@@ -95,7 +95,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
               _ => cx.span_unimpl(sp, ~"unimplemented fmt! conversion")
             }
         }
-        fn make_ty(cx: ext_ctxt, sp: span, t: Ty) -> @ast::expr {
+        fn make_ty(cx: @ext_ctxt, sp: span, t: Ty) -> @ast::expr {
             let mut rt_type;
             match t {
               TyHex(c) => match c {
@@ -108,7 +108,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
             }
             return make_rt_path_expr(cx, sp, @rt_type);
         }
-        fn make_conv_struct(cx: ext_ctxt, sp: span, flags_expr: @ast::expr,
+        fn make_conv_struct(cx: @ext_ctxt, sp: span, flags_expr: @ast::expr,
                          width_expr: @ast::expr, precision_expr: @ast::expr,
                          ty_expr: @ast::expr) -> @ast::expr {
             let intr = cx.parse_sess().interner;
@@ -139,7 +139,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
         make_conv_struct(cx, sp, rt_conv_flags, rt_conv_width,
                          rt_conv_precision, rt_conv_ty)
     }
-    fn make_conv_call(cx: ext_ctxt, sp: span, conv_type: ~str, cnv: Conv,
+    fn make_conv_call(cx: @ext_ctxt, sp: span, conv_type: ~str, cnv: Conv,
                       arg: @ast::expr) -> @ast::expr {
         let fname = ~"conv_" + conv_type;
         let path = make_path_vec(cx, @fname);
@@ -148,7 +148,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
         return mk_call_global(cx, arg.span, path, args);
     }
 
-    fn make_new_conv(cx: ext_ctxt, sp: span, cnv: Conv, arg: @ast::expr) ->
+    fn make_new_conv(cx: @ext_ctxt, sp: span, cnv: Conv, arg: @ast::expr) ->
        @ast::expr {
         // FIXME: Move validation code into core::extfmt (Issue #2249)
 
diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs
index 8a8583420f8..bf4a997bc17 100644
--- a/src/libsyntax/ext/log_syntax.rs
+++ b/src/libsyntax/ext/log_syntax.rs
@@ -17,7 +17,7 @@ use ext::base::*;
 use ext::base;
 use print;
 
-pub fn expand_syntax_ext(cx: ext_ctxt,
+pub fn expand_syntax_ext(cx: @ext_ctxt,
                          sp: codemap::span,
                          tt: &[ast::token_tree])
                       -> base::MacResult {
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index e6f0cdde8c1..76b70225c6c 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -138,7 +138,7 @@ pub trait ext_ctxt_ast_builder {
     fn strip_bounds(&self, bounds: &Generics) -> Generics;
 }
 
-impl ext_ctxt_ast_builder for ext_ctxt {
+impl ext_ctxt_ast_builder for @ext_ctxt {
     fn ty_option(&self, ty: @ast::Ty) -> @ast::Ty {
         self.ty_path_ast_builder(path_global(~[
             self.ident_of(~"core"),
diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs
index b543ef5fdae..30e7e832db1 100644
--- a/src/libsyntax/ext/pipes/check.rs
+++ b/src/libsyntax/ext/pipes/check.rs
@@ -37,9 +37,8 @@ use ext::base::ext_ctxt;
 use ext::pipes::proto::{state, protocol, next_state};
 use ext::pipes::proto;
 
-impl proto::visitor<(), (), ()> for ext_ctxt {
-    fn visit_proto(&self, _proto: protocol,
-                   _states: &[()]) { }
+impl proto::visitor<(), (), ()> for @ext_ctxt {
+    fn visit_proto(&self, _proto: protocol, _states: &[()]) { }
 
     fn visit_state(&self, state: state, _m: &[()]) {
         if state.messages.len() == 0 {
diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs
index c5bed32a24f..97f2e516603 100644
--- a/src/libsyntax/ext/pipes/liveness.rs
+++ b/src/libsyntax/ext/pipes/liveness.rs
@@ -45,7 +45,7 @@ use ext::pipes::proto::protocol;
 use core::str;
 use std::bitv::Bitv;
 
-pub fn analyze(proto: protocol, _cx: ext_ctxt) {
+pub fn analyze(proto: protocol, _cx: @ext_ctxt) {
     debug!("initializing colive analysis");
     let num_states = proto.num_states();
     let mut colive = do (copy proto.states).map_to_vec |state| {
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index df17c960ba2..327cb0ae517 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -63,13 +63,15 @@ pub mod check;
 pub mod liveness;
 
 
-pub fn expand_proto(cx: ext_ctxt, _sp: span, id: ast::ident,
+pub fn expand_proto(cx: @ext_ctxt, _sp: span, id: ast::ident,
                     tt: ~[ast::token_tree]) -> base::MacResult {
     let sess = cx.parse_sess();
     let cfg = cx.cfg();
     let tt_rdr = new_tt_reader(copy cx.parse_sess().span_diagnostic,
-                               cx.parse_sess().interner, None, copy tt);
-    let rdr = tt_rdr as reader;
+                               cx.parse_sess().interner,
+                               None,
+                               copy tt);
+    let rdr = tt_rdr as @reader;
     let rust_parser = Parser(sess, cfg, rdr.dup());
 
     let mut proto = rust_parser.parse_proto(cx.str_of(id));
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index fd8b2dbf72f..a7725eab695 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -26,27 +26,27 @@ use core::to_str::ToStr;
 use core::vec;
 
 pub trait gen_send {
-    fn gen_send(&mut self, cx: ext_ctxt, try: bool) -> @ast::item;
-    fn to_ty(&mut self, cx: ext_ctxt) -> @ast::Ty;
+    fn gen_send(&mut self, cx: @ext_ctxt, try: bool) -> @ast::item;
+    fn to_ty(&mut self, cx: @ext_ctxt) -> @ast::Ty;
 }
 
 pub trait to_type_decls {
-    fn to_type_decls(&self, cx: ext_ctxt) -> ~[@ast::item];
-    fn to_endpoint_decls(&self, cx: ext_ctxt,
+    fn to_type_decls(&self, cx: @ext_ctxt) -> ~[@ast::item];
+    fn to_endpoint_decls(&self, cx: @ext_ctxt,
                          dir: direction) -> ~[@ast::item];
 }
 
 pub trait gen_init {
-    fn gen_init(&self, cx: ext_ctxt) -> @ast::item;
-    fn compile(&self, cx: ext_ctxt) -> @ast::item;
-    fn buffer_ty_path(&self, cx: ext_ctxt) -> @ast::Ty;
-    fn gen_buffer_type(&self, cx: ext_ctxt) -> @ast::item;
-    fn gen_buffer_init(&self, ext_cx: ext_ctxt) -> @ast::expr;
-    fn gen_init_bounded(&self, ext_cx: ext_ctxt) -> @ast::expr;
+    fn gen_init(&self, cx: @ext_ctxt) -> @ast::item;
+    fn compile(&self, cx: @ext_ctxt) -> @ast::item;
+    fn buffer_ty_path(&self, cx: @ext_ctxt) -> @ast::Ty;
+    fn gen_buffer_type(&self, cx: @ext_ctxt) -> @ast::item;
+    fn gen_buffer_init(&self, ext_cx: @ext_ctxt) -> @ast::expr;
+    fn gen_init_bounded(&self, ext_cx: @ext_ctxt) -> @ast::expr;
 }
 
 impl gen_send for message {
-    fn gen_send(&mut self, cx: ext_ctxt, try: bool) -> @ast::item {
+    fn gen_send(&mut self, cx: @ext_ctxt, try: bool) -> @ast::item {
         debug!("pipec: gen_send");
         let name = self.name();
 
@@ -188,14 +188,14 @@ impl gen_send for message {
           }
         }
 
-    fn to_ty(&mut self, cx: ext_ctxt) -> @ast::Ty {
+    fn to_ty(&mut self, cx: @ext_ctxt) -> @ast::Ty {
         cx.ty_path_ast_builder(path(~[cx.ident_of(self.name())], self.span())
           .add_tys(cx.ty_vars_global(&self.get_generics().ty_params)))
     }
 }
 
 impl to_type_decls for state {
-    fn to_type_decls(&self, cx: ext_ctxt) -> ~[@ast::item] {
+    fn to_type_decls(&self, cx: @ext_ctxt) -> ~[@ast::item] {
         debug!("pipec: to_type_decls");
         // This compiles into two different type declarations. Say the
         // state is called ping. This will generate both `ping` and
@@ -244,7 +244,7 @@ impl to_type_decls for state {
         ]
     }
 
-    fn to_endpoint_decls(&self, cx: ext_ctxt,
+    fn to_endpoint_decls(&self, cx: @ext_ctxt,
                          dir: direction) -> ~[@ast::item] {
         debug!("pipec: to_endpoint_decls");
         let dir = match dir {
@@ -306,7 +306,7 @@ impl to_type_decls for state {
 }
 
 impl gen_init for protocol {
-    fn gen_init(&self, cx: ext_ctxt) -> @ast::item {
+    fn gen_init(&self, cx: @ext_ctxt) -> @ast::item {
         let ext_cx = cx;
 
         debug!("gen_init");
@@ -344,7 +344,7 @@ impl gen_init for protocol {
                            body.to_source(cx)))
     }
 
-    fn gen_buffer_init(&self, ext_cx: ext_ctxt) -> @ast::expr {
+    fn gen_buffer_init(&self, ext_cx: @ext_ctxt) -> @ast::expr {
         ext_cx.struct_expr(path(~[ext_cx.ident_of(~"__Buffer")],
                                 dummy_sp()),
                       self.states.map_to_vec(|s| {
@@ -356,7 +356,7 @@ impl gen_init for protocol {
         }))
     }
 
-    fn gen_init_bounded(&self, ext_cx: ext_ctxt) -> @ast::expr {
+    fn gen_init_bounded(&self, ext_cx: @ext_ctxt) -> @ast::expr {
         debug!("gen_init_bounded");
         let buffer_fields = self.gen_buffer_init(ext_cx);
         let buffer = quote_expr!(~::core::pipes::Buffer {
@@ -382,7 +382,7 @@ impl gen_init for protocol {
         })
     }
 
-    fn buffer_ty_path(&self, cx: ext_ctxt) -> @ast::Ty {
+    fn buffer_ty_path(&self, cx: @ext_ctxt) -> @ast::Ty {
         let mut params: OptVec<ast::TyParam> = opt_vec::Empty;
         for (copy self.states).each |s| {
             for s.generics.ty_params.each |tp| {
@@ -399,7 +399,7 @@ impl gen_init for protocol {
                                .add_tys(cx.ty_vars_global(&params)))
     }
 
-    fn gen_buffer_type(&self, cx: ext_ctxt) -> @ast::item {
+    fn gen_buffer_type(&self, cx: @ext_ctxt) -> @ast::item {
         let ext_cx = cx;
         let mut params: OptVec<ast::TyParam> = opt_vec::Empty;
         let fields = do (copy self.states).map_to_vec |s| {
@@ -442,7 +442,7 @@ impl gen_init for protocol {
             cx.strip_bounds(&generics))
     }
 
-    fn compile(&self, cx: ext_ctxt) -> @ast::item {
+    fn compile(&self, cx: @ext_ctxt) -> @ast::item {
         let mut items = ~[self.gen_init(cx)];
         let mut client_states = ~[];
         let mut server_states = ~[];
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index dc9abd536d1..60df7623e40 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -96,7 +96,7 @@ pub impl state_ {
     }
 
     /// Returns the type that is used for the messages.
-    fn to_ty(&self, cx: ext_ctxt) -> @ast::Ty {
+    fn to_ty(&self, cx: @ext_ctxt) -> @ast::Ty {
         cx.ty_path_ast_builder
             (path(~[cx.ident_of(self.name)],self.span).add_tys(
                 cx.ty_vars(&self.generics.ty_params)))
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 49d5ed1d0cc..6deffbe0ae1 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -49,11 +49,11 @@ pub mod rt {
     use print::pprust::{item_to_str, ty_to_str};
 
     pub trait ToTokens {
-        pub fn to_tokens(&self, _cx: ext_ctxt) -> ~[token_tree];
+        pub fn to_tokens(&self, _cx: @ext_ctxt) -> ~[token_tree];
     }
 
     impl ToTokens for ~[token_tree] {
-        pub fn to_tokens(&self, _cx: ext_ctxt) -> ~[token_tree] {
+        pub fn to_tokens(&self, _cx: @ext_ctxt) -> ~[token_tree] {
             copy *self
         }
     }
@@ -62,10 +62,10 @@ pub mod rt {
 
     trait ToSource : ToTokens {
         // Takes a thing and generates a string containing rust code for it.
-        pub fn to_source(cx: ext_ctxt) -> ~str;
+        pub fn to_source(cx: @ext_ctxt) -> ~str;
 
         // If you can make source, you can definitely make tokens.
-        pub fn to_tokens(cx: ext_ctxt) -> ~[token_tree] {
+        pub fn to_tokens(cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
@@ -74,47 +74,47 @@ pub mod rt {
 
     pub trait ToSource {
         // Takes a thing and generates a string containing rust code for it.
-        pub fn to_source(&self, cx: ext_ctxt) -> ~str;
+        pub fn to_source(&self, cx: @ext_ctxt) -> ~str;
     }
 
     impl ToSource for ast::ident {
-        fn to_source(&self, cx: ext_ctxt) -> ~str {
+        fn to_source(&self, cx: @ext_ctxt) -> ~str {
             copy *cx.parse_sess().interner.get(*self)
         }
     }
 
     impl ToSource for @ast::item {
-        fn to_source(&self, cx: ext_ctxt) -> ~str {
+        fn to_source(&self, cx: @ext_ctxt) -> ~str {
             item_to_str(*self, cx.parse_sess().interner)
         }
     }
 
     impl ToSource for ~[@ast::item] {
-        fn to_source(&self, cx: ext_ctxt) -> ~str {
+        fn to_source(&self, cx: @ext_ctxt) -> ~str {
             str::connect(self.map(|i| i.to_source(cx)), ~"\n\n")
         }
     }
 
     impl ToSource for @ast::Ty {
-        fn to_source(&self, cx: ext_ctxt) -> ~str {
+        fn to_source(&self, cx: @ext_ctxt) -> ~str {
             ty_to_str(*self, cx.parse_sess().interner)
         }
     }
 
     impl ToSource for ~[@ast::Ty] {
-        fn to_source(&self, cx: ext_ctxt) -> ~str {
+        fn to_source(&self, cx: @ext_ctxt) -> ~str {
             str::connect(self.map(|i| i.to_source(cx)), ~", ")
         }
     }
 
     impl ToSource for Generics {
-        fn to_source(&self, cx: ext_ctxt) -> ~str {
+        fn to_source(&self, cx: @ext_ctxt) -> ~str {
             pprust::generics_to_str(self, cx.parse_sess().interner)
         }
     }
 
     impl ToSource for @ast::expr {
-        fn to_source(&self, cx: ext_ctxt) -> ~str {
+        fn to_source(&self, cx: @ext_ctxt) -> ~str {
             pprust::expr_to_str(*self, cx.parse_sess().interner)
         }
     }
@@ -122,43 +122,43 @@ pub mod rt {
     // Alas ... we write these out instead. All redundant.
 
     impl ToTokens for ast::ident {
-        fn to_tokens(&self, cx: ext_ctxt) -> ~[token_tree] {
+        fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
 
     impl ToTokens for @ast::item {
-        fn to_tokens(&self, cx: ext_ctxt) -> ~[token_tree] {
+        fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
 
     impl ToTokens for ~[@ast::item] {
-        fn to_tokens(&self, cx: ext_ctxt) -> ~[token_tree] {
+        fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
 
     impl ToTokens for @ast::Ty {
-        fn to_tokens(&self, cx: ext_ctxt) -> ~[token_tree] {
+        fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
 
     impl ToTokens for ~[@ast::Ty] {
-        fn to_tokens(&self, cx: ext_ctxt) -> ~[token_tree] {
+        fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
 
     impl ToTokens for Generics {
-        fn to_tokens(&self, cx: ext_ctxt) -> ~[token_tree] {
+        fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
 
     impl ToTokens for @ast::expr {
-        fn to_tokens(&self, cx: ext_ctxt) -> ~[token_tree] {
+        fn to_tokens(&self, cx: @ext_ctxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source(cx))
         }
     }
@@ -170,7 +170,7 @@ pub mod rt {
         fn parse_tts(&self, s: ~str) -> ~[ast::token_tree];
     }
 
-    impl ExtParseUtils for ext_ctxt {
+    impl ExtParseUtils for @ext_ctxt {
 
         fn parse_item(&self, s: ~str) -> @ast::item {
             let res = parse::parse_item_from_source_str(
@@ -216,19 +216,19 @@ pub mod rt {
 
 }
 
-pub fn expand_quote_tokens(cx: ext_ctxt,
+pub fn expand_quote_tokens(cx: @ext_ctxt,
                            sp: span,
                            tts: &[ast::token_tree]) -> base::MacResult {
     base::MRExpr(expand_tts(cx, sp, tts))
 }
 
-pub fn expand_quote_expr(cx: ext_ctxt,
+pub fn expand_quote_expr(cx: @ext_ctxt,
                          sp: span,
                          tts: &[ast::token_tree]) -> base::MacResult {
     base::MRExpr(expand_parse_call(cx, sp, ~"parse_expr", ~[], tts))
 }
 
-pub fn expand_quote_item(cx: ext_ctxt,
+pub fn expand_quote_item(cx: @ext_ctxt,
                          sp: span,
                          tts: &[ast::token_tree]) -> base::MacResult {
     let e_attrs = build::mk_uniq_vec_e(cx, sp, ~[]);
@@ -236,7 +236,7 @@ pub fn expand_quote_item(cx: ext_ctxt,
                                     ~[e_attrs], tts))
 }
 
-pub fn expand_quote_pat(cx: ext_ctxt,
+pub fn expand_quote_pat(cx: @ext_ctxt,
                         sp: span,
                         tts: &[ast::token_tree]) -> base::MacResult {
     let e_refutable = build::mk_lit(cx, sp, ast::lit_bool(true));
@@ -244,7 +244,7 @@ pub fn expand_quote_pat(cx: ext_ctxt,
                                     ~[e_refutable], tts))
 }
 
-pub fn expand_quote_ty(cx: ext_ctxt,
+pub fn expand_quote_ty(cx: @ext_ctxt,
                        sp: span,
                        tts: &[ast::token_tree]) -> base::MacResult {
     let e_param_colons = build::mk_lit(cx, sp, ast::lit_bool(false));
@@ -252,7 +252,7 @@ pub fn expand_quote_ty(cx: ext_ctxt,
                                     ~[e_param_colons], tts))
 }
 
-pub fn expand_quote_stmt(cx: ext_ctxt,
+pub fn expand_quote_stmt(cx: @ext_ctxt,
                          sp: span,
                          tts: &[ast::token_tree]) -> base::MacResult {
     let e_attrs = build::mk_uniq_vec_e(cx, sp, ~[]);
@@ -260,16 +260,16 @@ pub fn expand_quote_stmt(cx: ext_ctxt,
                                     ~[e_attrs], tts))
 }
 
-fn ids_ext(cx: ext_ctxt, strs: ~[~str]) -> ~[ast::ident] {
+fn ids_ext(cx: @ext_ctxt, strs: ~[~str]) -> ~[ast::ident] {
     strs.map(|str| cx.parse_sess().interner.intern(@copy *str))
 }
 
-fn id_ext(cx: ext_ctxt, +str: ~str) -> ast::ident {
+fn id_ext(cx: @ext_ctxt, +str: ~str) -> ast::ident {
     cx.parse_sess().interner.intern(@str)
 }
 
 // Lift an ident to the expr that evaluates to that ident.
-fn mk_ident(cx: ext_ctxt, sp: span, ident: ast::ident) -> @ast::expr {
+fn mk_ident(cx: @ext_ctxt, sp: span, ident: ast::ident) -> @ast::expr {
     let e_meth = build::mk_access(cx, sp,
                                   ids_ext(cx, ~[~"ext_cx"]),
                                   id_ext(cx, ~"ident_of"));
@@ -277,13 +277,13 @@ fn mk_ident(cx: ext_ctxt, sp: span, ident: ast::ident) -> @ast::expr {
     build::mk_call_(cx, sp, e_meth, ~[e_str])
 }
 
-fn mk_bytepos(cx: ext_ctxt, sp: span, bpos: BytePos) -> @ast::expr {
+fn mk_bytepos(cx: @ext_ctxt, sp: span, bpos: BytePos) -> @ast::expr {
     let path = ids_ext(cx, ~[~"BytePos"]);
     let arg = build::mk_uint(cx, sp, bpos.to_uint());
     build::mk_call(cx, sp, path, ~[arg])
 }
 
-fn mk_binop(cx: ext_ctxt, sp: span, bop: token::binop) -> @ast::expr {
+fn mk_binop(cx: @ext_ctxt, sp: span, bop: token::binop) -> @ast::expr {
     let name = match bop {
         PLUS => "PLUS",
         MINUS => "MINUS",
@@ -300,7 +300,7 @@ fn mk_binop(cx: ext_ctxt, sp: span, bop: token::binop) -> @ast::expr {
                    ids_ext(cx, ~[name.to_owned()]))
 }
 
-fn mk_token(cx: ext_ctxt, sp: span, tok: token::Token) -> @ast::expr {
+fn mk_token(cx: @ext_ctxt, sp: span, tok: token::Token) -> @ast::expr {
 
     match tok {
         BINOP(binop) => {
@@ -443,7 +443,7 @@ fn mk_token(cx: ext_ctxt, sp: span, tok: token::Token) -> @ast::expr {
 }
 
 
-fn mk_tt(cx: ext_ctxt, sp: span, tt: &ast::token_tree)
+fn mk_tt(cx: @ext_ctxt, sp: span, tt: &ast::token_tree)
     -> ~[@ast::stmt] {
 
     match *tt {
@@ -494,7 +494,7 @@ fn mk_tt(cx: ext_ctxt, sp: span, tt: &ast::token_tree)
     }
 }
 
-fn mk_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+fn mk_tts(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> ~[@ast::stmt] {
     let mut ss = ~[];
     for tts.each |tt| {
@@ -503,7 +503,7 @@ fn mk_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
     ss
 }
 
-fn expand_tts(cx: ext_ctxt,
+fn expand_tts(cx: @ext_ctxt,
               sp: span,
               tts: &[ast::token_tree]) -> @ast::expr {
 
@@ -577,7 +577,7 @@ fn expand_tts(cx: ext_ctxt,
                                         ids_ext(cx, ~[~"tt"]))))
 }
 
-fn expand_parse_call(cx: ext_ctxt,
+fn expand_parse_call(cx: @ext_ctxt,
                      sp: span,
                      +parse_method: ~str,
                      +arg_exprs: ~[@ast::expr],
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 296305bb62e..b2de322be55 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -29,7 +29,7 @@ use core::vec;
 // a given file into the current one.
 
 /* line!(): expands to the current line number */
-pub fn expand_line(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_line(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "line!");
 
@@ -40,7 +40,7 @@ pub fn expand_line(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
 }
 
 /* col!(): expands to the current column number */
-pub fn expand_col(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_col(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "col!");
 
@@ -52,7 +52,7 @@ pub fn expand_col(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
 /* file!(): expands to the current filename */
 /* The filemap (`loc.file`) contains a bunch more information we could spit
  * out if we wanted. */
-pub fn expand_file(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_file(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "file!");
 
@@ -62,13 +62,13 @@ pub fn expand_file(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
     base::MRExpr(mk_base_str(cx, topmost.call_site, filename))
 }
 
-pub fn expand_stringify(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_stringify(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     let s = pprust::tts_to_str(tts, cx.parse_sess().interner);
     base::MRExpr(mk_base_str(cx, sp, s))
 }
 
-pub fn expand_mod(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_mod(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "module_path!");
     base::MRExpr(mk_base_str(cx, sp,
@@ -79,7 +79,7 @@ pub fn expand_mod(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
 // include! : parse the given file as an expr
 // This is generally a bad idea because it's going to behave
 // unhygienically.
-pub fn expand_include(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_include(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     let file = get_single_str_from_tts(cx, sp, tts, "include!");
     let p = parse::new_sub_parser_from_file(
@@ -89,7 +89,7 @@ pub fn expand_include(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
 }
 
 // include_str! : read the given file, insert it as a literal string expr
-pub fn expand_include_str(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_include_str(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     let file = get_single_str_from_tts(cx, sp, tts, "include_str!");
     let res = io::read_whole_file_str(&res_rel_file(cx, sp, &Path(file)));
@@ -103,7 +103,7 @@ pub fn expand_include_str(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
     base::MRExpr(mk_base_str(cx, sp, result::unwrap(res)))
 }
 
-pub fn expand_include_bin(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
+pub fn expand_include_bin(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     let file = get_single_str_from_tts(cx, sp, tts, "include_bin!");
     match io::read_whole_file(&res_rel_file(cx, sp, &Path(file))) {
@@ -147,7 +147,7 @@ fn topmost_expn_info(expn_info: @codemap::ExpnInfo) -> @codemap::ExpnInfo {
 
 // resolve a file-system path to an absolute file-system path (if it
 // isn't already)
-fn res_rel_file(cx: ext_ctxt, sp: codemap::span, arg: &Path) -> Path {
+fn res_rel_file(cx: @ext_ctxt, sp: codemap::span, arg: &Path) -> Path {
     // NB: relative paths are resolved relative to the compilation unit
     if !arg.is_absolute {
         let cu = Path(cx.codemap().span_to_filename(sp));
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index b53523f78a4..29a959013f2 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -17,8 +17,10 @@ use ext::base;
 use parse::lexer::{new_tt_reader, reader};
 use parse::parser::Parser;
 
-pub fn expand_trace_macros(cx: ext_ctxt, sp: span,
-                           tt: &[ast::token_tree]) -> base::MacResult {
+pub fn expand_trace_macros(cx: @ext_ctxt,
+                           sp: span,
+                           tt: &[ast::token_tree])
+                        -> base::MacResult {
     let sess = cx.parse_sess();
     let cfg = cx.cfg();
     let tt_rdr = new_tt_reader(
@@ -27,7 +29,7 @@ pub fn expand_trace_macros(cx: ext_ctxt, sp: span,
         None,
         vec::from_slice(tt)
     );
-    let rdr = tt_rdr as reader;
+    let rdr = tt_rdr as @reader;
     let rust_parser = Parser(
         sess,
         copy cfg,
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 88797a15206..b0628437bb0 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -224,7 +224,7 @@ pub enum parse_result {
 pub fn parse_or_else(
     sess: @mut ParseSess,
     +cfg: ast::crate_cfg,
-    rdr: reader,
+    rdr: @reader,
     ms: ~[matcher]
 ) -> HashMap<ident, @named_match> {
     match parse(sess, cfg, rdr, ms) {
@@ -237,7 +237,7 @@ pub fn parse_or_else(
 pub fn parse(
     sess: @mut ParseSess,
     cfg: ast::crate_cfg,
-    rdr: reader,
+    rdr: @reader,
     ms: ~[matcher]
 ) -> parse_result {
     let mut cur_eis = ~[];
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index e5b7152bea2..dcc84ce46fe 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -27,8 +27,11 @@ use print;
 
 use core::io;
 
-pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
-                         arg: ~[ast::token_tree]) -> base::MacResult {
+pub fn add_new_extension(cx: @ext_ctxt,
+                         sp: span,
+                         name: ident,
+                         arg: ~[ast::token_tree])
+                      -> base::MacResult {
     // these spans won't matter, anyways
     fn ms(m: matcher_) -> matcher {
         spanned { node: copy m, span: dummy_sp() }
@@ -54,8 +57,10 @@ pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
     // Parse the macro_rules! invocation (`none` is for no interpolations):
     let arg_reader = new_tt_reader(copy cx.parse_sess().span_diagnostic,
                                    cx.parse_sess().interner, None, copy arg);
-    let argument_map = parse_or_else(cx.parse_sess(), cx.cfg(),
-                                     arg_reader as reader, argument_gram);
+    let argument_map = parse_or_else(cx.parse_sess(),
+                                     cx.cfg(),
+                                     arg_reader as @reader,
+                                     argument_gram);
 
     // Extract the arguments:
     let lhses = match argument_map.get(&lhs_nm) {
@@ -69,7 +74,7 @@ pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
     };
 
     // Given `lhses` and `rhses`, this is the new macro we create
-    fn generic_extension(cx: ext_ctxt, sp: span, name: ident,
+    fn generic_extension(cx: @ext_ctxt, sp: span, name: ident,
                          arg: &[ast::token_tree],
                          lhses: ~[@named_match], rhses: ~[@named_match])
     -> MacResult {
@@ -98,7 +103,7 @@ pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
                     itr,
                     None,
                     vec::from_slice(arg)
-                ) as reader;
+                ) as @reader;
                 match parse(cx.parse_sess(), cx.cfg(), arg_rdr, (*mtcs)) {
                   success(named_matches) => {
                     let rhs = match rhses[i] {
@@ -118,8 +123,9 @@ pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
                     // rhs has holes ( `$id` and `$(...)` that need filled)
                     let trncbr = new_tt_reader(s_d, itr, Some(named_matches),
                                                rhs);
-                    let p = @Parser(cx.parse_sess(), cx.cfg(),
-                                    trncbr as reader);
+                    let p = @Parser(cx.parse_sess(),
+                                    cx.cfg(),
+                                    trncbr as @reader);
 
                     // Let the context choose how to interpret the result.
                     // Weird, but useful for X-macros.
@@ -140,7 +146,7 @@ pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
         cx.span_fatal(best_fail_spot, best_fail_msg);
     }
 
-    let exp: @fn(ext_ctxt, span, &[ast::token_tree]) -> MacResult =
+    let exp: @fn(@ext_ctxt, span, &[ast::token_tree]) -> MacResult =
         |cx, sp, arg| generic_extension(cx, sp, name, arg, lhses, rhses);
 
     return MRDef(MacroDef{
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 589b7693f9e..908fbd44825 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -34,7 +34,7 @@ struct TtFrame {
 }
 
 pub struct TtReader {
-    sp_diag: span_handler,
+    sp_diag: @span_handler,
     interner: @ident_interner,
     // the unzipped tree:
     cur: @mut TtFrame,
@@ -50,7 +50,7 @@ pub struct TtReader {
 /** This can do Macro-By-Example transcription. On the other hand, if
  *  `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and
  *  should) be none. */
-pub fn new_tt_reader(sp_diag: span_handler,
+pub fn new_tt_reader(sp_diag: @span_handler,
                      itr: @ident_interner,
                      interp: Option<std::oldmap::HashMap<ident,@named_match>>,
                      +src: ~[ast::token_tree])