about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-02-25 14:11:21 -0500
committerAlex Crichton <alex@alexcrichton.com>2013-02-28 18:00:34 -0500
commit2df07ddc250b64151401e9b8569a6c7ad5c9b34f (patch)
treeb79fe795609676370a0c19ba809357e45efcc8cc /src/libsyntax
parentf2837fa3f53b304b5c9a79d733dfd56da5f32637 (diff)
downloadrust-2df07ddc250b64151401e9b8569a6c7ad5c9b34f.tar.gz
rust-2df07ddc250b64151401e9b8569a6c7ad5c9b34f.zip
Fix implicit leaks of imports throughout libraries
Also touch up use of 'pub' and move some tests around so the tested functions
don't have to be 'pub'
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_map.rs1
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/ext/auto_encode.rs1
-rw-r--r--src/libsyntax/ext/base.rs5
-rw-r--r--src/libsyntax/ext/concat_idents.rs3
-rw-r--r--src/libsyntax/ext/env.rs2
-rw-r--r--src/libsyntax/ext/expand.rs13
-rw-r--r--src/libsyntax/ext/fmt.rs1
-rw-r--r--src/libsyntax/ext/log_syntax.rs1
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs3
-rw-r--r--src/libsyntax/ext/quote.rs8
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs2
-rw-r--r--src/libsyntax/fold.rs3
-rw-r--r--src/libsyntax/parse/attr.rs1
-rw-r--r--src/libsyntax/parse/lexer.rs8
-rw-r--r--src/libsyntax/parse/mod.rs2
-rw-r--r--src/libsyntax/parse/prec.rs1
-rw-r--r--src/libsyntax/print/pprust.rs7
-rw-r--r--src/libsyntax/visit.rs1
22 files changed, 56 insertions, 15 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index abaf7025505..40315d175cc 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -16,6 +16,7 @@ use ast_util::{inlined_item_utils, path_to_ident, stmt_id};
 use ast_util;
 use attr;
 use codemap;
+use codemap::spanned;
 use diagnostic::span_handler;
 use parse::token::ident_interner;
 use print::pprust;
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 8a1408ad9c0..ab14f6cc086 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -13,7 +13,7 @@ use core::prelude::*;
 use ast::*;
 use ast;
 use ast_util;
-use codemap::{span, BytePos, dummy_sp};
+use codemap::{span, BytePos, dummy_sp, spanned};
 use parse::token;
 use visit;
 use opt_vec;
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index aea39502362..43eaef95ee2 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -93,6 +93,7 @@ use core::prelude::*;
 use ast;
 use ast_util;
 use attr;
+use codemap;
 use codemap::span;
 use ext::base::*;
 use parse;
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 0eaf6849b7e..9525369d334 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -82,7 +82,7 @@ pub enum SyntaxExtension {
     IdentTT(SyntaxExpanderTTItem),
 }
 
-type SyntaxEnv = @mut MapChain<Name, Transformer>;
+pub type SyntaxEnv = @mut MapChain<Name, Transformer>;
 
 // Name : the domain of SyntaxEnvs
 // want to change these to uints....
@@ -98,7 +98,7 @@ type Name = @~str;
 // toward a more uniform syntax syntax (sorry) where blocks are just
 // another kind of transformer.
 
