about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-01-29 14:41:40 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-01-29 14:42:23 -0800
commitb07059056463272788042a263b6cf8eb8be2533a (patch)
tree732c24f16156ae8302dde8a54de48aa433cb1803 /src
parenta80a65b3b7affa9b070785bf2dd34a25aea3932a (diff)
libsyntax: De-export libsyntax. rs=deexporting
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/ext/auto_encode.rs7
-rw-r--r--src/libsyntax/ext/base.rs48
-rw-r--r--src/libsyntax/ext/build.rs234
-rw-r--r--src/libsyntax/ext/concat_idents.rs2
-rw-r--r--src/libsyntax/ext/env.rs4
-rw-r--r--src/libsyntax/ext/expand.rs50
-rw-r--r--src/libsyntax/ext/fmt.rs4
-rw-r--r--src/libsyntax/ext/log_syntax.rs6
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs2
-rw-r--r--src/libsyntax/ext/pipes/mod.rs17
-rw-r--r--src/libsyntax/ext/source_util.rs25
-rw-r--r--src/libsyntax/ext/trace_macros.rs4
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs37
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs4
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs16
-rw-r--r--src/libsyntax/fold.rs57
-rw-r--r--src/libsyntax/parse/eval.rs24
-rw-r--r--src/libsyntax/print/pp.rs68
-rw-r--r--src/libsyntax/print/pprust.rs371
-rw-r--r--src/libsyntax/syntax.rc97
-rw-r--r--src/libsyntax/util/interner.rs18
-rw-r--r--src/libsyntax/visit.rs94
22 files changed, 579 insertions, 610 deletions
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index 1bb516e831f..e4ad518cc80 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -101,16 +101,13 @@ use core::vec;
 use std::map;
 use std::map::HashMap;
 
-export expand_auto_encode;
-export expand_auto_decode;
-
 // Transitional reexports so qquote can find the paths it is looking for
 mod syntax {
     pub use ext;
     pub use parse;
 }
 
-fn expand_auto_encode(
+pub fn expand_auto_encode(
     cx: ext_ctxt,
     span: span,
     _mitem: ast::meta_item,
@@ -165,7 +162,7 @@ fn expand_auto_encode(
     }
 }
 
-fn expand_auto_decode(
+pub fn expand_auto_decode(
     cx: ext_ctxt,
     span: span,
     _mitem: ast::meta_item,
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index a8c05296390..d0974e0654c 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -32,38 +32,38 @@ use std::map::HashMap;
 // is now probably a redundant AST node, can be merged with
 // ast::mac_invoc_tt.
 
-struct MacroDef {
+pub struct MacroDef {
     name: ~str,
     ext: SyntaxExtension
 }
 
-type ItemDecorator =
+pub type ItemDecorator =
     fn@(ext_ctxt, span, ast::meta_item, ~[@ast::item]) -> ~[@ast::item];
 
-struct SyntaxExpanderTT {
+pub struct SyntaxExpanderTT {
     expander: SyntaxExpanderTTFun,
     span: Option<span>
 }
 
-type SyntaxExpanderTTFun = fn@(ext_ctxt, span, ~[ast::token_tree])
-    -> MacResult;
+pub type SyntaxExpanderTTFun = fn@(ext_ctxt, span, ~[ast::token_tree])
+                                -> MacResult;
 
-struct SyntaxExpanderTTItem {
+pub struct SyntaxExpanderTTItem {
     expander: SyntaxExpanderTTItemFun,
     span: Option<span>
 }
 
-type SyntaxExpanderTTItemFun
+pub type SyntaxExpanderTTItemFun
     = fn@(ext_ctxt, span, ast::ident, ~[ast::token_tree]) -> MacResult;
 
-enum MacResult {
+pub enum MacResult {
     MRExpr(@ast::expr),
     MRItem(@ast::item),
     MRAny(fn@()-> @ast::expr, fn@()-> Option<@ast::item>, fn@()->@ast::stmt),
     MRDef(MacroDef)
 }
 
-enum SyntaxExtension {
+pub enum SyntaxExtension {
 
     // #[auto_encode] and such
     ItemDecorator(ItemDecorator),
@@ -78,7 +78,7 @@ enum SyntaxExtension {
 
 // A temporary hard-coded map of methods for expanding syntax extension
 // AST nodes into full ASTs
-fn syntax_expander_table() -> HashMap<~str, SyntaxExtension> {
+pub fn syntax_expander_table() -> HashMap<~str, SyntaxExtension> {
     fn builtin_normal_tt(f: SyntaxExpanderTTFun) -> SyntaxExtension {
         NormalTT(SyntaxExpanderTT{expander: f, span: None})
     }
@@ -161,7 +161,7 @@ fn syntax_expander_table() -> HashMap<~str, SyntaxExtension> {
 // One of these is made during expansion and incrementally updated as we go;
 // when a macro expansion occurs, the resulting nodes have the backtrace()
 // -> expn_info of their expansion context stored into their span.
-trait ext_ctxt {
+pub trait ext_ctxt {
     fn codemap() -> @CodeMap;
     fn parse_sess() -> parse::parse_sess;
     fn cfg() -> ast::crate_cfg;
@@ -187,8 +187,8 @@ trait ext_ctxt {
     fn ident_of(st: ~str) -> ast::ident;
 }
 
-fn mk_ctxt(parse_sess: parse::parse_sess,
-           cfg: ast::crate_cfg) -> ext_ctxt {
+pub fn mk_ctxt(parse_sess: parse::parse_sess,
+               cfg: ast::crate_cfg) -> ext_ctxt {
     type ctxt_repr = {parse_sess: parse::parse_sess,
                       cfg: ast::crate_cfg,
                       mut backtrace: Option<@ExpnInfo>,
@@ -281,7 +281,7 @@ fn mk_ctxt(parse_sess: parse::parse_sess,
     move ((move imp) as ext_ctxt)
 }
 
-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) => return *s,
@@ -291,9 +291,9 @@ fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
     }
 }
 
-fn expr_to_ident(cx: ext_ctxt,
-                 expr: @ast::expr,
-                 err_msg: ~str) -> ast::ident {
+pub fn expr_to_ident(cx: ext_ctxt,
+                     expr: @ast::expr,
+                     err_msg: ~str) -> ast::ident {
     match expr.node {
       ast::expr_path(p) => {
         if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
@@ -305,15 +305,17 @@ fn expr_to_ident(cx: ext_ctxt,
     }
 }
 
-fn check_zero_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
-                  name: &str) {
+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));
     }
 }
 
-fn get_single_str_from_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
-                           name: &str) -> ~str {
+pub fn get_single_str_from_tts(cx: ext_ctxt,
+                               sp: span,
+                               tts: &[ast::token_tree],
+                               name: &str) -> ~str {
     if tts.len() != 1 {
         cx.span_fatal(sp, fmt!("%s takes 1 argument.", name));
     }
@@ -325,8 +327,8 @@ fn get_single_str_from_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
     }
 }
 
-fn get_exprs_from_tts(cx: ext_ctxt, tts: ~[ast::token_tree])
-    -> ~[@ast::expr] {
+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(),
                                        tts);
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 5ff69539606..d4da5a2034e 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -19,7 +19,10 @@ use ext::build;
 use core::dvec;
 use core::option;
 
-fn mk_expr(cx: ext_ctxt, sp: codemap::span, expr: ast::expr_) -> @ast::expr {
+pub fn mk_expr(cx: ext_ctxt,
+               sp: codemap::span,
+               expr: ast::expr_)
+            -> @ast::expr {
     @ast::expr {
         id: cx.next_id(),
         callee_id: cx.next_id(),
@@ -28,34 +31,33 @@ fn mk_expr(cx: ext_ctxt, sp: codemap::span, expr: ast::expr_) -> @ast::expr {
     }
 }
 
-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 = @ast::spanned { node: lit, span: sp };
     mk_expr(cx, sp, ast::expr_lit(sp_lit))
 }
-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);
 }
-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);
 }
-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);
 }
-fn mk_binary(cx: ext_ctxt, sp: span, op: ast::binop,
-             lhs: @ast::expr, rhs: @ast::expr)
-   -> @ast::expr {
+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))
 }
-fn mk_unary(cx: ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
-    -> @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))
 }
-fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::path {
+pub fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::path {
     let p = @ast::path { span: sp,
                          global: false,
                          idents: idents,
@@ -63,126 +65,129 @@ fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::path {
                          types: ~[] };
     return p;
 }
-fn mk_raw_path_(sp: span,
-                idents: ~[ast::ident],
-                +types: ~[@ast::Ty])
-             -> @ast::path {
+pub fn mk_raw_path_(sp: span,
+                    idents: ~[ast::ident],
+                    +types: ~[@ast::Ty])
+                 -> @ast::path {
     @ast::path { span: sp,
                  global: false,
                  idents: idents,
                  rp: None,
                  types: move types }
 }
-fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path {
+pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path {
     @ast::path { span: sp,
                  global: true,
                  idents: idents,
                  rp: None,
                  types: ~[] }
 }
-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)))
 }
-fn mk_path_global(cx: ext_ctxt, sp: span, idents: ~[ast::ident]) ->
-    @ast::expr {
+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)))
 }
-fn mk_access_(cx: ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)
-    -> @ast::expr {
+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, ~[]))
 }
-fn mk_access(cx: ext_ctxt, sp: span, p: ~[ast::ident], m: ast::ident)
-    -> @ast::expr {
+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);
 }
-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));
 }
-fn mk_call_(cx: ext_ctxt, sp: span, fn_expr: @ast::expr,
-            args: ~[@ast::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, false))
 }
-fn mk_call(cx: ext_ctxt, sp: span, fn_path: ~[ast::ident],
-             args: ~[@ast::expr]) -> @ast::expr {
+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);
 }
-fn mk_call_global(cx: ext_ctxt, sp: span, fn_path: ~[ast::ident],
-                  args: ~[@ast::expr]) -> @ast::expr {
+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
-fn mk_base_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr]) ->
-   @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)
 }
-fn mk_vstore_e(cx: ext_ctxt, sp: span, expr: @ast::expr,
-               vst: ast::expr_vstore) ->
+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))
 }
-fn mk_uniq_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr]) ->
-   @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)
 }
-fn mk_slice_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr]) ->
-   @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)
 }
-fn mk_fixed_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr]) ->
-   @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))
 }
-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);
 }
-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)
 }
