summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-01-08 19:37:25 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-01-08 22:02:35 -0800
commit2db3abddcd6784dc5529081c6d831c972abbe755 (patch)
tree0f18922234f5fce5fda2af3bdbd7ad4a03423ecd /src/libsyntax
parent3a5b64172045e7f1ec1981c8da2150c7feb73079 (diff)
downloadrust-2db3abddcd6784dc5529081c6d831c972abbe755.tar.gz
rust-2db3abddcd6784dc5529081c6d831c972abbe755.zip
librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs15
-rw-r--r--src/libsyntax/ast_map.rs2
-rw-r--r--src/libsyntax/ast_util.rs3
-rw-r--r--src/libsyntax/attr.rs2
-rw-r--r--src/libsyntax/codemap.rs2
-rw-r--r--src/libsyntax/diagnostic.rs2
-rw-r--r--src/libsyntax/ext/auto_encode.rs6
-rw-r--r--src/libsyntax/ext/base.rs2
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/concat_idents.rs2
-rw-r--r--src/libsyntax/ext/deriving.rs2
-rw-r--r--src/libsyntax/ext/expand.rs2
-rw-r--r--src/libsyntax/ext/fmt.rs2
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs41
-rw-r--r--src/libsyntax/ext/pipes/check.rs3
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs5
-rw-r--r--src/libsyntax/ext/pipes/mod.rs2
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs3
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs4
-rw-r--r--src/libsyntax/ext/pipes/proto.rs4
-rw-r--r--src/libsyntax/ext/quote.rs2
-rw-r--r--src/libsyntax/ext/source_util.rs1
-rw-r--r--src/libsyntax/ext/trace_macros.rs9
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs2
-rw-r--r--src/libsyntax/fold.rs2
-rw-r--r--src/libsyntax/parse/attr.rs3
-rw-r--r--src/libsyntax/parse/comments.rs4
-rw-r--r--src/libsyntax/parse/common.rs4
-rw-r--r--src/libsyntax/parse/lexer.rs4
-rw-r--r--src/libsyntax/parse/mod.rs106
-rw-r--r--src/libsyntax/parse/obsolete.rs3
-rw-r--r--src/libsyntax/parse/parser.rs38
-rw-r--r--src/libsyntax/parse/prec.rs4
-rw-r--r--src/libsyntax/parse/token.rs2
-rw-r--r--src/libsyntax/print/pp.rs2
-rw-r--r--src/libsyntax/print/pprust.rs6
-rw-r--r--src/libsyntax/util/interner.rs10
-rw-r--r--src/libsyntax/visit.rs2
39 files changed, 206 insertions, 106 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index c7c8c77c70f..42e722f8d53 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -12,10 +12,10 @@
 
 use ast;
 use codemap::{span, FileName};
-use parse::token;
 
 use core::cast;
 use core::cmp;
+use core::option::{None, Option, Some};
 use core::ptr;
 use core::task;
 use core::to_bytes;