-enum Transformer {
+pub enum Transformer {
     // this identifier maps to a syntax extension or macro
     SE(SyntaxExtension),
     // should blocks occurring here limit macro scopes?
@@ -495,6 +495,7 @@ mod test {
     use super::*;
     use super::MapChain;
     use util::testing::check_equal;
+    use core::hashmap::linear::LinearMap;
 
     #[test] fn testenv () {
         let mut a = LinearMap::new();
diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs
index d83a9f39c5b..1dc5350c452 100644
--- a/src/libsyntax/ext/concat_idents.rs
+++ b/src/libsyntax/ext/concat_idents.rs
@@ -10,8 +10,11 @@
 
 use core::prelude::*;
 
+use ast;
+use codemap::span;
 use ext::base::*;
 use ext::base;
+use parse::token;
 
 pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
     -> base::MacResult {
diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs
index 4420c020a0b..ce87c2f1363 100644
--- a/src/libsyntax/ext/env.rs
+++ b/src/libsyntax/ext/env.rs
@@ -15,6 +15,8 @@
  * interface.
  */
 
+use ast;
+use codemap::span;
 use ext::base::*;
 use ext::base;
 use ext::build::mk_uniq_str;
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 9a3e8da2b81..1a67a569845 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -10,13 +10,16 @@
 
 use core::prelude::*;
 
+use ast::{blk_, attribute_, attr_outer, meta_word};
 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;
 use attr;
-use codemap::{span, CallInfo, ExpandedFrom, NameAndSpan};
+use codemap;
+use codemap::{span, CallInfo, ExpandedFrom, NameAndSpan, spanned};
 use ext::base::*;
 use fold::*;
+use parse;
 use parse::{parser, parse_item_from_source_str, new_parser_from_tts};
 
 use core::option;
@@ -175,7 +178,7 @@ pub fn expand_item(extsbox: @mut SyntaxEnv,
 }
 
 // does this attribute list contain "macro_escape" ?
-fn contains_macro_escape (attrs: &[ast::attribute]) -> bool{
+pub fn contains_macro_escape (attrs: &[ast::attribute]) -> bool{
     let mut accum = false;
     do attrs.each |attr| {
         let mname = attr::get_attr_name(attr);
@@ -473,7 +476,13 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess,
 #[cfg(test)]
 mod test {
     use super::*;
+    use ast;
+    use ast::{attribute_, attr_outer, meta_word};
+    use codemap;
+    use codemap::spanned;
+    use parse;
     use util::testing::check_equal;
+    use core::option::{None, Some};
 
     // make sure that fail! is present
     #[test] fn fail_exists_test () {
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 937bcef5c25..b8781130562 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -22,6 +22,7 @@ use ast;
 use codemap::span;
 use ext::base::*;
 use ext::base;
+use ext::build;
 use ext::build::*;
 use private::extfmt::ct::*;
 
diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs
index f713e5ce7d8..15ddc44e85d 100644
--- a/src/libsyntax/ext/log_syntax.rs
+++ b/src/libsyntax/ext/log_syntax.rs
@@ -14,6 +14,7 @@ use ext::base::*;
 use ext::base;
 use print;
 
+use core::io;
 use core::io::WriterUtil;
 use core::option;
 
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index a49d3dead0c..3e6dedb3b31 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -20,7 +20,7 @@ use ast;
 use ast_util::{ident_to_path};
 use ast_util;
 use attr;
-use codemap::{span, respan, dummy_sp};
+use codemap::{span, respan, dummy_sp, spanned};
 use codemap;
 use ext::base::{ext_ctxt, mk_ctxt};
 use ext::quote::rt::*;
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index 8caa2c4bba8..a6b820cf3f9 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -10,7 +10,9 @@
 
 // Parsing pipes protocols from token trees.
 
+use ast_util;
 use ext::pipes::pipec::*;
+use ext::pipes::proto::*;
 use parse::common::SeqSep;
 use parse::parser;
 use parse::token;
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 6c124ce16df..46f10cd52bb 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -10,8 +10,9 @@
 
 // A protocol compiler for Rust.
 
+use ast;
 use ast::ident;
-use codemap::dummy_sp;
+use codemap::{dummy_sp, spanned};
 use ext::base::ext_ctxt;
 use ext::pipes::ast_builder::{append_types, ext_ctxt_ast_builder, path};
 use ext::pipes::ast_builder::{path_global};
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index b313d42e812..757302c78fc 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -34,10 +34,12 @@ use core::str;
 
 pub mod rt {
     use ast;
+    use codemap;
     use ext::base::ext_ctxt;
     use parse;
     use print::pprust;
 
+    use core::prelude::*;
     use core::str;
 
     pub use ast::*;
@@ -49,7 +51,7 @@ pub mod rt {
     use print::pprust;
     use print::pprust::{item_to_str, ty_to_str};
 
-    trait ToTokens {
+    pub trait ToTokens {
         pub fn to_tokens(&self, _cx: ext_ctxt) -> ~[token_tree];
     }
 
@@ -73,7 +75,7 @@ pub mod rt {
 
     */
 
-    trait ToSource {
+    pub trait ToSource {
         // Takes a thing and generates a string containing rust code for it.
         pub fn to_source(&self, cx: ext_ctxt) -> ~str;
     }
@@ -164,7 +166,7 @@ pub mod rt {
         }
     }
 
-    trait ExtParseUtils {
+    pub trait ExtParseUtils {
         fn parse_item(s: ~str) -> @ast::item;
         fn parse_expr(s: ~str) -> @ast::expr;
         fn parse_stmt(s: ~str) -> @ast::stmt;
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 808a80e6ad0..5b870f07b60 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -8,12 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use ast;
 use codemap;
 use codemap::{FileMap, Loc, Pos, ExpandedFrom, span};
 use codemap::{CallInfo, NameAndSpan};
 use ext::base::*;
 use ext::base;
 use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_base_str};
+use parse;
 use print::pprust;
 
 use core::io;
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 890420edf6d..3fc580827e9 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // Earley-like parser for macros.
+use ast;
 use ast::{matcher, match_tok, match_seq, match_nonterminal, ident};
 use codemap::{BytePos, mk_sp};
 use codemap;
@@ -23,6 +24,7 @@ use core::dvec::DVec;
 use core::dvec;
 use core::io;
 use core::option;
+use core::option::{Option, Some, None};
 use core::str;
 use core::uint;
 use core::vec;
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 8da494b95fd..f55ba3adfae 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -12,7 +12,8 @@ use core::prelude::*;
 
 use ast::*;
 use ast;
-use codemap::span;
+use codemap::{span, spanned};
+use opt_vec::OptVec;
 
 use core::option;
 use core::vec;
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index c0c97a0b9eb..b5c4ff3ddd7 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -15,6 +15,7 @@ use codemap::spanned;
 use codemap::BytePos;
 use parse::common::*; //resolve bug?
 use parse::token;
+use parse::parser::Parser;
 
 use core::either::{Either, Left, Right};
 
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index dc5bdeba92a..c928719c208 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -764,10 +764,14 @@ fn consume_whitespace(rdr: @mut StringReader) {
 
 #[cfg(test)]
 pub mod test {
-
     use super::*;
-    use util::interner;
+
+    use ast;
+    use codemap::{BytePos, CodeMap, span};
+    use core::option::None;
     use diagnostic;
+    use parse::token;
+    use util::interner;
     use util::testing::{check_equal, check_equal_ptr};
 
     // represents a testing reader (incl. both reader and interner)
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index a31a73f594a..057412fcd7e 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -234,6 +234,8 @@ mod test {
     use super::*;
     use std::serialize::Encodable;
     use std;
+    use core::io;
+    use core::option::None;
     use core::str;
     use util::testing::*;
 
diff --git a/src/libsyntax/parse/prec.rs b/src/libsyntax/parse/prec.rs
index fff222876aa..e2a89d2a28c 100644
--- a/src/libsyntax/parse/prec.rs
+++ b/src/libsyntax/parse/prec.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use ast;
 use ast::*;
 use parse::token::*;
 use parse::token::Token;
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 5eb40626437..0f161a444bd 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2299,11 +2299,14 @@ pub fn print_onceness(s: @ps, o: ast::Onceness) {
 
 #[cfg(test)]
 pub mod test {
+    use super::*;
+
     use ast;
     use ast_util;
+    use codemap;
+    use core::cmp::Eq;
+    use core::option::None;
     use parse;
-    use super::*;
-    //use util;
     use util::testing::check_equal;
 
     fn string_check<T:Eq> (given : &T, expected: &T) {
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 95a6500955d..70dec6f3343 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -16,6 +16,7 @@ use ast_util;
 use codemap::span;
 use parse;
 use opt_vec;
+use opt_vec::OptVec;
 
 use core::option;
 use core::vec;