-fn mk_field(sp: span, f: &{ident: ast::ident, ex: @ast::expr})
-    -> ast::field {
+pub fn mk_field(sp: span, f: &{ident: ast::ident, ex: @ast::expr})
+             -> ast::field {
     ast::spanned {
         node: ast::field_ { mutbl: ast::m_imm, ident: f.ident, expr: f.ex },
         span: sp,
     }
 }
-fn mk_fields(sp: span, fields: ~[{ident: ast::ident, ex: @ast::expr}]) ->
-    ~[ast::field] {
+pub fn mk_fields(sp: span, fields: ~[{ident: ast::ident, ex: @ast::expr}])
+              -> ~[ast::field] {
     move fields.map(|f| mk_field(sp, f))
 }
-fn mk_rec_e(cx: ext_ctxt, sp: span,
-            fields: ~[{ident: ast::ident, ex: @ast::expr}]) ->
-    @ast::expr {
+pub fn mk_rec_e(cx: ext_ctxt,
+                sp: span,
+                fields: ~[{ident: ast::ident, ex: @ast::expr}])
+             -> @ast::expr {
     mk_expr(cx, sp, ast::expr_rec(mk_fields(sp, fields),
                                   option::None::<@ast::expr>))
 }
-fn mk_struct_e(cx: ext_ctxt, sp: span,
-               ctor_path: ~[ast::ident],
-               fields: ~[{ident: ast::ident, ex: @ast::expr}]) ->
-    @ast::expr {
+pub fn mk_struct_e(cx: ext_ctxt,
+                   sp: span,
+                   ctor_path: ~[ast::ident],
+                   fields: ~[{ident: ast::ident, ex: @ast::expr}])
+                -> @ast::expr {
     mk_expr(cx, sp,
             ast::expr_struct(mk_raw_path(sp, ctor_path),
                              mk_fields(sp, fields),
                                     option::None::<@ast::expr>))
 }
-fn mk_global_struct_e(cx: ext_ctxt, sp: span,
-               ctor_path: ~[ast::ident],
-               fields: ~[{ident: ast::ident, ex: @ast::expr}]) ->
-    @ast::expr {
+pub fn mk_global_struct_e(cx: ext_ctxt,
+                          sp: span,
+                          ctor_path: ~[ast::ident],
+                          fields: ~[{ident: ast::ident, ex: @ast::expr}])
+                       -> @ast::expr {
     mk_expr(cx, sp,
             ast::expr_struct(mk_raw_path_global(sp, ctor_path),
                              mk_fields(sp, fields),
                                     option::None::<@ast::expr>))
 }
-fn mk_glob_use(cx: ext_ctxt, sp: span,
-               path: ~[ast::ident]) -> @ast::view_item {
+pub fn mk_glob_use(cx: ext_ctxt,
+                   sp: span,
+                   path: ~[ast::ident]) -> @ast::view_item {
     let glob = @ast::spanned {
         node: ast::view_path_glob(mk_raw_path(sp, path), cx.next_id()),
         span: sp,
@@ -192,8 +197,8 @@ fn mk_glob_use(cx: ext_ctxt, sp: span,
                       vis: ast::private,
                       span: sp }
 }
-fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
-            ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
+pub fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
+                ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
 
     let pat = @ast::pat {
         id: cx.next_id(),
@@ -217,10 +222,10 @@ fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
     let decl = ast::spanned {node: ast::decl_local(~[local]), span: sp};
     @ast::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp }
 }
-fn mk_block(cx: ext_ctxt, span: span,
-            view_items: ~[@ast::view_item],
-            stmts: ~[@ast::stmt],
-            expr: Option<@ast::expr>) -> @ast::expr {
+pub fn mk_block(cx: ext_ctxt, span: span,
+                view_items: ~[@ast::view_item],
+                stmts: ~[@ast::stmt],
+                expr: Option<@ast::expr>) -> @ast::expr {
     let blk = ast::spanned {
         node: ast::blk_ {
              view_items: view_items,
@@ -233,7 +238,10 @@ fn mk_block(cx: ext_ctxt, span: span,
     };
     mk_expr(cx, span, ast::expr_block(blk))
 }
-fn mk_block_(cx: ext_ctxt, span: span, +stmts: ~[@ast::stmt]) -> ast::blk {
+pub fn mk_block_(cx: ext_ctxt,
+                 span: span,
+                 +stmts: ~[@ast::stmt])
+              -> ast::blk {
     ast::spanned {
         node: ast::blk_ {
             view_items: ~[],
@@ -245,7 +253,10 @@ fn mk_block_(cx: ext_ctxt, span: span, +stmts: ~[@ast::stmt]) -> ast::blk {
         span: span,
     }
 }
-fn mk_simple_block(cx: ext_ctxt, span: span, expr: @ast::expr) -> ast::blk {
+pub fn mk_simple_block(cx: ext_ctxt,
+                       span: span,
+                       expr: @ast::expr)
+                    -> ast::blk {
     ast::spanned {
         node: ast::blk_ {
             view_items: ~[],
@@ -257,80 +268,83 @@ fn mk_simple_block(cx: ext_ctxt, span: span, expr: @ast::expr) -> ast::blk {
         span: span,
     }
 }
-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))
 }
-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))
 }
-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 }
 }
-fn mk_pat_ident(cx: ext_ctxt, span: span, ident: ast::ident) -> @ast::pat {
+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_value)
 }
-fn mk_pat_ident_with_binding_mode(cx: ext_ctxt,
-                                  span: span,
-                                  ident: ast::ident,
-                                  bm: ast::binding_mode) -> @ast::pat {
+pub fn mk_pat_ident_with_binding_mode(cx: ext_ctxt,
+                                      span: span,
+                                      ident: ast::ident,
+                                      bm: ast::binding_mode) -> @ast::pat {
     let path = mk_raw_path(span, ~[ ident ]);
     let pat = ast::pat_ident(bm, path, None);
     mk_pat(cx, span, move pat)
 }
-fn mk_pat_enum(cx: ext_ctxt,
-               span: span,
-               path: @ast::path,
-               +subpats: ~[@ast::pat])
-            -> @ast::pat {
+pub fn mk_pat_enum(cx: ext_ctxt,
+                   span: span,
+                   path: @ast::path,
+                   +subpats: ~[@ast::pat])
+                -> @ast::pat {
     let pat = ast::pat_enum(path, Some(move subpats));
     mk_pat(cx, span, move pat)
 }
-fn mk_pat_struct(cx: ext_ctxt,
-                 span: span,
-                 path: @ast::path,
-                 +field_pats: ~[ast::field_pat])
-              -> @ast::pat {
+pub fn mk_pat_struct(cx: ext_ctxt,
+                     span: span,
+                     path: @ast::path,
+                     +field_pats: ~[ast::field_pat])
+                  -> @ast::pat {
     let pat = ast::pat_struct(path, move field_pats, false);
     mk_pat(cx, span, move pat)
 }
-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(@ast::spanned { node: ast::lit_bool(value),
                                                  span: span });
     build::mk_expr(cx, span, move lit_expr)
 }
-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());
     @ast::spanned { node: move stmt_, span: span }
 }
-fn mk_ty_path(cx: ext_ctxt,
-              span: span,
-              idents: ~[ ast::ident ])
-           -> @ast::Ty {
+pub fn mk_ty_path(cx: ext_ctxt,
+                  span: span,
+                  idents: ~[ ast::ident ])
+               -> @ast::Ty {
     let ty = build::mk_raw_path(span, idents);
     let ty = ast::ty_path(ty, cx.next_id());
     let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span };
     ty
 }
-fn mk_ty_path_global(cx: ext_ctxt,
-                     span: span,
-                     idents: ~[ ast::ident ])
-                  -> @ast::Ty {
+pub fn mk_ty_path_global(cx: ext_ctxt,
+                         span: span,
+                         idents: ~[ ast::ident ])
+                      -> @ast::Ty {
     let ty = build::mk_raw_path_global(span, idents);
     let ty = ast::ty_path(ty, cx.next_id());
     let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span };
     ty
 }
-fn mk_simple_ty_path(cx: ext_ctxt,
-                     span: span,
-                     ident: ast::ident)
-                  -> @ast::Ty {
+pub fn mk_simple_ty_path(cx: ext_ctxt,
+                         span: span,
+                         ident: ast::ident)
+                      -> @ast::Ty {
     mk_ty_path(cx, span, ~[ ident ])
 }
-fn mk_arg(cx: ext_ctxt,
-          span: span,
-          ident: ast::ident,
-          ty: @ast::Ty)
-       -> ast::arg {
+pub fn mk_arg(cx: ext_ctxt,
+              span: span,
+              ident: ast::ident,
+              ty: @ast::Ty)
+           -> ast::arg {
     let arg_pat = mk_pat_ident(cx, span, ident);
     ast::arg {
         mode: ast::infer(cx.next_id()),
@@ -340,13 +354,13 @@ fn mk_arg(cx: ext_ctxt,
         id: cx.next_id()
     }
 }
-fn mk_fn_decl(+inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl {
+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 }
 }
-fn mk_ty_param(cx: ext_ctxt,
-               ident: ast::ident,
-               bounds: @~[ast::ty_param_bound])
-            -> ast::ty_param {
+pub fn mk_ty_param(cx: ext_ctxt,
+                   ident: ast::ident,
+                   bounds: @~[ast::ty_param_bound])
+                -> ast::ty_param {
     ast::ty_param { ident: ident, id: cx.next_id(), bounds: bounds }
 }
 
diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs
index 3d5d0b42cd0..d83a9f39c5b 100644
--- a/src/libsyntax/ext/concat_idents.rs
+++ b/src/libsyntax/ext/concat_idents.rs
@@ -13,7 +13,7 @@ use core::prelude::*;
 use ext::base::*;
 use ext::base;
 
-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/env.rs b/src/libsyntax/ext/env.rs
index ad827377ac4..4420c020a0b 100644
--- a/src/libsyntax/ext/env.rs
+++ b/src/libsyntax/ext/env.rs
@@ -22,9 +22,7 @@ use ext::build::mk_uniq_str;
 use core::option;
 use core::os;
 
-export expand_syntax_ext;
-
-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 068b372c069..0ab94710f40 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -22,11 +22,10 @@ use core::option;
 use core::vec;
 use std::map::HashMap;
 
-fn expand_expr(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
-               e: expr_, s: span, fld: ast_fold,
-               orig: fn@(expr_, span, ast_fold) -> (expr_, span))
-    -> (expr_, span)
-{
+pub fn expand_expr(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
+                   e: expr_, s: span, fld: ast_fold,
+                   orig: fn@(expr_, span, ast_fold) -> (expr_, span))
+                -> (expr_, span) {
     return match e {
       // expr_mac should really be expr_ext or something; it's the
       // entry-point for all syntax extensions.
@@ -88,11 +87,10 @@ fn expand_expr(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
 //
 // NB: there is some redundancy between this and expand_item, below, and
 // they might benefit from some amount of semantic and language-UI merger.
-fn expand_mod_items(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
-                    module_: ast::_mod, fld: ast_fold,
-                    orig: fn@(ast::_mod, ast_fold) -> ast::_mod)
-    -> ast::_mod
-{
+pub fn expand_mod_items(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
+                        module_: ast::_mod, fld: ast_fold,
+                        orig: fn@(ast::_mod, ast_fold) -> ast::_mod)
+                     -> ast::_mod {
     // Fold the contents first:
     let module_ = orig(module_, fld);
 
@@ -125,11 +123,10 @@ fn expand_mod_items(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
 
 
 // When we enter a module, record it, for the sake of `module!`
-fn expand_item(exts: HashMap<~str, SyntaxExtension>,
-               cx: ext_ctxt, &&it: @ast::item, fld: ast_fold,
-               orig: fn@(&&v: @ast::item, ast_fold) -> Option<@ast::item>)
-    -> Option<@ast::item>
-{
+pub fn expand_item(exts: HashMap<~str, SyntaxExtension>,
+                   cx: ext_ctxt, &&it: @ast::item, fld: ast_fold,
+                   orig: fn@(&&v: @ast::item, ast_fold) -> Option<@ast::item>)
+                -> Option<@ast::item> {
     let is_mod = match it.node {
       ast::item_mod(_) | ast::item_foreign_mod(_) => true,
       _ => false
@@ -152,9 +149,9 @@ fn expand_item(exts: HashMap<~str, SyntaxExtension>,
 
 // Support for item-position macro invocations, exactly the same
 // logic as for expression-position macro invocations.
-fn expand_item_mac(exts: HashMap<~str, SyntaxExtension>,
-                   cx: ext_ctxt, &&it: @ast::item,
-                   fld: ast_fold) -> Option<@ast::item> {
+pub fn expand_item_mac(exts: HashMap<~str, SyntaxExtension>,
+                       cx: ext_ctxt, &&it: @ast::item,
+                       fld: ast_fold) -> Option<@ast::item> {
 
     let (pth, tts) = match it.node {
         item_mac(ast::spanned { node: mac_invoc_tt(pth, ref tts), _}) => {
@@ -211,11 +208,10 @@ fn expand_item_mac(exts: HashMap<~str, SyntaxExtension>,
     return maybe_it;
 }
 
-fn expand_stmt(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
-               && s: stmt_, sp: span, fld: ast_fold,
-               orig: fn@(&&s: stmt_, span, ast_fold) -> (stmt_, span))
-    -> (stmt_, span)
-{
+pub fn expand_stmt(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
+                   && s: stmt_, sp: span, fld: ast_fold,
+                   orig: fn@(&&s: stmt_, span, ast_fold) -> (stmt_, span))
+                -> (stmt_, span) {
 
     let (mac, pth, tts, semi) = match s {
         stmt_mac(ref mac, semi) => {
@@ -267,7 +263,7 @@ fn expand_stmt(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
 }
 
 
-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()};
 }
@@ -277,7 +273,7 @@ fn new_span(cx: ext_ctxt, sp: span) -> span {
 // is substantially more mature, these should move from here, into a
 // compiled part of libcore at very least.
 
-fn core_macros() -> ~str {
+pub fn core_macros() -> ~str {
     return
 ~"{
     macro_rules! ignore (($($x:tt)*) => (()))
@@ -327,8 +323,8 @@ fn core_macros() -> ~str {
 }";
 }
 
-fn expand_crate(parse_sess: parse::parse_sess,
-                cfg: ast::crate_cfg, c: @crate) -> @crate {
+pub fn expand_crate(parse_sess: parse::parse_sess,
+                    cfg: ast::crate_cfg, c: @crate) -> @crate {
     let exts = syntax_expander_table();
     let afp = default_ast_fold();
     let cx: ext_ctxt = mk_ctxt(parse_sess, cfg);
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 65890351e39..845d26f77cb 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -25,9 +25,7 @@ use ext::base;
 use ext::build::*;
 use extfmt::ct::*;
 
-export expand_syntax_ext;
-
-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, copy tts);
     if args.len() == 0 {
diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs
index b92e0b58bd5..f713e5ce7d8 100644
--- a/src/libsyntax/ext/log_syntax.rs
+++ b/src/libsyntax/ext/log_syntax.rs
@@ -17,8 +17,10 @@ use print;
 use core::io::WriterUtil;
 use core::option;
 
-fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, tt: ~[ast::token_tree])
-    -> base::MacResult {
+pub fn expand_syntax_ext(cx: ext_ctxt,
+                         sp: codemap::span,
+                         tt: ~[ast::token_tree])
+                      -> base::MacResult {
 
     cx.print_backtrace();
     io::stdout().write_line(
diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs
index 2e73002a890..b0a8f49c7a2 100644
--- a/src/libsyntax/ext/pipes/liveness.rs
+++ b/src/libsyntax/ext/pipes/liveness.rs
@@ -40,7 +40,7 @@ updating the states using rule (2) until there are no changes.
 use core::prelude::*;
 
 use ext::base::ext_ctxt;
-use ext::pipes::protocol;
+use ext::pipes::proto::protocol;
 
 use core::str;
 use std::bitv::{Bitv};
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index c84ab54af2b..8f0f00f42c0 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -56,17 +56,16 @@ use parse::parser::Parser;
 
 use core::option::None;
 
-mod ast_builder;
-mod parse_proto;
-mod pipec;
-mod proto;
-mod check;
-mod liveness;
+pub mod ast_builder;
+pub mod parse_proto;
+pub mod pipec;
+pub mod proto;
+pub mod check;
+pub mod liveness;
 
 
-fn expand_proto(cx: ext_ctxt, _sp: span, id: ast::ident,
-                tt: ~[ast::token_tree]) -> base::MacResult
-{
+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(cx.parse_sess().span_diagnostic,
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 4ecbbdc9760..07dacc7c1b3 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -21,17 +21,8 @@ use core::result;
 use core::str;
 use core::vec;
 
-export expand_line;
-export expand_col;
-export expand_file;
-export expand_stringify;
-export expand_mod;
-export expand_include;
-export expand_include_str;
-export expand_include_bin;
-
 /* line!(): expands to the current line number */
-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!");
     let loc = cx.codemap().lookup_char_pos(sp.lo);
@@ -39,7 +30,7 @@ fn expand_line(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
 }
 
 /* col!(): expands to the current column number */
-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!");
     let loc = cx.codemap().lookup_char_pos(sp.lo);
@@ -49,7 +40,7 @@ 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. */
-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!");
     let Loc { file: @FileMap { name: filename, _ }, _ } =
@@ -57,13 +48,13 @@ fn expand_file(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
     base::MRExpr(mk_base_str(cx, sp, filename))
 }
 
-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))
 }
 
-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,
@@ -71,7 +62,7 @@ fn expand_mod(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
                                   |x| cx.str_of(*x)), ~"::")))
 }
 
-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(
@@ -80,7 +71,7 @@ fn expand_include(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
     base::MRExpr(p.parse_expr())
 }
 
-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)));
@@ -94,7 +85,7 @@ fn expand_include_str(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
     base::MRExpr(mk_base_str(cx, sp, result::unwrap(res)))
 }
 
-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))) {
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index e4ea46416d3..a87882c4f20 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -18,8 +18,8 @@ use parse::parser::Parser;
 
 use core::option::None;
 
-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(cx.parse_sess().span_diagnostic,
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index a990e53c1a7..4c0550b3c3a 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -101,18 +101,18 @@ eof: [a $( a )* a b ·]
 /* to avoid costly uniqueness checks, we require that `match_seq` always has a
 nonempty body. */
 
-enum matcher_pos_up { /* to break a circularity */
+pub enum matcher_pos_up { /* to break a circularity */
     matcher_pos_up(Option<matcher_pos>)
 }
 
-fn is_some(&&mpu: matcher_pos_up) -> bool {
+pub fn is_some(&&mpu: matcher_pos_up) -> bool {
     match &mpu {
       &matcher_pos_up(None) => false,
       _ => true
     }
 }
 
-type matcher_pos = ~{
+pub type matcher_pos = ~{
     elts: ~[ast::matcher], // maybe should be /&? Need to understand regions.
     sep: Option<Token>,
     mut idx: uint,
@@ -122,14 +122,14 @@ type matcher_pos = ~{
     sp_lo: BytePos,
 };
 
-fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
+pub fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
     match &mpu {
       &matcher_pos_up(Some(ref mp)) => copy (*mp),
       _ => fail
     }
 }
 
-fn count_names(ms: &[matcher]) -> uint {
+pub fn count_names(ms: &[matcher]) -> uint {
     vec::foldl(0u, ms, |ct, m| {
         ct + match m.node {
           match_tok(_) => 0u,
@@ -139,8 +139,8 @@ fn count_names(ms: &[matcher]) -> uint {
 }
 
 #[allow(non_implicitly_copyable_typarams)]
-fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
-    -> matcher_pos {
+pub fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
+                        -> matcher_pos {
     let mut match_idx_hi = 0u;
     for ms.each() |elt| {
         match elt.node {
@@ -177,15 +177,15 @@ fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
 // only on the nesting depth of ast::match_seqs in the originating
 // ast::matcher it was derived from.
 
-enum named_match {
+pub enum named_match {
     matched_seq(~[@named_match], codemap::span),
     matched_nonterminal(nonterminal)
 }
 
-type earley_item = matcher_pos;
+pub type earley_item = matcher_pos;
 
-fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
-    -> HashMap<ident,@named_match> {
+pub fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
+            -> HashMap<ident,@named_match> {
     fn n_rec(p_s: parse_sess, m: matcher, res: ~[@named_match],
              ret_val: HashMap<ident, @named_match>) {
         match m {
@@ -211,14 +211,14 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
     return ret_val;
 }
 
-enum parse_result {
+pub enum parse_result {
     success(HashMap<ident, @named_match>),
     failure(codemap::span, ~str),
     error(codemap::span, ~str)
 }
 
-fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
-                 ms: ~[matcher]) -> HashMap<ident, @named_match> {
+pub fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
+                     ms: ~[matcher]) -> HashMap<ident, @named_match> {
     match parse(sess, cfg, rdr, ms) {
       success(m) => m,
       failure(sp, ref str) => sess.span_diagnostic.span_fatal(sp, (*str)),
@@ -226,8 +226,11 @@ fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
     }
 }
 
-fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
-    -> parse_result {
+pub fn parse(sess: parse_sess,
+             cfg: ast::crate_cfg,
+             rdr: reader,
+             ms: ~[matcher])
+          -> parse_result {
     let mut cur_eis = ~[];
     cur_eis.push(initial_matcher_pos(ms, None, rdr.peek().sp.lo));
 
@@ -398,7 +401,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
     }
 }
 
-fn parse_nt(p: Parser, name: ~str) -> nonterminal {
+pub fn parse_nt(p: Parser, name: ~str) -> nonterminal {
     match name {
       ~"item" => match p.parse_item(~[]) {
         Some(i) => token::nt_item(i),
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index bcaa7679a5a..f7ef79db466 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -29,8 +29,8 @@ use print;
 use core::io;
 use std::map::HashMap;
 
-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 {
         ast::spanned { node: m, span: dummy_sp() }
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 47489034a0f..b3b1e04976a 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -23,8 +23,6 @@ use core::vec;
 use std;
 use std::map::HashMap;
 
-export tt_reader,  new_tt_reader, dup_tt_reader, tt_next_token;
-
 enum tt_frame_up { /* to break a circularity */
     tt_frame_up(Option<tt_frame>)
 }
@@ -40,7 +38,7 @@ type tt_frame = @{
     up: tt_frame_up,
 };
 
-type tt_reader = @{
+pub type tt_reader = @{
     sp_diag: span_handler,
     interner: @ident_interner,
     mut cur: tt_frame,
@@ -56,10 +54,10 @@ type tt_reader = @{
 /** 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. */
-fn new_tt_reader(sp_diag: span_handler, itr: @ident_interner,
-                 interp: Option<std::map::HashMap<ident,@named_match>>,
-                 src: ~[ast::token_tree])
-    -> tt_reader {
+pub fn new_tt_reader(sp_diag: span_handler, itr: @ident_interner,
+                     interp: Option<std::map::HashMap<ident,@named_match>>,
+                     src: ~[ast::token_tree])
+                  -> tt_reader {
     let r = @{sp_diag: sp_diag, interner: itr,
               mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false,
                          sep: None, up: tt_frame_up(option::None)},
@@ -88,7 +86,7 @@ pure fn dup_tt_frame(&&f: tt_frame) -> tt_frame {
      }
 }
 
-pure fn dup_tt_reader(&&r: tt_reader) -> tt_reader {
+pub pure fn dup_tt_reader(&&r: tt_reader) -> tt_reader {
     @{sp_diag: r.sp_diag, interner: r.interner,
       mut cur: dup_tt_frame(r.cur),
       interpolations: r.interpolations,
@@ -151,7 +149,7 @@ fn lockstep_iter_size(t: token_tree, r: tt_reader) -> lis {
 }
 
 
-fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
+pub fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
     let ret_val = { tok: r.cur_tok, sp: r.cur_span };
     while r.cur.idx >= r.cur.readme.len() {
         /* done with this set; pop or repeat? */
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index fc2ad0192eb..e8557558f17 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -17,26 +17,7 @@ use codemap::span;
 use core::option;
 use core::vec;
 
-export ast_fold_fns;
-export ast_fold;
-export default_ast_fold;
-export make_fold;
-export noop_fold_crate;
-export noop_fold_item;
-export noop_fold_expr;
-export noop_fold_pat;
-export noop_fold_mod;
-export noop_fold_ty;
-export noop_fold_block;
-export noop_fold_item_underscore;
-export wrap;
-export fold_ty_param;
-export fold_ty_params;
-export fold_fn_decl;
-export extensions;
-export AstFoldFns;
-
-trait ast_fold {
+pub trait ast_fold {
     fn fold_crate(crate) -> crate;
     fn fold_view_item(&&v: @view_item) -> @view_item;
     fn fold_foreign_item(&&v: @foreign_item) -> @foreign_item;
@@ -64,7 +45,7 @@ trait ast_fold {
 
 // We may eventually want to be able to fold over type parameters, too
 
-struct AstFoldFns {
+pub struct AstFoldFns {
     //unlike the others, item_ is non-trivial
     fold_crate: fn@(crate_, span, ast_fold) -> (crate_, span),
     fold_view_item: fn@(view_item_, ast_fold) -> view_item_,
@@ -91,7 +72,7 @@ struct AstFoldFns {
     new_span: fn@(span) -> span
 }
 
-type ast_fold_fns = @AstFoldFns;
+pub type ast_fold_fns = @AstFoldFns;
 
 /* some little folds that probably aren't useful to have in ast_fold itself*/
 
@@ -141,7 +122,7 @@ fn fold_mac_(m: mac, fld: ast_fold) -> mac {
               span: fld.new_span(m.span) }
 }
 
-fn fold_fn_decl(decl: ast::fn_decl, fld: ast_fold) -> ast::fn_decl {
+pub fn fold_fn_decl(decl: ast::fn_decl, fld: ast_fold) -> ast::fn_decl {
     ast::fn_decl {
         inputs: decl.inputs.map(|x| fold_arg_(*x, fld)),
         output: fld.fold_ty(decl.output),
@@ -156,17 +137,17 @@ fn fold_ty_param_bound(tpb: ty_param_bound, fld: ast_fold) -> ty_param_bound {
     }
 }
 
-fn fold_ty_param(tp: ty_param, fld: ast_fold) -> ty_param {
+pub fn fold_ty_param(tp: ty_param, fld: ast_fold) -> ty_param {
     ast::ty_param { ident: /* FIXME (#2543) */ copy tp.ident,
                     id: fld.new_id(tp.id),
                     bounds: @tp.bounds.map(|x| fold_ty_param_bound(*x, fld) )}
 }
 
-fn fold_ty_params(tps: ~[ty_param], fld: ast_fold) -> ~[ty_param] {
+pub fn fold_ty_params(tps: ~[ty_param], fld: ast_fold) -> ~[ty_param] {
     tps.map(|x| fold_ty_param(*x, fld))
 }
 
-fn noop_fold_crate(c: crate_, fld: ast_fold) -> crate_ {
+pub fn noop_fold_crate(c: crate_, fld: ast_fold) -> crate_ {
     let fold_meta_item = |x| fold_meta_item_(x, fld);
     let fold_attribute = |x| fold_attribute_(x, fld);
 
@@ -212,7 +193,7 @@ fn noop_fold_foreign_item(&&ni: @foreign_item, fld: ast_fold)
     }
 }
 
-fn noop_fold_item(&&i: @item, fld: ast_fold) -> Option<@item> {
+pub fn noop_fold_item(&&i: @item, fld: ast_fold) -> Option<@item> {
     let fold_attribute = |x| fold_attribute_(x, fld);
 
     Some(@ast::item { ident: fld.fold_ident(i.ident),
@@ -231,7 +212,7 @@ fn noop_fold_struct_field(&&sf: @struct_field, fld: ast_fold)
                span: sf.span }
 }
 
-fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
+pub fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
     return match i {
           item_const(t, e) => item_const(fld.fold_ty(t), fld.fold_expr(e)),
           item_fn(decl, purity, typms, ref body) => {
@@ -328,7 +309,7 @@ fn noop_fold_method(&&m: @method, fld: ast_fold) -> @method {
 }
 
 
-fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ {
+pub fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ {
     ast::blk_ {
         view_items: b.view_items.map(|x| fld.fold_view_item(*x)),
         stmts: b.stmts.map(|x| fld.fold_stmt(*x)),
@@ -356,7 +337,7 @@ fn noop_fold_arm(a: arm, fld: ast_fold) -> arm {
     }
 }
 
-fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ {
+pub fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ {
     return match p {
           pat_wild => pat_wild,
           pat_ident(binding_mode, pth, sub) => {
@@ -412,7 +393,7 @@ fn noop_fold_decl(d: decl_, fld: ast_fold) -> decl_ {
     }
 }
 
-fn wrap<T>(f: fn@(T, ast_fold) -> T)
+pub fn wrap<T>(f: fn@(T, ast_fold) -> T)
     -> fn@(T, span, ast_fold) -> (T, span)
 {
     return fn@(x: T, s: span, fld: ast_fold) -> (T, span) {
@@ -420,7 +401,7 @@ fn wrap<T>(f: fn@(T, ast_fold) -> T)
     }
 }
 
-fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
+pub fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
     fn fold_field_(field: field, fld: ast_fold) -> field {
         spanned {
             node: ast::field_ {
@@ -545,7 +526,7 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
         }
 }
 
-fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
+pub fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
     let fold_mac = |x| fold_mac_(x, fld);
     fn fold_mt(mt: mt, fld: ast_fold) -> mt {
         mt { ty: fld.fold_ty(mt.ty), mutbl: mt.mutbl }
@@ -586,7 +567,7 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
 }
 
 // ...nor do modules
-fn noop_fold_mod(m: _mod, fld: ast_fold) -> _mod {
+pub fn noop_fold_mod(m: _mod, fld: ast_fold) -> _mod {
     ast::_mod {
         view_items: vec::map(m.view_items, |x| fld.fold_view_item(*x)),
         items: vec::filter_map(m.items, |x| fld.fold_item(*x)),
@@ -693,7 +674,7 @@ fn noop_id(i: node_id) -> node_id { return i; }
 
 fn noop_span(sp: span) -> span { return sp; }
 
-fn default_ast_fold() -> ast_fold_fns {
+pub fn default_ast_fold() -> ast_fold_fns {
     return @AstFoldFns {fold_crate: wrap(noop_fold_crate),
           fold_view_item: noop_fold_view_item,
           fold_foreign_item: noop_fold_foreign_item,
@@ -719,7 +700,7 @@ fn default_ast_fold() -> ast_fold_fns {
           new_span: noop_span};
 }
 
-impl ast_fold_fns: ast_fold {
+pub impl ast_fold_fns: ast_fold {
     /* naturally, a macro to write these would be nice */
     fn fold_crate(c: crate) -> crate {
         let (n, s) = (self.fold_crate)(c.node, c.span, self as ast_fold);
@@ -833,13 +814,13 @@ impl ast_fold_fns: ast_fold {
     }
 }
 
-impl ast_fold {
+pub impl ast_fold {
     fn fold_attributes(attrs: ~[attribute]) -> ~[attribute] {
         attrs.map(|x| fold_attribute_(*x, self))
     }
 }
 
-fn make_fold(afp: ast_fold_fns) -> ast_fold {
+pub fn make_fold(afp: ast_fold_fns) -> ast_fold {
     afp as ast_fold
 }
 
diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs
index c29fe773b3f..caab03afb76 100644
--- a/src/libsyntax/parse/eval.rs
+++ b/src/libsyntax/parse/eval.rs
@@ -13,10 +13,6 @@ use attr::parser_attr;
 use ast_util::mk_sp;
 use codemap::span;
 
-export eval_crate_directives_to_mod;
-export eval_src_mod;
-export eval_src_mod_from_path;
-
 type ctx =
     @{sess: parse::parse_sess,
       cfg: ast::crate_cfg};
@@ -31,8 +27,8 @@ fn eval_crate_directives(cx: ctx,
     }
 }
 
-fn eval_crate_directives_to_mod(cx: ctx, cdirs: ~[@ast::crate_directive],
-                                prefix: &Path, suffix: &Option<Path>)
+pub fn eval_crate_directives_to_mod(cx: ctx, cdirs: ~[@ast::crate_directive],
+                                    prefix: &Path, suffix: &Option<Path>)
     -> (ast::_mod, ~[ast::attribute]) {
     let (cview_items, citems, cattrs)
         = parse_companion_mod(cx, prefix, suffix);
@@ -95,19 +91,19 @@ fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str {
     }
 }
 
-fn eval_src_mod(cx: ctx, prefix: &Path,
-                outer_attrs: ~[ast::attribute],
-                id: ast::ident, sp: span
-               ) -> (ast::item_, ~[ast::attribute]) {
+pub fn eval_src_mod(cx: ctx, prefix: &Path,
+                    outer_attrs: ~[ast::attribute],
+                    id: ast::ident, sp: span)
+                 -> (ast::item_, ~[ast::attribute]) {
     let file_path = Path(cdir_path_opt(
         cx.sess.interner.get(id) + ~".rs", outer_attrs));
     eval_src_mod_from_path(cx, prefix, &file_path, outer_attrs, sp)
 }
 
-fn eval_src_mod_from_path(cx: ctx, prefix: &Path, path: &Path,
-                          outer_attrs: ~[ast::attribute],
-                          sp: span
-                         ) -> (ast::item_, ~[ast::attribute]) {
+pub fn eval_src_mod_from_path(cx: ctx, prefix: &Path, path: &Path,
+                              outer_attrs: ~[ast::attribute],
+                              sp: span)
+                           -> (ast::item_, ~[ast::attribute]) {
     let full_path = if path.is_absolute {
         copy *path
     } else {
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index 6bc23aa1271..d3487fa845f 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -69,9 +69,9 @@ use core::vec;
  * line (which it can't) and so naturally place the content on its own line to
  * avoid combining it with other lines and making matters even worse.
  */
-enum breaks { consistent, inconsistent, }
+pub enum breaks { consistent, inconsistent, }
 
-impl breaks : cmp::Eq {
+pub impl breaks : cmp::Eq {
     pure fn eq(&self, other: &breaks) -> bool {
         match ((*self), (*other)) {
             (consistent, consistent) => true,
@@ -83,13 +83,19 @@ impl breaks : cmp::Eq {
     pure fn ne(&self, other: &breaks) -> bool { !(*self).eq(other) }
 }
 
-type break_t = {offset: int, blank_space: int};
+pub type break_t = {offset: int, blank_space: int};
 
-type begin_t = {offset: int, breaks: breaks};
+pub type begin_t = {offset: int, breaks: breaks};
 
-enum token { STRING(@~str, int), BREAK(break_t), BEGIN(begin_t), END, EOF, }
+pub enum token {
+    STRING(@~str, int),
+    BREAK(break_t),
+    BEGIN(begin_t),
+    END,
+    EOF,
+}
 
-impl token {
+pub impl token {
     fn is_eof() -> bool {
         match self { EOF => true, _ => false }
     }
@@ -103,7 +109,7 @@ impl token {
     }
 }
 
-fn tok_str(++t: token) -> ~str {
+pub fn tok_str(++t: token) -> ~str {
     match t {
       STRING(s, len) => return fmt!("STR(%s,%d)", *s, len),
       BREAK(_) => return ~"BREAK",
@@ -113,8 +119,8 @@ fn tok_str(++t: token) -> ~str {
     }
 }
 
-fn buf_str(toks: ~[mut token], szs: ~[mut int], left: uint, right: uint,
-           lim: uint) -> ~str {
+pub fn buf_str(toks: ~[mut token], szs: ~[mut int], left: uint, right: uint,
+               lim: uint) -> ~str {
     let n = vec::len(toks);
     assert (n == vec::len(szs));
     let mut i = left;
@@ -131,13 +137,13 @@ fn buf_str(toks: ~[mut token], szs: ~[mut int], left: uint, right: uint,
     return s;
 }
 
-enum print_stack_break { fits, broken(breaks), }
+pub enum print_stack_break { fits, broken(breaks), }
 
-type print_stack_elt = {offset: int, pbreak: print_stack_break};
+pub type print_stack_elt = {offset: int, pbreak: print_stack_break};
 
-const size_infinity: int = 0xffff;
+pub const size_infinity: int = 0xffff;
 
-fn mk_printer(out: io::Writer, linewidth: uint) -> printer {
+pub fn mk_printer(out: io::Writer, linewidth: uint) -> printer {
     // Yes 3, it makes the ring buffers big enough to never
     // fall behind.
     let n: uint = 3 * linewidth;
@@ -241,7 +247,7 @@ fn mk_printer(out: io::Writer, linewidth: uint) -> printer {
  * the method called 'pretty_print', and the 'PRINT' process is the method
  * called 'print'.
  */
-type printer_ = {
+pub type printer_ = {
     out: io::Writer,
     buf_len: uint,
     mut margin: int, // width of lines we're constrained to
@@ -268,11 +274,11 @@ type printer_ = {
     mut pending_indentation: int,
 };
 
-enum printer {
+pub enum printer {
     printer_(@printer_)
 }
 
-impl printer {
+pub impl printer {
     fn last_token() -> token { self.token[self.right] }
     // be very careful with this!
     fn replace_last_token(t: token) { self.token[self.right] = t; }
@@ -533,45 +539,45 @@ impl printer {
 }
 
 // Convenience functions to talk to the printer.
-fn box(p: printer, indent: uint, b: breaks) {
+pub fn box(p: printer, indent: uint, b: breaks) {
     p.pretty_print(BEGIN({offset: indent as int, breaks: b}));
 }
 
-fn ibox(p: printer, indent: uint) { box(p, indent, inconsistent); }
+pub fn ibox(p: printer, indent: uint) { box(p, indent, inconsistent); }
 
-fn cbox(p: printer, indent: uint) { box(p, indent, consistent); }
+pub fn cbox(p: printer, indent: uint) { box(p, indent, consistent); }
 
-fn break_offset(p: printer, n: uint, off: int) {
+pub fn break_offset(p: printer, n: uint, off: int) {
     p.pretty_print(BREAK({offset: off, blank_space: n as int}));
 }
 
-fn end(p: printer) { p.pretty_print(END); }
+pub fn end(p: printer) { p.pretty_print(END); }
 
-fn eof(p: printer) { p.pretty_print(EOF); }
+pub fn eof(p: printer) { p.pretty_print(EOF); }
 
-fn word(p: printer, wrd: ~str) {
+pub fn word(p: printer, wrd: ~str) {
     p.pretty_print(STRING(@wrd, str::len(wrd) as int));
 }
 
-fn huge_word(p: printer, wrd: ~str) {
+pub fn huge_word(p: printer, wrd: ~str) {
     p.pretty_print(STRING(@wrd, size_infinity));
 }
 
-fn zero_word(p: printer, wrd: ~str) { p.pretty_print(STRING(@wrd, 0)); }
+pub fn zero_word(p: printer, wrd: ~str) { p.pretty_print(STRING(@wrd, 0)); }
 
-fn spaces(p: printer, n: uint) { break_offset(p, n, 0); }
+pub fn spaces(p: printer, n: uint) { break_offset(p, n, 0); }
 
-fn zerobreak(p: printer) { spaces(p, 0u); }
+pub fn zerobreak(p: printer) { spaces(p, 0u); }
 
-fn space(p: printer) { spaces(p, 1u); }
+pub fn space(p: printer) { spaces(p, 1u); }
 
-fn hardbreak(p: printer) { spaces(p, size_infinity as uint); }
+pub fn hardbreak(p: printer) { spaces(p, size_infinity as uint); }
 
-fn hardbreak_tok_offset(off: int) -> token {
+pub fn hardbreak_tok_offset(off: int) -> token {
     return BREAK({offset: off, blank_space: size_infinity});
 }
 
-fn hardbreak_tok() -> token { return hardbreak_tok_offset(0); }
+pub fn hardbreak_tok() -> token { return hardbreak_tok_offset(0); }
 
 
 //
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 632e50176e9..a0243215e69 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -38,23 +38,23 @@ use core::u64;
 use core::vec;
 
 // The ps is stored here to prevent recursive type.
-enum ann_node {
+pub enum ann_node {
     node_block(ps, ast::blk),
     node_item(ps, @ast::item),
     node_expr(ps, @ast::expr),
     node_pat(ps, @ast::pat),
 }
-struct pp_ann {
+pub struct pp_ann {
     pre: fn@(ann_node),
     post: fn@(ann_node)
 }
 
-fn no_ann() -> pp_ann {
+pub fn no_ann() -> pp_ann {
     fn ignore(_node: ann_node) { }
     return pp_ann {pre: ignore, post: ignore};
 }
 
-type ps =
+pub type ps =
     @{s: pp::printer,
       cm: Option<@CodeMap>,
       intr: @token::ident_interner,
@@ -65,17 +65,17 @@ type ps =
       boxes: DVec<pp::breaks>,
       ann: pp_ann};
 
-fn ibox(s: ps, u: uint) {
+pub fn ibox(s: ps, u: uint) {
     s.boxes.push(pp::inconsistent);
     pp::ibox(s.s, u);
 }
 
-fn end(s: ps) {
+pub fn end(s: ps) {
     s.boxes.pop();
     pp::end(s.s);
 }
 
-fn rust_printer(writer: io::Writer, intr: @ident_interner) -> ps {
+pub fn rust_printer(writer: io::Writer, intr: @ident_interner) -> ps {
     return @{s: pp::mk_printer(writer, default_columns),
              cm: None::<@CodeMap>,
              intr: intr,
@@ -87,18 +87,18 @@ fn rust_printer(writer: io::Writer, intr: @ident_interner) -> ps {
              ann: no_ann()};
 }
 
-const indent_unit: uint = 4u;
-const match_indent_unit: uint = 2u;
+pub const indent_unit: uint = 4u;
+pub const match_indent_unit: uint = 2u;
 
-const default_columns: uint = 78u;
+pub const default_columns: uint = 78u;
 
 // Requires you to pass an input filename and reader so that
 // it can scan the input text for comments and literals to
 // copy forward.
-fn print_crate(cm: @CodeMap, intr: @ident_interner,
-               span_diagnostic: diagnostic::span_handler,
-               crate: @ast::crate, filename: ~str, in: io::Reader,
-               out: io::Writer, ann: pp_ann, is_expanded: bool) {
+pub fn print_crate(cm: @CodeMap, intr: @ident_interner,
+                   span_diagnostic: diagnostic::span_handler,
+                   crate: @ast::crate, filename: ~str, in: io::Reader,
+                   out: io::Writer, ann: pp_ann, is_expanded: bool) {
     let r = comments::gather_comments_and_literals(span_diagnostic,
                                                    filename, in);
     let s =
@@ -117,50 +117,50 @@ fn print_crate(cm: @CodeMap, intr: @ident_interner,
     print_crate_(s, crate);
 }
 
-fn print_crate_(s: ps, &&crate: @ast::crate) {
+pub fn print_crate_(s: ps, &&crate: @ast::crate) {
     print_mod(s, crate.node.module, crate.node.attrs);
     print_remaining_comments(s);
     eof(s.s);
 }
 
-fn ty_to_str(ty: @ast::Ty, intr: @ident_interner) -> ~str {
+pub fn ty_to_str(ty: @ast::Ty, intr: @ident_interner) -> ~str {
     to_str(ty, print_type, intr)
 }
 
-fn pat_to_str(pat: @ast::pat, intr: @ident_interner) -> ~str {
+pub fn pat_to_str(pat: @ast::pat, intr: @ident_interner) -> ~str {
     to_str(pat, print_irrefutable_pat, intr)
 }
 
-fn expr_to_str(e: @ast::expr, intr: @ident_interner) -> ~str {
+pub fn expr_to_str(e: @ast::expr, intr: @ident_interner) -> ~str {
     to_str(e, print_expr, intr)
 }
 
-fn tt_to_str(tt: ast::token_tree, intr: @ident_interner) -> ~str {
+pub fn tt_to_str(tt: ast::token_tree, intr: @ident_interner) -> ~str {
     to_str(tt, print_tt, intr)
 }
 
-fn tts_to_str(tts: &[ast::token_tree], intr: @ident_interner) -> ~str {
+pub fn tts_to_str(tts: &[ast::token_tree], intr: @ident_interner) -> ~str {
     to_str(tts, print_tts, intr)
 }
 
-fn stmt_to_str(s: ast::stmt, intr: @ident_interner) -> ~str {
+pub fn stmt_to_str(s: ast::stmt, intr: @ident_interner) -> ~str {
     to_str(s, print_stmt, intr)
 }
 
-fn item_to_str(i: @ast::item, intr: @ident_interner) -> ~str {
+pub fn item_to_str(i: @ast::item, intr: @ident_interner) -> ~str {
     to_str(i, print_item, intr)
 }
 
-fn typarams_to_str(tps: ~[ast::ty_param], intr: @ident_interner) -> ~str {
+pub fn typarams_to_str(tps: ~[ast::ty_param], intr: @ident_interner) -> ~str {
     to_str(tps, print_type_params, intr)
 }
 
-fn path_to_str(&&p: @ast::path, intr: @ident_interner) -> ~str {
+pub fn path_to_str(&&p: @ast::path, intr: @ident_interner) -> ~str {
     to_str(p, |a,b| print_path(a, b, false), intr)
 }
 
-fn fun_to_str(decl: ast::fn_decl, name: ast::ident,
-              params: ~[ast::ty_param], intr: @ident_interner) -> ~str {
+pub fn fun_to_str(decl: ast::fn_decl, name: ast::ident,
+                  params: ~[ast::ty_param], intr: @ident_interner) -> ~str {
     do io::with_str_writer |wr| {
         let s = rust_printer(wr, intr);
         print_fn(s, decl, None, name, params, None, ast::inherited);
@@ -170,7 +170,7 @@ fn fun_to_str(decl: ast::fn_decl, name: ast::ident,
     }
 }
 
-fn block_to_str(blk: ast::blk, intr: @ident_interner) -> ~str {
+pub fn block_to_str(blk: ast::blk, intr: @ident_interner) -> ~str {
     do io::with_str_writer |wr| {
         let s = rust_printer(wr, intr);
         // containing cbox, will be closed by print-block at }
@@ -182,39 +182,39 @@ fn block_to_str(blk: ast::blk, intr: @ident_interner) -> ~str {
     }
 }
 
-fn meta_item_to_str(mi: @ast::meta_item, intr: @ident_interner) -> ~str {
+pub fn meta_item_to_str(mi: @ast::meta_item, intr: @ident_interner) -> ~str {
     to_str(mi, print_meta_item, intr)
 }
 
-fn attribute_to_str(attr: ast::attribute, intr: @ident_interner) -> ~str {
+pub fn attribute_to_str(attr: ast::attribute, intr: @ident_interner) -> ~str {
     to_str(attr, print_attribute, intr)
 }
 
-fn variant_to_str(var: ast::variant, intr: @ident_interner) -> ~str {
+pub fn variant_to_str(var: ast::variant, intr: @ident_interner) -> ~str {
     to_str(var, print_variant, intr)
 }
 
-fn cbox(s: ps, u: uint) {
+pub fn cbox(s: ps, u: uint) {
     s.boxes.push(pp::consistent);
     pp::cbox(s.s, u);
 }
 
-fn box(s: ps, u: uint, b: pp::breaks) {
+pub fn box(s: ps, u: uint, b: pp::breaks) {
     s.boxes.push(b);
     pp::box(s.s, u, b);
 }
 
-fn nbsp(s: ps) { word(s.s, ~" "); }
+pub fn nbsp(s: ps) { word(s.s, ~" "); }
 
-fn word_nbsp(s: ps, w: ~str) { word(s.s, w); nbsp(s); }
+pub fn word_nbsp(s: ps, w: ~str) { word(s.s, w); nbsp(s); }
 
-fn word_space(s: ps, w: ~str) { word(s.s, w); space(s.s); }
+pub fn word_space(s: ps, w: ~str) { word(s.s, w); space(s.s); }
 
-fn popen(s: ps) { word(s.s, ~"("); }
+pub fn popen(s: ps) { word(s.s, ~"("); }
 
-fn pclose(s: ps) { word(s.s, ~")"); }
+pub fn pclose(s: ps) { word(s.s, ~")"); }
 
-fn head(s: ps, w: ~str) {
+pub fn head(s: ps, w: ~str) {
     // outer-box is consistent
     cbox(s, indent_unit);
     // head-box is inconsistent
@@ -225,16 +225,16 @@ fn head(s: ps, w: ~str) {
     }
 }
 
-fn bopen(s: ps) {
+pub fn bopen(s: ps) {
     word(s.s, ~"{");
     end(s); // close the head-box
 }
 
-fn bclose_(s: ps, span: codemap::span, indented: uint) {
+pub fn bclose_(s: ps, span: codemap::span, indented: uint) {
     bclose_maybe_open(s, span, indented, true);
 }
-fn bclose_maybe_open (s: ps, span: codemap::span, indented: uint,
-                     close_box: bool) {
+pub fn bclose_maybe_open (s: ps, span: codemap::span, indented: uint,
+                          close_box: bool) {
     maybe_print_comment(s, span.hi);
     break_offset_if_not_bol(s, 1u, -(indented as int));
     word(s.s, ~"}");
@@ -242,29 +242,29 @@ fn bclose_maybe_open (s: ps, span: codemap::span, indented: uint,
         end(s); // close the outer-box
     }
 }
-fn bclose(s: ps, span: codemap::span) { bclose_(s, span, indent_unit); }
+pub fn bclose(s: ps, span: codemap::span) { bclose_(s, span, indent_unit); }
 
-fn is_begin(s: ps) -> bool {
+pub fn is_begin(s: ps) -> bool {
     match s.s.last_token() { pp::BEGIN(_) => true, _ => false }
 }
 
-fn is_end(s: ps) -> bool {
+pub fn is_end(s: ps) -> bool {
     match s.s.last_token() { pp::END => true, _ => false }
 }
 
-fn is_bol(s: ps) -> bool {
+pub fn is_bol(s: ps) -> bool {
     return s.s.last_token().is_eof() || s.s.last_token().is_hardbreak_tok();
 }
 
-fn in_cbox(s: ps) -> bool {
+pub fn in_cbox(s: ps) -> bool {
     let len = s.boxes.len();
     if len == 0u { return false; }
     return s.boxes[len - 1u] == pp::consistent;
 }
 
-fn hardbreak_if_not_bol(s: ps) { if !is_bol(s) { hardbreak(s.s); } }
-fn space_if_not_bol(s: ps) { if !is_bol(s) { space(s.s); } }
-fn break_offset_if_not_bol(s: ps, n: uint, off: int) {
+pub fn hardbreak_if_not_bol(s: ps) { if !is_bol(s) { hardbreak(s.s); } }
+pub fn space_if_not_bol(s: ps) { if !is_bol(s) { space(s.s); } }
+pub fn break_offset_if_not_bol(s: ps, n: uint, off: int) {
     if !is_bol(s) {
         break_offset(s.s, n, off);
     } else {
@@ -279,7 +279,7 @@ fn break_offset_if_not_bol(s: ps, n: uint, off: int) {
 
 // Synthesizes a comment that was not textually present in the original source
 // file.
-fn synth_comment(s: ps, text: ~str) {
+pub fn synth_comment(s: ps, text: ~str) {
     word(s.s, ~"/*");
     space(s.s);
     word(s.s, text);
@@ -287,7 +287,7 @@ fn synth_comment(s: ps, text: ~str) {
     word(s.s, ~"*/");
 }
 
-fn commasep<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN)) {
+pub fn commasep<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN)) {
     box(s, 0u, b);
     let mut first = true;
     for elts.each |elt| {
@@ -298,8 +298,8 @@ fn commasep<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN)) {
 }
 
 
-fn commasep_cmnt<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN),
-                     get_span: fn(IN) -> codemap::span) {
+pub fn commasep_cmnt<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN),
+                         get_span: fn(IN) -> codemap::span) {
     box(s, 0u, b);
     let len = vec::len::<IN>(elts);
     let mut i = 0u;
@@ -317,12 +317,12 @@ fn commasep_cmnt<IN>(s: ps, b: breaks, elts: ~[IN], op: fn(ps, IN),
     end(s);
 }
 
-fn commasep_exprs(s: ps, b: breaks, exprs: ~[@ast::expr]) {
+pub fn commasep_exprs(s: ps, b: breaks, exprs: ~[@ast::expr]) {
     fn expr_span(&&expr: @ast::expr) -> codemap::span { return expr.span; }
     commasep_cmnt(s, b, exprs, print_expr, expr_span);
 }
 
-fn print_mod(s: ps, _mod: ast::_mod, attrs: ~[ast::attribute]) {
+pub fn print_mod(s: ps, _mod: ast::_mod, attrs: ~[ast::attribute]) {
     print_inner_attributes(s, attrs);
     for _mod.view_items.each |vitem| {
         print_view_item(s, *vitem);
@@ -330,8 +330,8 @@ fn print_mod(s: ps, _mod: ast::_mod, attrs: ~[ast::attribute]) {
     for _mod.items.each |item| { print_item(s, *item); }
 }
 
-fn print_foreign_mod(s: ps, nmod: ast::foreign_mod,
-                     attrs: ~[ast::attribute]) {
+pub fn print_foreign_mod(s: ps, nmod: ast::foreign_mod,
+                         attrs: ~[ast::attribute]) {
     print_inner_attributes(s, attrs);
     for nmod.view_items.each |vitem| {
         print_view_item(s, *vitem);
@@ -339,7 +339,7 @@ fn print_foreign_mod(s: ps, nmod: ast::foreign_mod,
     for nmod.items.each |item| { print_foreign_item(s, *item); }
 }
 
-fn print_region(s: ps, prefix: ~str, region: @ast::region, sep: ~str) {
+pub fn print_region(s: ps, prefix: ~str, region: @ast::region, sep: ~str) {
     word(s.s, prefix);
     match region.node {
         ast::re_anon => {
@@ -358,11 +358,11 @@ fn print_region(s: ps, prefix: ~str, region: @ast::region, sep: ~str) {
     word(s.s, sep);
 }
 
-fn print_type(s: ps, &&ty: @ast::Ty) {
+pub fn print_type(s: ps, &&ty: @ast::Ty) {
     print_type_ex(s, ty, false);
 }
 
-fn print_type_ex(s: ps, &&ty: @ast::Ty, print_colons: bool) {
+pub fn print_type_ex(s: ps, &&ty: @ast::Ty, print_colons: bool) {
     maybe_print_comment(s, ty.span.lo);
     ibox(s, 0u);
     match ty.node {
@@ -432,7 +432,7 @@ fn print_type_ex(s: ps, &&ty: @ast::Ty, print_colons: bool) {
     end(s);
 }
 
-fn print_foreign_item(s: ps, item: @ast::foreign_item) {
+pub fn print_foreign_item(s: ps, item: @ast::foreign_item) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
@@ -456,7 +456,7 @@ fn print_foreign_item(s: ps, item: @ast::foreign_item) {
     }
 }
 
-fn print_item(s: ps, &&item: @ast::item) {
+pub fn print_item(s: ps, &&item: @ast::item) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
@@ -591,9 +591,9 @@ fn print_item(s: ps, &&item: @ast::item) {
     (s.ann.post)(ann_node);
 }
 
-fn print_enum_def(s: ps, enum_definition: ast::enum_def,
-                  params: ~[ast::ty_param], ident: ast::ident,
-                  span: codemap::span, visibility: ast::visibility) {
+pub fn print_enum_def(s: ps, enum_definition: ast::enum_def,
+                      params: ~[ast::ty_param], ident: ast::ident,
+                      span: codemap::span, visibility: ast::visibility) {
     let mut newtype =
         vec::len(enum_definition.variants) == 1u &&
         ident == enum_definition.variants[0].node.name;
@@ -626,7 +626,9 @@ fn print_enum_def(s: ps, enum_definition: ast::enum_def,
     }
 }
 
-fn print_variants(s: ps, variants: ~[ast::variant], span: codemap::span) {
+pub fn print_variants(s: ps,
+                      variants: ~[ast::variant],
+                      span: codemap::span) {
     bopen(s);
     for variants.each |v| {
         space_if_not_bol(s);
@@ -641,7 +643,7 @@ fn print_variants(s: ps, variants: ~[ast::variant], span: codemap::span) {
     bclose(s, span);
 }
 
-fn visibility_to_str(vis: ast::visibility) -> ~str {
+pub fn visibility_to_str(vis: ast::visibility) -> ~str {
     match vis {
         ast::private => ~"priv",
         ast::public => ~"pub",
@@ -649,7 +651,7 @@ fn visibility_to_str(vis: ast::visibility) -> ~str {
     }
 }
 
-fn visibility_qualified(vis: ast::visibility, s: ~str) -> ~str {
+pub fn visibility_qualified(vis: ast::visibility, s: ~str) -> ~str {
     match vis {
         ast::private | ast::public =>
         visibility_to_str(vis) + " " + s,
@@ -657,7 +659,7 @@ fn visibility_qualified(vis: ast::visibility, s: ~str) -> ~str {
     }
 }
 
-fn print_visibility(s: ps, vis: ast::visibility) {
+pub fn print_visibility(s: ps, vis: ast::visibility) {
     match vis {
         ast::private | ast::public =>
         word_nbsp(s, visibility_to_str(vis)),
@@ -665,8 +667,11 @@ fn print_visibility(s: ps, vis: ast::visibility) {
     }
 }
 
-fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
-                ident: ast::ident, span: codemap::span) {
+pub fn print_struct(s: ps,
+                    struct_def: @ast::struct_def,
+                    tps: ~[ast::ty_param],
+                    ident: ast::ident,
+                    span: codemap::span) {
     print_ident(s, ident);
     nbsp(s);
     print_type_params(s, tps);
@@ -731,7 +736,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
 /// appropriate macro, transcribe back into the grammar we just parsed from,
 /// and then pretty-print the resulting AST nodes (so, e.g., we print
 /// expression arguments as expressions). It can be done! I think.
-fn print_tt(s: ps, tt: ast::token_tree) {
+pub fn print_tt(s: ps, tt: ast::token_tree) {
     match tt {
       ast::tt_delim(ref tts) => print_tts(s, *tts),
       ast::tt_tok(_, ref tk) => {
@@ -754,7 +759,7 @@ fn print_tt(s: ps, tt: ast::token_tree) {
     }
 }
 
-fn print_tts(s: ps, &&tts: &[ast::token_tree]) {
+pub fn print_tts(s: ps, &&tts: &[ast::token_tree]) {
     ibox(s, 0);
     for tts.eachi |i, tt| {
         if i != 0 {
@@ -765,7 +770,7 @@ fn print_tts(s: ps, &&tts: &[ast::token_tree]) {
     end(s);
 }
 
-fn print_variant(s: ps, v: ast::variant) {
+pub fn print_variant(s: ps, v: ast::variant) {
     print_visibility(s, v.node.vis);
     match v.node.kind {
         ast::tuple_variant_kind(args) => {
@@ -797,7 +802,7 @@ fn print_variant(s: ps, v: ast::variant) {
     }
 }
 
-fn print_ty_method(s: ps, m: ast::ty_method) {
+pub fn print_ty_method(s: ps, m: ast::ty_method) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, m.span.lo);
     print_outer_attributes(s, m.attrs);
@@ -807,14 +812,14 @@ fn print_ty_method(s: ps, m: ast::ty_method) {
     word(s.s, ~";");
 }
 
-fn print_trait_method(s: ps, m: ast::trait_method) {
+pub fn print_trait_method(s: ps, m: ast::trait_method) {
     match m {
       required(ref ty_m) => print_ty_method(s, (*ty_m)),
       provided(m)    => print_method(s, m)
     }
 }
 
-fn print_method(s: ps, meth: @ast::method) {
+pub fn print_method(s: ps, meth: @ast::method) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, meth.span.lo);
     print_outer_attributes(s, meth.attrs);
@@ -825,7 +830,7 @@ fn print_method(s: ps, meth: @ast::method) {
     print_block_with_attrs(s, meth.body, meth.attrs);
 }
 
-fn print_outer_attributes(s: ps, attrs: ~[ast::attribute]) {
+pub fn print_outer_attributes(s: ps, attrs: ~[ast::attribute]) {
     let mut count = 0;
     for attrs.each |attr| {
         match attr.node.style {
@@ -836,7 +841,7 @@ fn print_outer_attributes(s: ps, attrs: ~[ast::attribute]) {
     if count > 0 { hardbreak_if_not_bol(s); }
 }
 
-fn print_inner_attributes(s: ps, attrs: ~[ast::attribute]) {
+pub fn print_inner_attributes(s: ps, attrs: ~[ast::attribute]) {
     let mut count = 0;
     for attrs.each |attr| {
         match attr.node.style {
@@ -853,7 +858,7 @@ fn print_inner_attributes(s: ps, attrs: ~[ast::attribute]) {
     if count > 0 { hardbreak_if_not_bol(s); }
 }
 
-fn print_attribute(s: ps, attr: ast::attribute) {
+pub fn print_attribute(s: ps, attr: ast::attribute) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, attr.span.lo);
     if attr.node.is_sugared_doc {
@@ -868,7 +873,7 @@ fn print_attribute(s: ps, attr: ast::attribute) {
 }
 
 
-fn print_stmt(s: ps, st: ast::stmt) {
+pub fn print_stmt(s: ps, st: ast::stmt) {
     maybe_print_comment(s, st.span.lo);
     match st.node {
       ast::stmt_decl(decl, _) => {
@@ -893,36 +898,43 @@ fn print_stmt(s: ps, st: ast::stmt) {
     maybe_print_trailing_comment(s, st.span, None);
 }
 
-fn print_block(s: ps, blk: ast::blk) {
+pub fn print_block(s: ps, blk: ast::blk) {
     print_possibly_embedded_block(s, blk, block_normal, indent_unit);
 }
 
-fn print_block_unclosed(s: ps, blk: ast::blk) {
+pub fn print_block_unclosed(s: ps, blk: ast::blk) {
     print_possibly_embedded_block_(s, blk, block_normal, indent_unit, ~[],
                                  false);
 }
 
-fn print_block_unclosed_indent(s: ps, blk: ast::blk, indented: uint) {
+pub fn print_block_unclosed_indent(s: ps, blk: ast::blk, indented: uint) {
     print_possibly_embedded_block_(s, blk, block_normal, indented, ~[],
                                    false);
 }
 
-fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: ~[ast::attribute]) {
+pub fn print_block_with_attrs(s: ps,
+                              blk: ast::blk,
+                              attrs: ~[ast::attribute]) {
     print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs,
                                   true);
 }
 
-enum embed_type { block_block_fn, block_normal, }
+pub enum embed_type { block_block_fn, block_normal, }
 
-fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type,
-                                 indented: uint) {
+pub fn print_possibly_embedded_block(s: ps,
+                                     blk: ast::blk,
+                                     embedded: embed_type,
+                                     indented: uint) {
     print_possibly_embedded_block_(
         s, blk, embedded, indented, ~[], true);
 }
 
-fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
-                                  indented: uint, attrs: ~[ast::attribute],
-                                  close_box: bool) {
+pub fn print_possibly_embedded_block_(s: ps,
+                                      blk: ast::blk,
+                                      embedded: embed_type,
+                                      indented: uint,
+                                      attrs: ~[ast::attribute],
+                                      close_box: bool) {
     match blk.node.rules {
       ast::unsafe_blk => word_space(s, ~"unsafe"),
       ast::default_blk => ()
@@ -953,8 +965,8 @@ fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
     (s.ann.post)(ann_node);
 }
 
-fn print_if(s: ps, test: @ast::expr, blk: ast::blk,
-            elseopt: Option<@ast::expr>, chk: bool) {
+pub fn print_if(s: ps, test: @ast::expr, blk: ast::blk,
+                elseopt: Option<@ast::expr>, chk: bool) {
     head(s, ~"if");
     if chk { word_nbsp(s, ~"check"); }
     print_expr(s, test);
@@ -993,7 +1005,7 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk,
     do_else(s, elseopt);
 }
 
-fn print_mac(s: ps, m: ast::mac) {
+pub fn print_mac(s: ps, m: ast::mac) {
     match m.node {
       ast::mac_invoc_tt(pth, ref tts) => {
         print_path(s, pth, false);
@@ -1005,7 +1017,7 @@ fn print_mac(s: ps, m: ast::mac) {
     }
 }
 
-fn print_vstore(s: ps, t: ast::vstore) {
+pub fn print_vstore(s: ps, t: ast::vstore) {
     match t {
         ast::vstore_fixed(Some(i)) => word(s.s, fmt!("%u", i)),
         ast::vstore_fixed(None) => word(s.s, ~"_"),
@@ -1015,7 +1027,7 @@ fn print_vstore(s: ps, t: ast::vstore) {
     }
 }
 
-fn print_expr_vstore(s: ps, t: ast::expr_vstore) {
+pub fn print_expr_vstore(s: ps, t: ast::expr_vstore) {
     match t {
       ast::expr_vstore_fixed(Some(i)) => word(s.s, fmt!("%u", i)),
       ast::expr_vstore_fixed(None) => word(s.s, ~"_"),
@@ -1033,10 +1045,10 @@ fn print_expr_vstore(s: ps, t: ast::expr_vstore) {
     }
 }
 
-fn print_call_pre(s: ps,
-                  has_block: bool,
-                  base_args: &mut ~[@ast::expr])
-               -> Option<@ast::expr> {
+pub fn print_call_pre(s: ps,
+                      has_block: bool,
+                      base_args: &mut ~[@ast::expr])
+                   -> Option<@ast::expr> {
     if has_block {
         let blk_arg = base_args.pop();
         match blk_arg.node {
@@ -1050,10 +1062,10 @@ fn print_call_pre(s: ps,
     }
 }
 
-fn print_call_post(s: ps,
-                   has_block: bool,
-                   blk: &Option<@ast::expr>,
-                   base_args: &mut ~[@ast::expr]) {
+pub fn print_call_post(s: ps,
+                       has_block: bool,
+                       blk: &Option<@ast::expr>,
+                       base_args: &mut ~[@ast::expr]) {
     if !has_block || !base_args.is_empty() {
         popen(s);
         commasep_exprs(s, inconsistent, *base_args);
@@ -1077,7 +1089,7 @@ fn print_call_post(s: ps,
     }
 }
 
-fn print_expr(s: ps, &&expr: @ast::expr) {
+pub fn print_expr(s: ps, &&expr: @ast::expr) {
     fn print_field(s: ps, field: ast::field) {
         ibox(s, indent_unit);
         if field.node.mutbl == ast::m_mutbl { word_nbsp(s, ~"mut"); }
@@ -1439,7 +1451,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
     end(s);
 }
 
-fn print_local_decl(s: ps, loc: @ast::local) {
+pub fn print_local_decl(s: ps, loc: @ast::local) {
     print_irrefutable_pat(s, loc.node.pat);
     match loc.node.ty.node {
       ast::ty_infer => (),
@@ -1447,7 +1459,7 @@ fn print_local_decl(s: ps, loc: @ast::local) {
     }
 }
 
-fn print_decl(s: ps, decl: @ast::decl) {
+pub fn print_decl(s: ps, decl: @ast::decl) {
     maybe_print_comment(s, decl.span.lo);
     match decl.node {
       ast::decl_local(locs) => {
@@ -1481,16 +1493,18 @@ fn print_decl(s: ps, decl: @ast::decl) {
     }
 }
 
-fn print_ident(s: ps, ident: ast::ident) { word(s.s, *s.intr.get(ident)); }
+pub fn print_ident(s: ps, ident: ast::ident) {
+    word(s.s, *s.intr.get(ident));
+}
 
-fn print_for_decl(s: ps, loc: @ast::local, coll: @ast::expr) {
+pub fn print_for_decl(s: ps, loc: @ast::local, coll: @ast::expr) {
     print_local_decl(s, loc);
     space(s.s);
     word_space(s, ~"in");
     print_expr(s, coll);
 }
 
-fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) {
+pub fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) {
     maybe_print_comment(s, path.span.lo);
     if path.global { word(s.s, ~"::"); }
     let mut first = true;
@@ -1517,15 +1531,15 @@ fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) {
     }
 }
 
-fn print_irrefutable_pat(s: ps, &&pat: @ast::pat) {
+pub fn print_irrefutable_pat(s: ps, &&pat: @ast::pat) {
     print_pat(s, pat, false)
 }
 
-fn print_refutable_pat(s: ps, &&pat: @ast::pat) {
+pub fn print_refutable_pat(s: ps, &&pat: @ast::pat) {
     print_pat(s, pat, true)
 }
 
-fn print_pat(s: ps, &&pat: @ast::pat, refutable: bool) {
+pub fn print_pat(s: ps, &&pat: @ast::pat, refutable: bool) {
     maybe_print_comment(s, pat.span.lo);
     let ann_node = node_pat(s, pat);
     (s.ann.pre)(ann_node);
@@ -1650,7 +1664,7 @@ fn print_pat(s: ps, &&pat: @ast::pat, refutable: bool) {
 }
 
 // Returns whether it printed anything
-fn print_self_ty(s: ps, self_ty: ast::self_ty_) -> bool {
+pub fn print_self_ty(s: ps, self_ty: ast::self_ty_) -> bool {
     match self_ty {
       ast::sty_static | ast::sty_by_ref => { return false; }
       ast::sty_value => { word(s.s, ~"self"); }
@@ -1667,13 +1681,13 @@ fn print_self_ty(s: ps, self_ty: ast::self_ty_) -> bool {
     return true;
 }
 
-fn print_fn(s: ps,
-            decl: ast::fn_decl,
-            purity: Option<ast::purity>,
-            name: ast::ident,
-            typarams: ~[ast::ty_param],
-            opt_self_ty: Option<ast::self_ty_>,
-            vis: ast::visibility) {
+pub fn print_fn(s: ps,
+                decl: ast::fn_decl,
+                purity: Option<ast::purity>,
+                name: ast::ident,
+                typarams: ~[ast::ty_param],
+                opt_self_ty: Option<ast::self_ty_>,
+                vis: ast::visibility) {
     head(s, ~"");
     print_fn_header_info(s, opt_self_ty, purity, ast::Many, None, vis);
     nbsp(s);
@@ -1682,9 +1696,9 @@ fn print_fn(s: ps,
     print_fn_args_and_ret(s, decl, ~[], opt_self_ty);
 }
 
-fn print_fn_args(s: ps, decl: ast::fn_decl,
-                 cap_items: ~[ast::capture_item],
-                 opt_self_ty: Option<ast::self_ty_>) {
+pub fn print_fn_args(s: ps, decl: ast::fn_decl,
+                     cap_items: ~[ast::capture_item],
+                     opt_self_ty: Option<ast::self_ty_>) {
     // It is unfortunate to duplicate the commasep logic, but we
     // we want the self type, the args, and the capture clauses all
     // in the same box.
@@ -1709,9 +1723,9 @@ fn print_fn_args(s: ps, decl: ast::fn_decl,
     end(s);
 }
 
-fn print_fn_args_and_ret(s: ps, decl: ast::fn_decl,
-                         cap_items: ~[ast::capture_item],
-                         opt_self_ty: Option<ast::self_ty_>) {
+pub fn print_fn_args_and_ret(s: ps, decl: ast::fn_decl,
+                             cap_items: ~[ast::capture_item],
+                             opt_self_ty: Option<ast::self_ty_>) {
     popen(s);
     print_fn_args(s, decl, cap_items, opt_self_ty);
     pclose(s);
@@ -1727,8 +1741,8 @@ fn print_fn_args_and_ret(s: ps, decl: ast::fn_decl,
     }
 }
 
-fn print_fn_block_args(s: ps, decl: ast::fn_decl,
-                       cap_items: ~[ast::capture_item]) {
+pub fn print_fn_block_args(s: ps, decl: ast::fn_decl,
+                           cap_items: ~[ast::capture_item]) {
     word(s.s, ~"|");
     print_fn_args(s, decl, cap_items, None);
     word(s.s, ~"|");
@@ -1745,7 +1759,7 @@ fn print_fn_block_args(s: ps, decl: ast::fn_decl,
     maybe_print_comment(s, decl.output.span.lo);
 }
 
-fn mode_to_str(m: ast::mode) -> ~str {
+pub fn mode_to_str(m: ast::mode) -> ~str {
     match m {
       ast::expl(ast::by_move) => ~"-",
       ast::expl(ast::by_ref) => ~"&&",
@@ -1755,12 +1769,12 @@ fn mode_to_str(m: ast::mode) -> ~str {
     }
 }
 
-fn print_arg_mode(s: ps, m: ast::mode) {
+pub fn print_arg_mode(s: ps, m: ast::mode) {
     let ms = mode_to_str(m);
     if ms != ~"" { word(s.s, ms); }
 }
 
-fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) {
+pub fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) {
     if !bounds.is_empty() {
         word(s.s, ~":");
         let mut first = true;
@@ -1780,7 +1794,7 @@ fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) {
     }
 }
 
-fn print_type_params(s: ps, &&params: ~[ast::ty_param]) {
+pub fn print_type_params(s: ps, &&params: ~[ast::ty_param]) {
     if vec::len(params) > 0u {
         word(s.s, ~"<");
         fn printParam(s: ps, param: ast::ty_param) {
@@ -1792,7 +1806,7 @@ fn print_type_params(s: ps, &&params: ~[ast::ty_param]) {
     }
 }
 
-fn print_meta_item(s: ps, &&item: @ast::meta_item) {
+pub fn print_meta_item(s: ps, &&item: @ast::meta_item) {
     ibox(s, indent_unit);
     match item.node {
       ast::meta_word(ref name) => word(s.s, (*name)),
@@ -1811,7 +1825,7 @@ fn print_meta_item(s: ps, &&item: @ast::meta_item) {
     end(s);
 }
 
-fn print_view_path(s: ps, &&vp: @ast::view_path) {
+pub fn print_view_path(s: ps, &&vp: @ast::view_path) {
     match vp.node {
       ast::view_path_simple(ident, path, namespace, _) => {
         if namespace == ast::module_ns {
@@ -1841,11 +1855,11 @@ fn print_view_path(s: ps, &&vp: @ast::view_path) {
     }
 }
 
-fn print_view_paths(s: ps, vps: ~[@ast::view_path]) {
+pub fn print_view_paths(s: ps, vps: ~[@ast::view_path]) {
     commasep(s, inconsistent, vps, print_view_path);
 }
 
-fn print_view_item(s: ps, item: @ast::view_item) {
+pub fn print_view_item(s: ps, item: @ast::view_item) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
@@ -1876,7 +1890,7 @@ fn print_view_item(s: ps, item: @ast::view_item) {
     end(s); // end outer head-block
 }
 
-fn print_mutability(s: ps, mutbl: ast::mutability) {
+pub fn print_mutability(s: ps, mutbl: ast::mutability) {
     match mutbl {
       ast::m_mutbl => word_nbsp(s, ~"mut"),
       ast::m_const => word_nbsp(s, ~"const"),
@@ -1884,12 +1898,12 @@ fn print_mutability(s: ps, mutbl: ast::mutability) {
     }
 }
 
-fn print_mt(s: ps, mt: ast::mt) {
+pub fn print_mt(s: ps, mt: ast::mt) {
     print_mutability(s, mt.mutbl);
     print_type(s, mt.ty);
 }
 
-fn print_arg(s: ps, input: ast::arg) {
+pub fn print_arg(s: ps, input: ast::arg) {
     ibox(s, indent_unit);
     print_arg_mode(s, input.mode);
     if input.is_mutbl {
@@ -1916,15 +1930,15 @@ fn print_arg(s: ps, input: ast::arg) {
     end(s);
 }
 
-fn print_ty_fn(s: ps,
-               opt_proto: Option<ast::Proto>,
-               opt_region: Option<@ast::region>,
-               purity: ast::purity,
-               onceness: ast::Onceness,
-               bounds: @~[ast::ty_param_bound],
-               decl: ast::fn_decl, id: Option<ast::ident>,
-               tps: Option<~[ast::ty_param]>,
-               opt_self_ty: Option<ast::self_ty_>) {
+pub fn print_ty_fn(s: ps,
+                   opt_proto: Option<ast::Proto>,
+                   opt_region: Option<@ast::region>,
+                   purity: ast::purity,
+                   onceness: ast::Onceness,
+                   bounds: @~[ast::ty_param_bound],
+                   decl: ast::fn_decl, id: Option<ast::ident>,
+                   tps: Option<~[ast::ty_param]>,
+                   opt_self_ty: Option<ast::self_ty_>) {
     ibox(s, indent_unit);
 
     // Duplicates the logic in `print_fn_header_info()`.  This is because that
@@ -1973,8 +1987,8 @@ fn print_ty_fn(s: ps,
     end(s);
 }
 
-fn maybe_print_trailing_comment(s: ps, span: codemap::span,
-                                next_pos: Option<BytePos>) {
+pub fn maybe_print_trailing_comment(s: ps, span: codemap::span,
+                                    next_pos: Option<BytePos>) {
     let mut cm;
     match s.cm { Some(ccm) => cm = ccm, _ => return }
     match next_comment(s) {
@@ -1994,7 +2008,7 @@ fn maybe_print_trailing_comment(s: ps, span: codemap::span,
     }
 }
 
-fn print_remaining_comments(s: ps) {
+pub fn print_remaining_comments(s: ps) {
     // If there aren't any remaining comments, then we need to manually
     // make sure there is a line break at the end.
     if next_comment(s).is_none() { hardbreak(s.s); }
@@ -2006,7 +2020,7 @@ fn print_remaining_comments(s: ps) {
     }
 }
 
-fn print_literal(s: ps, &&lit: @ast::lit) {
+pub fn print_literal(s: ps, &&lit: @ast::lit) {
     maybe_print_comment(s, lit.span.lo);
     match next_lit(s, lit.span.lo) {
       Some(ref ltrl) => {
@@ -2054,11 +2068,11 @@ fn print_literal(s: ps, &&lit: @ast::lit) {
     }
 }
 
-fn lit_to_str(l: @ast::lit) -> ~str {
+pub fn lit_to_str(l: @ast::lit) -> ~str {
     return to_str(l, print_literal, parse::token::mk_fake_ident_interner());
 }
 
-fn next_lit(s: ps, pos: BytePos) -> Option<comments::lit> {
+pub fn next_lit(s: ps, pos: BytePos) -> Option<comments::lit> {
     match s.literals {
       Some(ref lits) => {
         while s.cur_lit < vec::len((*lits)) {
@@ -2073,7 +2087,7 @@ fn next_lit(s: ps, pos: BytePos) -> Option<comments::lit> {
     }
 }
 
-fn maybe_print_comment(s: ps, pos: BytePos) {
+pub fn maybe_print_comment(s: ps, pos: BytePos) {
     loop {
         match next_comment(s) {
           Some(ref cmnt) => {
@@ -2087,7 +2101,7 @@ fn maybe_print_comment(s: ps, pos: BytePos) {
     }
 }
 
-fn print_comment(s: ps, cmnt: comments::cmnt) {
+pub fn print_comment(s: ps, cmnt: comments::cmnt) {
     match cmnt.style {
       comments::mixed => {
         assert (vec::len(cmnt.lines) == 1u);
@@ -2131,13 +2145,13 @@ fn print_comment(s: ps, cmnt: comments::cmnt) {
     }
 }
 
-fn print_string(s: ps, st: ~str) {
+pub fn print_string(s: ps, st: ~str) {
     word(s.s, ~"\"");
     word(s.s, str::escape_default(st));
     word(s.s, ~"\"");
 }
 
-fn to_str<T>(t: T, f: fn@(ps, T), intr: @ident_interner) -> ~str {
+pub fn to_str<T>(t: T, f: fn@(ps, T), intr: @ident_interner) -> ~str {
     do io::with_str_writer |wr| {
         let s = rust_printer(wr, intr);
         f(s, t);
@@ -2145,7 +2159,7 @@ fn to_str<T>(t: T, f: fn@(ps, T), intr: @ident_interner) -> ~str {
     }
 }
 
-fn next_comment(s: ps) -> Option<comments::cmnt> {
+pub fn next_comment(s: ps) -> Option<comments::cmnt> {
     match s.comments {
       Some(ref cmnts) => {
         if s.cur_cmnt < vec::len((*cmnts)) {
@@ -2156,15 +2170,15 @@ fn next_comment(s: ps) -> Option<comments::cmnt> {
     }
 }
 
-fn print_self_ty_if_static(s: ps,
-                           opt_self_ty: Option<ast::self_ty_>) {
+pub fn print_self_ty_if_static(s: ps,
+                               opt_self_ty: Option<ast::self_ty_>) {
     match opt_self_ty {
         Some(ast::sty_static) => { word(s.s, ~"static "); }
         _ => {}
     }
 }
 
-fn print_opt_purity(s: ps, opt_purity: Option<ast::purity>) {
+pub fn print_opt_purity(s: ps, opt_purity: Option<ast::purity>) {
     match opt_purity {
         Some(ast::impure_fn) => { }
         Some(purity) => {
@@ -2174,7 +2188,7 @@ fn print_opt_purity(s: ps, opt_purity: Option<ast::purity>) {
     }
 }
 
-fn print_opt_proto(s: ps, opt_proto: Option<ast::Proto>) {
+pub fn print_opt_proto(s: ps, opt_proto: Option<ast::Proto>) {
     match opt_proto {
         Some(ast::ProtoBare) => { word(s.s, ~"extern "); }
         Some(ast::ProtoBorrowed) => { word(s.s, ~"&"); }
@@ -2184,13 +2198,12 @@ fn print_opt_proto(s: ps, opt_proto: Option<ast::Proto>) {
     };
 }
 
-fn print_fn_header_info(s: ps,
-                        opt_sty: Option<ast::self_ty_>,
-                        opt_purity: Option<ast::purity>,
-                        onceness: ast::Onceness,
-                        opt_proto: Option<ast::Proto>,
-                        vis: ast::visibility)
-{
+pub fn print_fn_header_info(s: ps,
+                            opt_sty: Option<ast::self_ty_>,
+                            opt_purity: Option<ast::purity>,
+                            onceness: ast::Onceness,
+                            opt_proto: Option<ast::Proto>,
+                            vis: ast::visibility) {
     print_self_ty_if_static(s, opt_sty);
     word(s.s, visibility_qualified(vis, ~""));
     print_opt_purity(s, opt_purity);
@@ -2199,14 +2212,14 @@ fn print_fn_header_info(s: ps,
     print_opt_proto(s, opt_proto);
 }
 
-fn opt_proto_to_str(opt_p: Option<ast::Proto>) -> ~str {
+pub fn opt_proto_to_str(opt_p: Option<ast::Proto>) -> ~str {
     match opt_p {
       None => ~"fn",
       Some(p) => proto_to_str(p)
     }
 }
 
-pure fn purity_to_str(p: ast::purity) -> ~str {
+pub pure fn purity_to_str(p: ast::purity) -> ~str {
     match p {
       ast::impure_fn => ~"impure",
       ast::unsafe_fn => ~"unsafe",
@@ -2215,28 +2228,28 @@ pure fn purity_to_str(p: ast::purity) -> ~str {
     }
 }
 
-pure fn onceness_to_str(o: ast::Onceness) -> ~str {
+pub pure fn onceness_to_str(o: ast::Onceness) -> ~str {
     match o {
         ast::Once => ~"once",
         ast::Many => ~"many"
     }
 }
 
-fn print_purity(s: ps, p: ast::purity) {
+pub fn print_purity(s: ps, p: ast::purity) {
     match p {
       ast::impure_fn => (),
       _ => word_nbsp(s, purity_to_str(p))
     }
 }
 
-fn print_onceness(s: ps, o: ast::Onceness) {
+pub fn print_onceness(s: ps, o: ast::Onceness) {
     match o {
         ast::Once => { word_nbsp(s, ~"once"); }
         ast::Many => {}
     }
 }
 
-fn proto_to_str(p: ast::Proto) -> ~str {
+pub fn proto_to_str(p: ast::Proto) -> ~str {
     return match p {
       ast::ProtoBare => ~"extern fn",
       ast::ProtoBorrowed => ~"fn&",
@@ -2246,7 +2259,7 @@ fn proto_to_str(p: ast::Proto) -> ~str {
 }
 
 #[cfg(test)]
-mod test {
+pub mod test {
     use ast;
     use ast_util;
     use parse;
diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rc
index 474b1f3b240..dc5964e6a12 100644
--- a/src/libsyntax/syntax.rc
+++ b/src/libsyntax/syntax.rc
@@ -17,7 +17,6 @@
 #[crate_type = "lib"];
 
 #[legacy_modes];
-#[legacy_exports];
 #[legacy_records];
 
 #[allow(vecs_implicitly_copyable)];
@@ -38,76 +37,52 @@ pub mod syntax {
     pub use parse;
 }
 
-mod attr;
-mod diagnostic;
-mod codemap;
-mod ast;
-mod ast_util;
-mod ast_map;
-#[legacy_exports]
-mod visit;
-#[legacy_exports]
-mod fold;
-#[legacy_exports]
-mod util {
-    #[legacy_exports];
-    #[legacy_exports]
+pub mod attr;
+pub mod diagnostic;
+pub mod codemap;
+pub mod ast;
+pub mod ast_util;
+pub mod ast_map;
+pub mod visit;
+pub mod fold;
+pub mod util {
     #[path = "interner.rs"]
-    mod interner;
+    pub mod interner;
 }
 
 #[path = "parse/mod.rs"]
-mod parse;
-
-mod print {
-    #[legacy_exports];
-    #[legacy_exports]
-    mod pp;
-    #[legacy_exports]
-    mod pprust;
+pub mod parse;
+
+pub mod print {
+    pub mod pp;
+    pub mod pprust;
 }
 
-mod ext {
-    #[legacy_exports];
-    #[legacy_exports]
-    mod base;
-    #[legacy_exports]
-    mod expand;
-
-    mod quote;
-    mod deriving;
-
-    #[legacy_exports]
-    mod build;
-
-    mod tt {
-        #[legacy_exports];
-        #[legacy_exports]
-        mod transcribe;
-        #[legacy_exports]
-        mod macro_parser;
-        #[legacy_exports]
-        mod macro_rules;
+pub mod ext {
+    pub mod base;
+    pub mod expand;
+
+    pub mod quote;
+    pub mod deriving;
+
+    pub mod build;
+
+    pub mod tt {
+        pub mod transcribe;
+        pub mod macro_parser;
+        pub mod macro_rules;
     }
 
 
-    #[legacy_exports]
-    mod fmt;
-    #[legacy_exports]
-    mod env;
-    #[legacy_exports]
-    mod concat_idents;
-    #[legacy_exports]
-    mod log_syntax;
-    #[legacy_exports]
-    mod auto_encode;
-    #[legacy_exports]
-    mod source_util;
+    pub mod fmt;
+    pub mod env;
+    pub mod concat_idents;
+    pub mod log_syntax;
+    pub mod auto_encode;
+    pub mod source_util;
 
     #[path = "pipes/mod.rs"]
-    #[legacy_exports]
-    mod pipes;
+    pub mod pipes;
 
-    #[legacy_exports]
-    mod trace_macros;
+    pub mod trace_macros;
 }
diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs
index 9de875485db..23db470391a 100644
--- a/src/libsyntax/util/interner.rs
+++ b/src/libsyntax/util/interner.rs
@@ -18,18 +18,16 @@ use core::dvec::DVec;
 use std::map::HashMap;
 use std::map;
 
-type hash_interner<T> =
-    {map: HashMap<T, uint>,
-     vect: DVec<T>};
+pub type hash_interner<T> = {map: HashMap<T, uint>, vect: DVec<T>};
 
-fn mk<T:Eq IterBytes Hash Const Copy>() -> Interner<T> {
+pub fn mk<T:Eq IterBytes Hash Const Copy>() -> Interner<T> {
     let m = map::HashMap::<T, uint>();
     let hi: hash_interner<T> =
         {map: m, vect: DVec()};
     move ((move hi) as Interner::<T>)
 }
 
-fn mk_prefill<T:Eq IterBytes Hash Const Copy>(init: &[T]) -> Interner<T> {
+pub fn mk_prefill<T:Eq IterBytes Hash Const Copy>(init: &[T]) -> Interner<T> {
     let rv = mk();
     for init.each() |v| { rv.intern(*v); }
     return rv;
@@ -37,14 +35,14 @@ fn mk_prefill<T:Eq IterBytes Hash Const Copy>(init: &[T]) -> Interner<T> {
 
 
 /* when traits can extend traits, we should extend index<uint,T> to get [] */
-trait Interner<T:Eq IterBytes Hash Const Copy> {
+pub trait Interner<T:Eq IterBytes Hash Const Copy> {
     fn intern(T) -> uint;
     fn gensym(T) -> uint;
     pure fn get(uint) -> T;
     fn len() -> uint;
 }
 
-impl <T:Eq IterBytes Hash Const Copy> hash_interner<T>: Interner<T> {
+pub impl <T:Eq IterBytes Hash Const Copy> hash_interner<T>: Interner<T> {
     fn intern(val: T) -> uint {
         match self.map.find(val) {
           Some(idx) => return idx,
@@ -74,13 +72,13 @@ impl <T:Eq IterBytes Hash Const Copy> hash_interner<T>: Interner<T> {
 
 #[test]
 #[should_fail]
-fn i1 () {
+pub fn i1 () {
     let i : Interner<@~str> = mk();
     i.get(13);
 }
 
 #[test]
-fn i2 () {
+pub fn i2 () {
     let i : Interner<@~str> = mk();
     // first one is zero:
     assert i.intern (@~"dog") == 0;
@@ -105,7 +103,7 @@ fn i2 () {
 }
 
 #[test]
-fn i3 () {
+pub fn i3 () {
     let i : Interner<@~str> = mk_prefill([@~"Alan",@~"Bob",@~"Carol"]);
     assert i.get(0) == @~"Alan";
     assert i.get(1) == @~"Bob";
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 4d68c982d06..196ee349b79 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -27,9 +27,9 @@ use core::vec;
 
 // Our typesystem doesn't do circular types, so the visitor record can not
 // hold functions that take visitors. A vt enum is used to break the cycle.
-enum vt<E> { mk_vt(visitor<E>), }
+pub enum vt<E> { mk_vt(visitor<E>), }
 
-enum fn_kind {
+pub enum fn_kind {
     fk_item_fn(ident, ~[ty_param], purity), //< an item declared with fn()
     fk_method(ident, ~[ty_param], @method),
     fk_anon(Proto, capture_clause),  //< an anonymous function like fn@(...)
@@ -39,7 +39,7 @@ enum fn_kind {
 
 }
 
-fn name_of_fn(fk: fn_kind) -> ident {
+pub fn name_of_fn(fk: fn_kind) -> ident {
     match fk {
       fk_item_fn(name, _, _) | fk_method(name, _, _) => {
           /* FIXME (#2543) */ copy name
@@ -49,7 +49,7 @@ fn name_of_fn(fk: fn_kind) -> ident {
     }
 }
 
-fn tps_of_fn(fk: fn_kind) -> ~[ty_param] {
+pub fn tps_of_fn(fk: fn_kind) -> ~[ty_param] {
     match fk {
         fk_item_fn(_, tps, _) | fk_method(_, tps, _) |
         fk_dtor(tps, _, _, _) => {
@@ -59,7 +59,7 @@ fn tps_of_fn(fk: fn_kind) -> ~[ty_param] {
     }
 }
 
-struct Visitor<E> {
+pub struct Visitor<E> {
     visit_mod: fn@(_mod, span, node_id, E, vt<E>),
     visit_view_item: fn@(@view_item, E, vt<E>),
     visit_foreign_item: fn@(@foreign_item, E, vt<E>),
@@ -83,9 +83,9 @@ struct Visitor<E> {
     visit_struct_method: fn@(@method, E, vt<E>)
 }
 
-type visitor<E> = @Visitor<E>;
+pub type visitor<E> = @Visitor<E>;
 
-fn default_visitor<E>() -> visitor<E> {
+pub fn default_visitor<E>() -> visitor<E> {
     return @Visitor {
         visit_mod: |a,b,c,d,e|visit_mod::<E>(a, b, c, d, e),
         visit_view_item: |a,b,c|visit_view_item::<E>(a, b, c),
@@ -111,18 +111,18 @@ fn default_visitor<E>() -> visitor<E> {
     };
 }
 
-fn visit_crate<E>(c: crate, e: E, v: vt<E>) {
+pub fn visit_crate<E>(c: crate, e: E, v: vt<E>) {
     (v.visit_mod)(c.node.module, c.span, crate_node_id, e, v);
 }
 
-fn visit_mod<E>(m: _mod, _sp: span, _id: node_id, e: E, v: vt<E>) {
+pub fn visit_mod<E>(m: _mod, _sp: span, _id: node_id, e: E, v: vt<E>) {
     for m.view_items.each |vi| { (v.visit_view_item)(*vi, e, v); }
     for m.items.each |i| { (v.visit_item)(*i, e, v); }
 }
 
-fn visit_view_item<E>(_vi: @view_item, _e: E, _v: vt<E>) { }
+pub fn visit_view_item<E>(_vi: @view_item, _e: E, _v: vt<E>) { }
 
-fn visit_local<E>(loc: @local, e: E, v: vt<E>) {
+pub fn visit_local<E>(loc: @local, e: E, v: vt<E>) {
     (v.visit_pat)(loc.node.pat, e, v);
     (v.visit_ty)(loc.node.ty, e, v);
     match loc.node.init {
@@ -131,7 +131,7 @@ fn visit_local<E>(loc: @local, e: E, v: vt<E>) {
     }
 }
 
-fn visit_item<E>(i: @item, e: E, v: vt<E>) {
+pub fn visit_item<E>(i: @item, e: E, v: vt<E>) {
     match i.node {
       item_const(t, ex) => {
         (v.visit_ty)(t, e, v);
@@ -181,8 +181,10 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
     }
 }
 
-fn visit_enum_def<E>(enum_definition: ast::enum_def, tps: ~[ast::ty_param],
-                     e: E, v: vt<E>) {
+pub fn visit_enum_def<E>(enum_definition: ast::enum_def,
+                         tps: ~[ast::ty_param],
+                         e: E,
+                         v: vt<E>) {
     for enum_definition.variants.each |vr| {
         match vr.node.kind {
             tuple_variant_kind(variant_args) => {
@@ -201,9 +203,9 @@ fn visit_enum_def<E>(enum_definition: ast::enum_def, tps: ~[ast::ty_param],
     }
 }
 
-fn skip_ty<E>(_t: @Ty, _e: E, _v: vt<E>) {}
+pub fn skip_ty<E>(_t: @Ty, _e: E, _v: vt<E>) {}
 
-fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
+pub fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
     match t.node {
       ty_box(mt) | ty_uniq(mt) |
       ty_vec(mt) | ty_ptr(mt) | ty_rptr(_, mt) => {
@@ -229,11 +231,11 @@ fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
     }
 }
 
-fn visit_path<E>(p: @path, e: E, v: vt<E>) {
+pub fn visit_path<E>(p: @path, e: E, v: vt<E>) {
     for p.types.each |tp| { (v.visit_ty)(*tp, e, v); }
 }
 
-fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
+pub fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
     match p.node {
       pat_enum(path, children) => {
         visit_path(path, e, v);
@@ -275,7 +277,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
     }
 }
 
-fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
+pub fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
     match ni.node {
       foreign_item_fn(fd, _, tps) => {
         (v.visit_ty_params)(tps, e, v);
@@ -287,7 +289,7 @@ fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
     }
 }
 
-fn visit_ty_param_bounds<E>(bounds: @~[ty_param_bound], e: E, v: vt<E>) {
+pub fn visit_ty_param_bounds<E>(bounds: @~[ty_param_bound], e: E, v: vt<E>) {
     for bounds.each |&bound| {
         match bound {
             TraitTyParamBound(ty) => (v.visit_ty)(ty, e, v),
@@ -296,13 +298,13 @@ fn visit_ty_param_bounds<E>(bounds: @~[ty_param_bound], e: E, v: vt<E>) {
     }
 }
 
-fn visit_ty_params<E>(tps: ~[ty_param], e: E, v: vt<E>) {
+pub fn visit_ty_params<E>(tps: ~[ty_param], e: E, v: vt<E>) {
     for tps.each |tp| {
         visit_ty_param_bounds(tp.bounds, e, v);
     }
 }
 
-fn visit_fn_decl<E>(fd: fn_decl, e: E, v: vt<E>) {
+pub fn visit_fn_decl<E>(fd: fn_decl, e: E, v: vt<E>) {
     for fd.inputs.each |a| {
         (v.visit_pat)(a.pat, e, v);
         (v.visit_ty)(a.ty, e, v);
@@ -314,42 +316,42 @@ fn visit_fn_decl<E>(fd: fn_decl, e: E, v: vt<E>) {
 // visit_fn() and check for fk_method().  I named this visit_method_helper()
 // because it is not a default impl of any method, though I doubt that really
 // clarifies anything. - Niko
-fn visit_method_helper<E>(m: @method, e: E, v: vt<E>) {
+pub fn visit_method_helper<E>(m: @method, e: E, v: vt<E>) {
     (v.visit_fn)(fk_method(/* FIXME (#2543) */ copy m.ident,
                          /* FIXME (#2543) */ copy m.tps, m),
                m.decl, m.body, m.span, m.id, e, v);
 }
 
-fn visit_struct_dtor_helper<E>(dtor: struct_dtor, tps: ~[ty_param],
-                              parent_id: def_id, e: E, v: vt<E>) {
+pub fn visit_struct_dtor_helper<E>(dtor: struct_dtor, tps: ~[ty_param],
+                                   parent_id: def_id, e: E, v: vt<E>) {
     (v.visit_fn)(fk_dtor(/* FIXME (#2543) */ copy tps, dtor.node.attrs,
                        dtor.node.self_id, parent_id), ast_util::dtor_dec(),
                dtor.node.body, dtor.span, dtor.node.id, e, v)
 
 }
 
-fn visit_fn<E>(fk: fn_kind, decl: fn_decl, body: blk, _sp: span,
-               _id: node_id, e: E, v: vt<E>) {
+pub fn visit_fn<E>(fk: fn_kind, decl: fn_decl, body: blk, _sp: span,
+                   _id: node_id, e: E, v: vt<E>) {
     visit_fn_decl(decl, e, v);
     (v.visit_ty_params)(tps_of_fn(fk), e, v);
     (v.visit_block)(body, e, v);
 }
 
-fn visit_ty_method<E>(m: ty_method, e: E, v: vt<E>) {
+pub fn visit_ty_method<E>(m: ty_method, e: E, v: vt<E>) {
     for m.decl.inputs.each |a| { (v.visit_ty)(a.ty, e, v); }
     (v.visit_ty_params)(m.tps, e, v);
     (v.visit_ty)(m.decl.output, e, v);
 }
 
-fn visit_trait_method<E>(m: trait_method, e: E, v: vt<E>) {
+pub fn visit_trait_method<E>(m: trait_method, e: E, v: vt<E>) {
     match m {
       required(ref ty_m) => (v.visit_ty_method)((*ty_m), e, v),
       provided(m) => visit_method_helper(m, e, v)
     }
 }
 
-fn visit_struct_def<E>(sd: @struct_def, _nm: ast::ident, tps: ~[ty_param],
-                       id: node_id, e: E, v: vt<E>) {
+pub fn visit_struct_def<E>(sd: @struct_def, _nm: ast::ident, tps: ~[ty_param],
+                           id: node_id, e: E, v: vt<E>) {
     for sd.fields.each |f| {
         (v.visit_struct_field)(*f, e, v);
     }
@@ -358,15 +360,15 @@ fn visit_struct_def<E>(sd: @struct_def, _nm: ast::ident, tps: ~[ty_param],
     };
 }
 
-fn visit_struct_field<E>(sf: @struct_field, e: E, v: vt<E>) {
+pub fn visit_struct_field<E>(sf: @struct_field, e: E, v: vt<E>) {
     (v.visit_ty)(sf.node.ty, e, v);
 }
 
-fn visit_struct_method<E>(m: @method, e: E, v: vt<E>) {
+pub fn visit_struct_method<E>(m: @method, e: E, v: vt<E>) {
     visit_method_helper(m, e, v);
 }
 
-fn visit_block<E>(b: ast::blk, e: E, v: vt<E>) {
+pub fn visit_block<E>(b: ast::blk, e: E, v: vt<E>) {
     for b.node.view_items.each |vi| {
         (v.visit_view_item)(*vi, e, v);
     }
@@ -376,7 +378,7 @@ fn visit_block<E>(b: ast::blk, e: E, v: vt<E>) {
     visit_expr_opt(b.node.expr, e, v);
 }
 
-fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
+pub fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
     match s.node {
       stmt_decl(d, _) => (v.visit_decl)(d, e, v),
       stmt_expr(ex, _) => (v.visit_expr)(ex, e, v),
@@ -385,7 +387,7 @@ fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
     }
 }
 
-fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
+pub fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
     match d.node {
       decl_local(locs) => for locs.each |loc| {
         (v.visit_local)(*loc, e, v)
@@ -394,19 +396,19 @@ fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
     }
 }
 
-fn visit_expr_opt<E>(eo: Option<@expr>, e: E, v: vt<E>) {
+pub fn visit_expr_opt<E>(eo: Option<@expr>, e: E, v: vt<E>) {
     match eo { None => (), Some(ex) => (v.visit_expr)(ex, e, v) }
 }
 
-fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) {
+pub fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) {
     for exprs.each |ex| { (v.visit_expr)(*ex, e, v); }
 }
 
-fn visit_mac<E>(_m: mac, _e: E, _v: vt<E>) {
+pub fn visit_mac<E>(_m: mac, _e: E, _v: vt<E>) {
     /* no user-serviceable parts inside */
 }
 
-fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
+pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
     match ex.node {
       expr_vstore(x, _) => (v.visit_expr)(x, e, v),
       expr_vec(es, _) => visit_exprs(es, e, v),
@@ -498,7 +500,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
     (v.visit_expr_post)(ex, e, v);
 }
 
-fn visit_arm<E>(a: arm, e: E, v: vt<E>) {
+pub fn visit_arm<E>(a: arm, e: E, v: vt<E>) {
     for a.pats.each |p| { (v.visit_pat)(*p, e, v); }
     visit_expr_opt(a.guard, e, v);
     (v.visit_block)(a.body, e, v);
@@ -507,7 +509,7 @@ fn visit_arm<E>(a: arm, e: E, v: vt<E>) {
 // Simpler, non-context passing interface. Always walks the whole tree, simply
 // calls the given functions on the nodes.
 
-struct SimpleVisitor {
+pub struct SimpleVisitor {
     visit_mod: fn@(_mod, span, node_id),
     visit_view_item: fn@(@view_item),
     visit_foreign_item: fn@(@foreign_item),
@@ -530,11 +532,11 @@ struct SimpleVisitor {
     visit_struct_method: fn@(@method)
 }
 
-type simple_visitor = @SimpleVisitor;
+pub type simple_visitor = @SimpleVisitor;
 
-fn simple_ignore_ty(_t: @Ty) {}
+pub fn simple_ignore_ty(_t: @Ty) {}
 
-fn default_simple_visitor() -> @SimpleVisitor {
+pub fn default_simple_visitor() -> @SimpleVisitor {
     return @SimpleVisitor {visit_mod: |_m: _mod, _sp: span, _id: node_id| { },
           visit_view_item: |_vi: @view_item| { },
           visit_foreign_item: |_ni: @foreign_item| { },
@@ -560,7 +562,7 @@ fn default_simple_visitor() -> @SimpleVisitor {
          };
 }
 
-fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
+pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
     fn v_mod(f: fn@(_mod, span, node_id), m: _mod, sp: span, id: node_id,
              &&e: (), v: vt<()>) {
         f(m, sp, id);