@@ -29,7 +29,8 @@ type spanned<T> = {node: T, span: span};
 /* can't import macros yet, so this is copied from token.rs. See its comment
  * there. */
 macro_rules! interner_key (
-    () => (cast::transmute::<(uint, uint), &fn(+v: @@token::ident_interner)>(
+    () => (cast::transmute::<(uint, uint),
+            &fn(+v: @@::parse::token::ident_interner)>(
         (-3 as uint, 0u)))
 )
 
@@ -768,10 +769,10 @@ type capture_clause = @~[capture_item];
 #[auto_decode]
 #[doc="For macro invocations; parsing is delegated to the macro"]
 enum token_tree {
-    tt_tok(span, token::Token),
+    tt_tok(span, ::parse::token::Token),
     tt_delim(~[token_tree]),
     // These only make sense for right-hand-sides of MBE macros
-    tt_seq(span, ~[token_tree], Option<token::Token>, bool),
+    tt_seq(span, ~[token_tree], Option<::parse::token::Token>, bool),
     tt_nonterminal(span, ident)
 }
 
@@ -833,10 +834,10 @@ type matcher = spanned<matcher_>;
 #[auto_decode]
 enum matcher_ {
     // match one token
-    match_tok(token::Token),
+    match_tok(::parse::token::Token),
     // match repetitions of a sequence: body, separator, zero ok?,
     // lo, hi position-in-match-array used:
-    match_seq(~[matcher], Option<token::Token>, bool, uint, uint),
+    match_seq(~[matcher], Option<::parse::token::Token>, bool, uint, uint),
     // parse a Rust NT: name to bind, name of NT, position in match array:
     match_nonterminal(ident, ident, uint)
 }
@@ -1149,7 +1150,7 @@ type fn_decl =
 
 #[auto_encode]
 #[auto_decode]
-enum purity {
+pub enum purity {
     pure_fn, // declared with "pure fn"
     unsafe_fn, // declared with "unsafe fn"
     impure_fn, // declared with "fn"
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index f35d8c4e1c4..f56f0c545bf 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::*;
 use ast;
 use ast_util::{path_to_ident, stmt_id};
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index eaa61b304cd..3cab2151fde 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -8,10 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::*;
 use ast;
 use ast_util;
 use codemap::{span, BytePos};
+use parse::token;
 use visit;
 
 use core::cmp;
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 73c14e2d00c..985e0951794 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -10,6 +10,8 @@
 
 // Functions dealing with attributes and meta_items
 
+use core::prelude::*;
+
 use ast;
 use ast_util::{spanned, dummy_spanned};
 use attr;
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 1f26711abb9..1e4a40405fd 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -21,6 +21,8 @@ source code snippets, etc.
 
 */
 
+use core::prelude::*;
+
 use ast_util;
 
 use core::cmp;
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index ddffa04622f..7e9d257a742 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use codemap::span;
 use codemap;
 
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index b8fe00e246c..152c49461b8 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -88,10 +88,14 @@ node twice.
 
 */
 
+use core::prelude::*;
+
+use ast;
 use ast_util;
 use attr;
 use codemap::span;
 use ext::base::*;
+use parse;
 
 use core::vec;
 use std::map;
@@ -421,7 +425,7 @@ fn mk_impl(
     @{
         // This is a new-style impl declaration.
         // XXX: clownshoes
-        ident: ast::token::special_idents::clownshoes_extensions,
+        ident: parse::token::special_idents::clownshoes_extensions,
         attrs: ~[],
         id: cx.next_id(),
         node: ast::item_impl(trait_tps, opt_trait, ty, ~[f(ty)]),
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index dc774805ed3..7b69084a827 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast_util::dummy_sp;
 use codemap;
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index d63f14b5774..4a3c8ee2259 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use codemap;
 use codemap::span;
diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs
index 4f88ffeeb04..d847cfee053 100644
--- a/src/libsyntax/ext/concat_idents.rs
+++ b/src/libsyntax/ext/concat_idents.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ext::base::*;
 use ext::base;
 
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index 3cbc8f3834f..41804b1022a 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -11,6 +11,8 @@
 /// The compiler code necessary to implement the #[deriving_eq] and
 /// #[deriving_iter_bytes] extensions.
 
+use core::prelude::*;
+
 use ast::{Ty, and, bind_by_ref, binop, deref, enum_def, enum_variant_kind};
 use ast::{expr, expr_match, ident, item, item_, item_struct, item_enum};
 use ast::{item_impl, m_imm, meta_item, method, named_field, or, pat};
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 27565b44c6d..8faeb167191 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::{crate, expr_, expr_mac, mac_invoc_tt};
 use ast::{tt_delim, tt_tok, item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi};
 use ast;
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index b8a27096f73..0eaa983ccad 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -16,6 +16,8 @@
  * compiler syntax extension plugin interface.
  */
 
+use core::prelude::*;
+
 use ast;
 use codemap::span;
 use ext::base::*;
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 7a87d909fe6..56ace4aac1b 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -13,13 +13,15 @@
 // To start with, it will be use dummy spans, but it might someday do
 // something smarter.
 
+use core::prelude::*;
+
 use ast::{ident, node_id};
 use ast;
 use ast_util::{ident_to_path, respan, dummy_sp};
 use ast_util;
 use attr;
 use codemap::span;
-use ext::base::mk_ctxt;
+use ext::base::{ext_ctxt, mk_ctxt};
 use ext::quote::rt::*;
 
 use core::vec;
@@ -112,9 +114,11 @@ trait ext_ctxt_ast_builder {
 
 impl ext_ctxt: ext_ctxt_ast_builder {
     fn ty_option(ty: @ast::Ty) -> @ast::Ty {
-        self.ty_path_ast_builder(path(~[self.ident_of(~"Option")],
-                                      dummy_sp())
-                                 .add_ty(ty))
+        self.ty_path_ast_builder(path_global(~[
+            self.ident_of(~"core"),
+            self.ident_of(~"option"),
+            self.ident_of(~"Option")
+        ], dummy_sp()).add_ty(ty))
     }
 
     fn block_expr(b: ast::blk) -> @ast::expr {
@@ -283,10 +287,37 @@ impl ext_ctxt: ext_ctxt_ast_builder {
     fn item_mod(name: ident,
                 span: span,
                 +items: ~[@ast::item]) -> @ast::item {
+        // XXX: Total hack: import `core::kinds::Owned` to work around a
+        // parser bug whereby `fn f<T: ::kinds::Owned>` doesn't parse.
+        let vi = ast::view_item_import(~[
+            @{
+                node: ast::view_path_simple(
+                    self.ident_of(~"Owned"),
+                    path(
+                        ~[
+                            self.ident_of(~"core"),
+                            self.ident_of(~"kinds"),
+                            self.ident_of(~"Owned")
+                        ],
+                        ast_util::dummy_sp()
+                    ),
+                    ast::type_value_ns,
+                    self.next_id()
+                ),
+                span: ast_util::dummy_sp()
+            }
+        ]);
+        let vi = @{
+            node: vi,
+            attrs: ~[],
+            vis: ast::private,
+            span: ast_util::dummy_sp()
+        };
+
         self.item(name,
                   span,
                   ast::item_mod({
-                      view_items: ~[],
+                      view_items: ~[vi],
                       items: items}))
     }
 
diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs
index 8eecafa8fa4..f2ba413dd38 100644
--- a/src/libsyntax/ext/pipes/check.rs
+++ b/src/libsyntax/ext/pipes/check.rs
@@ -29,7 +29,10 @@ that.
 
 */
 
+use core::prelude::*;
+
 use ast;
+use codemap::span;
 use ext::base::ext_ctxt;
 use ext::pipes::proto::{state, protocol, next_state};
 use ext::pipes::proto;
diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs
index 76749f6b2db..01e99594083 100644
--- a/src/libsyntax/ext/pipes/liveness.rs
+++ b/src/libsyntax/ext/pipes/liveness.rs
@@ -37,6 +37,11 @@ updating the states using rule (2) until there are no changes.
 
 */
 
+use core::prelude::*;
+
+use ext::base::ext_ctxt;
+use ext::pipes::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 67b5c81ad2d..cb17e56e990 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -53,6 +53,8 @@ use ext::pipes::proto::{visit, protocol};
 use parse::lexer::{new_tt_reader, reader};
 use parse::parser::Parser;
 
+use core::option::None;
+
 #[legacy_exports]
 mod ast_builder;
 #[legacy_exports]
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index 0f6b9dbda28..6a6e895bd40 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -10,10 +10,11 @@
 
 // Parsing pipes protocols from token trees.
 
+use ext::pipes::pipec::*;
 use parse::parser;
 use parse::token;
 
-use ext::pipes::pipec::*;
+use core::prelude::*;
 
 trait proto_parser {
     fn parse_proto(id: ~str) -> protocol;
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index ef9c086e3f5..e88ddb841be 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -20,6 +20,7 @@ use parse::*;
 use util::interner;
 
 use core::dvec::DVec;
+use core::prelude::*;
 use core::str;
 use core::to_str::ToStr;
 use core::vec;
@@ -385,7 +386,8 @@ impl protocol: gen_init {
             }
         }
 
-        cx.ty_path_ast_builder(path(~[cx.ident_of(~"__Buffer")], self.span)
+        cx.ty_path_ast_builder(path(~[cx.ident_of(~"super"),
+                                      cx.ident_of(~"__Buffer")], self.span)
                                .add_tys(cx.ty_vars_global(params)))
     }
 
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index a2673c481b1..9953b4de50d 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -8,7 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
+use codemap::span;
+use ext::base::ext_ctxt;
 use ext::pipes::ast_builder::{path, append_types};
 
 use core::cmp;
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 184093715c6..4aed5b64747 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -18,6 +18,7 @@ use parse::token::*;
 use parse::token;
 use parse;
 
+use core::prelude::*;
 use core::str;
 
 /**
@@ -33,6 +34,7 @@ use core::str;
 
 pub mod rt {
     use ast;
+    use ext::base::ext_ctxt;
     use parse;
     use print::pprust;
 
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 47c6ea8876e..3d012b393bb 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -16,6 +16,7 @@ use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_base_str};
 use print::pprust;
 
 use core::io;
+use core::prelude::*;
 use core::result;
 use core::str;
 use core::vec;
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index c202778d0df..d5031b97718 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -8,17 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use ast::tt_delim;
 use ast;
 use codemap::span;
-use ext::base;
 use ext::base::ext_ctxt;
-use ast::tt_delim;
+use ext::base;
 use parse::lexer::{new_tt_reader, reader};
 use parse::parser::Parser;
 
+use core::option::None;
+
 fn expand_trace_macros(cx: ext_ctxt, sp: span,
-                       tt: ~[ast::token_tree]) -> base::mac_result
-{
+                       tt: ~[ast::token_tree]) -> base::mac_result {
     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_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 7386b3b67b9..1f1efdfe165 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq};
 use ast::{tt_delim};
 use ast;
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index c1745fac710..47489034a0f 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident};
 use ast_util;
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 6d32c73e1f7..7de4e3f1d5f 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::*;
 use ast;
 use codemap::span;
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index a3fd069afbb..49197be4bb9 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -8,8 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast_util::spanned;
+use codemap::BytePos;
 use parse::common::*; //resolve bug?
 use parse::token;
 
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index d5365d59041..0e101d54ba3 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
-use codemap::{CodeMap, FileMap, CharPos};
+use codemap::{BytePos, CharPos, CodeMap, FileMap};
 use diagnostic;
 use parse::lexer::{is_whitespace, get_str_from, reader};
 use parse::lexer::{string_reader, bump, is_eof, nextch};
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs
index ca0bbbb7369..1c6022130dc 100644
--- a/src/libsyntax/parse/common.rs
+++ b/src/libsyntax/parse/common.rs
@@ -8,12 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast_util::spanned;
+use codemap::BytePos;
 use parse::lexer::reader;
 use parse::parser::Parser;
 use parse::token;
 
+use core::option::{None, Option, Some};
 use core::option;
 use std::map::HashMap;
 
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index c51f7e4dad6..573c36e619b 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -8,13 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast_util;
 use codemap::{span, CodeMap, CharPos, BytePos};
 use codemap;
 use diagnostic::span_handler;
 use ext::tt::transcribe::{tt_next_token};
-use ext::tt::transcribe::{tt_reader,  new_tt_reader, dup_tt_reader};
+use ext::tt::transcribe::{tt_reader, new_tt_reader, dup_tt_reader};
 use parse::token;
 
 use core::char;
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index fb5c6250179..b14b60af134 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -10,8 +10,6 @@
 
 //! The main parser interface
 
-#[legacy_exports];
-
 use ast::node_id;
 use ast;
 use codemap::{span, CodeMap, FileMap, CharPos, BytePos};
@@ -24,70 +22,47 @@ use parse::token::{ident_interner, mk_ident_interner};
 use util::interner;
 
 use core::io;
+use core::option::{None, Option, Some};
+use core::path::Path;
+use core::result::{Err, Ok, Result};
 use core::result;
 
-export parser;
-export common;
-export lexer;
-export token;
-export comments;
-export prec;
-export classify;
-export attr;
-export obsolete;
-
-export parse_sess;
-export new_parse_sess, new_parse_sess_special_handler;
-export next_node_id;
-export new_parser_from_file, new_parser_etc_from_file;
-export new_parser_from_source_str;
-export new_parser_from_tts;
-export new_sub_parser_from_file;
-export parse_crate_from_file, parse_crate_from_crate_file;
-export parse_crate_from_source_str;
-export parse_expr_from_source_str, parse_item_from_source_str;
-export parse_stmt_from_source_str;
-export parse_tts_from_source_str;
-export parse_from_source_str;
-
-
 #[legacy_exports]
-mod lexer;
+pub mod lexer;
 #[legacy_exports]
-mod parser;
+pub mod parser;
 #[legacy_exports]
-mod token;
+pub mod token;
 #[legacy_exports]
-mod comments;
+pub mod comments;
 #[legacy_exports]
-mod attr;
+pub mod attr;
 #[legacy_exports]
 
 /// Common routines shared by parser mods
 #[legacy_exports]
-mod common;
+pub mod common;
 
 /// Functions dealing with operator precedence
 #[legacy_exports]
-mod prec;
+pub mod prec;
 
 /// Routines the parser uses to classify AST nodes
 #[legacy_exports]
-mod classify;
+pub mod classify;
 
 /// Reporting obsolete syntax
 #[legacy_exports]
-mod obsolete;
-
+pub mod obsolete;
 
-type parse_sess = @{
+pub type parse_sess = @{
     cm: @codemap::CodeMap,
     mut next_id: node_id,
     span_diagnostic: span_handler,
     interner: @ident_interner,
 };
 
-fn new_parse_sess(demitter: Option<emitter>) -> parse_sess {
+pub fn new_parse_sess(demitter: Option<emitter>) -> parse_sess {
     let cm = @CodeMap::new();
     return @{cm: cm,
              mut next_id: 1,
@@ -96,7 +71,7 @@ fn new_parse_sess(demitter: Option<emitter>) -> parse_sess {
             };
 }
 
-fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap)
+pub fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap)
     -> parse_sess {
     return @{cm: cm,
              mut next_id: 1,
@@ -105,15 +80,17 @@ fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap)
              };
 }
 
-fn parse_crate_from_file(input: &Path, cfg: ast::crate_cfg,
+pub fn parse_crate_from_file(input: &Path, cfg: ast::crate_cfg,
                          sess: parse_sess) -> @ast::crate {
     let p = new_crate_parser_from_file(sess, cfg, input);
     let r = p.parse_crate_mod(cfg);
     return r;
 }
 
-fn parse_crate_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
-                               sess: parse_sess) -> @ast::crate {
+pub fn parse_crate_from_source_str(name: ~str,
+                                   source: @~str,
+                                   cfg: ast::crate_cfg,
+                                   sess: parse_sess) -> @ast::crate {
     let p = new_parser_from_source_str(sess, cfg, name,
                                        codemap::FssNone, source);
     let r = p.parse_crate_mod(cfg);
@@ -121,8 +98,10 @@ fn parse_crate_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
     return r;
 }
 
-fn parse_expr_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
-                              sess: parse_sess) -> @ast::expr {
+pub fn parse_expr_from_source_str(name: ~str,
+                                  source: @~str,
+                                  cfg: ast::crate_cfg,
+                                  sess: parse_sess) -> @ast::expr {
     let p = new_parser_from_source_str(sess, cfg, name,
                                        codemap::FssNone, source);
     let r = p.parse_expr();
@@ -130,9 +109,12 @@ fn parse_expr_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
     return r;
 }
 
-fn parse_item_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
-                              +attrs: ~[ast::attribute],
-                              sess: parse_sess) -> Option<@ast::item> {
+pub fn parse_item_from_source_str(name: ~str,
+                                  source: @~str,
+                                  cfg: ast::crate_cfg,
+                                  +attrs: ~[ast::attribute],
+                                  sess: parse_sess)
+                               -> Option<@ast::item> {
     let p = new_parser_from_source_str(sess, cfg, name,
                                        codemap::FssNone, source);
     let r = p.parse_item(attrs);
@@ -140,9 +122,11 @@ fn parse_item_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
     return r;
 }
 
-fn parse_stmt_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
-                              +attrs: ~[ast::attribute],
-                              sess: parse_sess) -> @ast::stmt {
+pub fn parse_stmt_from_source_str(name: ~str,
+                                  source: @~str,
+                                  cfg: ast::crate_cfg,
+                                  +attrs: ~[ast::attribute],
+                                  sess: parse_sess) -> @ast::stmt {
     let p = new_parser_from_source_str(sess, cfg, name,
                                        codemap::FssNone, source);
     let r = p.parse_stmt(attrs);
@@ -150,8 +134,10 @@ fn parse_stmt_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
     return r;
 }
 
-fn parse_tts_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
-                             sess: parse_sess) -> ~[ast::token_tree] {
+pub fn parse_tts_from_source_str(name: ~str,
+                                 source: @~str,
+                                 cfg: ast::crate_cfg,
+                                 sess: parse_sess) -> ~[ast::token_tree] {
     let p = new_parser_from_source_str(sess, cfg, name,
                                        codemap::FssNone, source);
     p.quote_depth += 1u;
@@ -160,7 +146,7 @@ fn parse_tts_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg,
     return r;
 }
 
-fn parse_from_source_str<T>(f: fn (p: Parser) -> T,
+pub fn parse_from_source_str<T>(f: fn (p: Parser) -> T,
                             name: ~str, ss: codemap::FileSubstr,
                             source: @~str, cfg: ast::crate_cfg,
                             sess: parse_sess)
@@ -176,7 +162,7 @@ fn parse_from_source_str<T>(f: fn (p: Parser) -> T,
     move r
 }
 
-fn next_node_id(sess: parse_sess) -> node_id {
+pub fn next_node_id(sess: parse_sess) -> node_id {
     let rv = sess.next_id;
     sess.next_id += 1;
     // ID 0 is reserved for the crate and doesn't actually exist in the AST
@@ -184,7 +170,7 @@ fn next_node_id(sess: parse_sess) -> node_id {
     return rv;
 }
 
-fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg,
+pub fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg,
                               +name: ~str, +ss: codemap::FileSubstr,
                               source: @~str) -> Parser {
     let filemap = sess.cm.new_filemap_w_substr(name, ss, source);
@@ -193,7 +179,7 @@ fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg,
     return Parser(sess, cfg, srdr as reader);
 }
 
-fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
+pub fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
                         path: &Path) -> Result<Parser, ~str> {
     match io::read_whole_file_str(path) {
       result::Ok(move src) => {
@@ -211,7 +197,7 @@ fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
 
 /// Create a new parser for an entire crate, handling errors as appropriate
 /// if the file doesn't exist
-fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
+pub fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
                               path: &Path) -> Parser {
     match new_parser_from_file(sess, cfg, path) {
         Ok(move parser) => move parser,
@@ -223,7 +209,7 @@ fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
 
 /// Create a new parser based on a span from an existing parser. Handles
 /// error messages correctly when the file does not exist.
-fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
+pub fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
                             path: &Path, sp: span) -> Parser {
     match new_parser_from_file(sess, cfg, path) {
         Ok(move parser) => move parser,
@@ -233,7 +219,7 @@ fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg,
     }
 }
 
-fn new_parser_from_tts(sess: parse_sess, cfg: ast::crate_cfg,
+pub fn new_parser_from_tts(sess: parse_sess, cfg: ast::crate_cfg,
                        tts: ~[ast::token_tree]) -> Parser {
     let trdr = lexer::new_tt_reader(sess.span_diagnostic, sess.interner,
                                     None, tts);
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 6b73cf308a2..15905c090db 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -17,10 +17,13 @@ Obsolete syntax that becomes too hard to parse can be
 removed.
 */
 
+use core::prelude::*;
+
 use ast::{expr, expr_lit, lit_nil};
 use ast;
 use ast_util::{respan};
 use codemap::span;
+use parse::parser::Parser;
 use parse::token::Token;
 use parse::token;
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index f32a782622a..80fd04f0e10 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::{ProtoBox, ProtoUniq, provided, public, pure_fn, purity, re_static};
 use ast::{_mod, add, arg, arm, attribute, bind_by_ref, bind_infer};
 use ast::{bind_by_value, bind_by_move, bitand, bitor, bitxor, blk};
@@ -33,23 +35,24 @@ use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int};
 use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const};
 use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal};
 use ast::{match_seq, match_tok, method, mode, module_ns, mt, mul, mutability};
-use ast::{named_field, neg, noreturn, not, pat, pat_box, pat_enum, pat_ident};
-use ast::{pat_lit, pat_range, pat_rec, pat_region, pat_struct, pat_tup};
-use ast::{pat_uniq, pat_wild, path, private, Proto, ProtoBare, ProtoBorrowed};
-use ast::{re_self, re_anon, re_named, region, rem, required, ret_style};
-use ast::{return_val, self_ty, shl, shr, stmt, stmt_decl, stmt_expr};
-use ast::{stmt_semi, stmt_mac, struct_def, struct_field, struct_immutable};
-use ast::{struct_mutable, struct_variant_kind, subtract, sty_box, sty_by_ref};
-use ast::{sty_region, sty_static, sty_uniq, sty_value, token_tree};
-use ast::{trait_method, trait_ref, tt_delim, tt_seq, tt_tok, tt_nonterminal};
-use ast::{tuple_variant_kind, Ty, ty_, ty_bot, ty_box, ty_field, ty_fn};
-use ast::{ty_fixed_length_vec, type_value_ns, uniq, unnamed_field};
-use ast::{ty_infer, ty_mac, ty_method, ty_nil, ty_param, ty_param_bound};
-use ast::{ty_path, ty_ptr, ty_rec, ty_rptr, ty_tup, ty_u32, ty_uniq, ty_vec};
-use ast::{unsafe_blk, unsafe_fn, variant, view_item, view_item_};
-use ast::{view_item_export, view_item_import, view_item_use, view_path};
-use ast::{view_path_glob, view_path_list, view_path_simple, visibility};
-use ast::{vstore, vstore_box, vstore_fixed, vstore_slice, vstore_uniq};
+use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum};
+use ast::{pat_ident, pat_lit, pat_range, pat_rec, pat_region, pat_struct};
+use ast::{pat_tup, pat_uniq, pat_wild, path, private, Proto, ProtoBare};
+use ast::{ProtoBorrowed, re_self, re_anon, re_named, region, rem, required};
+use ast::{ret_style, return_val, self_ty, shl, shr, stmt, stmt_decl};
+use ast::{stmt_expr, stmt_semi, stmt_mac, struct_def, struct_field};
+use ast::{struct_immutable, struct_mutable, struct_variant_kind, subtract};
+use ast::{sty_box, sty_by_ref, sty_region, sty_static, sty_uniq, sty_value};
+use ast::{token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok};
+use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box};
+use ast::{ty_field, ty_fixed_length_vec, ty_fn, ty_infer, ty_mac, ty_method};
+use ast::{ty_nil, ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec, ty_rptr};
+use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, type_value_ns, uniq};
+use ast::{unnamed_field, unsafe_blk, unsafe_fn, variant, view_item};
+use ast::{view_item_, view_item_export, view_item_import, view_item_use};
+use ast::{view_path, view_path_glob, view_path_list, view_path_simple};
+use ast::{visibility, vstore, vstore_box, vstore_fixed, vstore_slice};
+use ast::{vstore_uniq};
 use ast;
 use ast_util::{spanned, respan, mk_sp, ident_to_path, operator_prec};
 use ast_util;
@@ -69,6 +72,7 @@ use parse::prec::{as_prec, token_to_binop};
 use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
 use parse::token;
+use parse::{new_sub_parser_from_file, next_node_id, parse_sess};
 use print::pprust::expr_to_str;
 use util::interner::Interner;
 
diff --git a/src/libsyntax/parse/prec.rs b/src/libsyntax/parse/prec.rs
index 4663b875bb5..10754777129 100644
--- a/src/libsyntax/parse/prec.rs
+++ b/src/libsyntax/parse/prec.rs
@@ -12,9 +12,11 @@ export as_prec;
 export unop_prec;
 export token_to_binop;
 
+use ast::*;
 use parse::token::*;
 use parse::token::Token;
-use ast::*;
+
+use core::prelude::*;
 
 /// Unary operators have higher precedence than binary
 const unop_prec: uint = 100u;
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index f286b15c752..606247b8cbe 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast_util;
 use parse::token;
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index c9d2abfe0cb..b3b267027ce 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use core::cmp;
 use core::dvec::DVec;
 use core::io::WriterUtil;
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 239cff22cc0..c121bc30b96 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::{required, provided};
 use ast;
 use ast_util;
@@ -16,9 +18,9 @@ use attr;
 use codemap::{CodeMap, BytePos};
 use codemap;
 use diagnostic;
-use parse::classify::*;
+use parse::classify::{expr_is_simple_block, expr_requires_semi_to_be_stmt};
+use parse::classify::{stmt_ends_with_semi};
 use parse::token::ident_interner;
-use parse::token;
 use parse::{comments, lexer, token};
 use parse;
 use print::pp::{break_offset, word, printer, space, zerobreak, hardbreak};
diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs
index cfa3a4224c5..fd759a32941 100644
--- a/src/libsyntax/util/interner.rs
+++ b/src/libsyntax/util/interner.rs
@@ -11,12 +11,12 @@
 // An "interner" is a data structure that associates values with uint tags and
 // allows bidirectional lookup; i.e. given a value, one can easily find the
 // type, and vice versa.
-use std::map;
+
+use core::prelude::*;
+
+use core::dvec::DVec;
 use std::map::HashMap;
-use dvec::DVec;
-use cmp::Eq;
-use hash::Hash;
-use to_bytes::IterBytes;
+use std::map;
 
 type hash_interner<T: Const> =
     {map: HashMap<T, uint>,
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index b7d894a7e9f..3f7ba2dc37b 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::*;
 use ast;
 use ast_util;