about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-02-28 11:57:33 -0500
committerAlex Crichton <alex@alexcrichton.com>2013-03-04 12:27:01 -0500
commitcb4ab76e4a17e0efc6b506af15fd1df654c043ff (patch)
treef12c8ae2ad1979e973ccf4ef95b1a396a2daa246
parentbc3bee410a6967942d18cef59a781603a7db86e4 (diff)
downloadrust-cb4ab76e4a17e0efc6b506af15fd1df654c043ff.tar.gz
rust-cb4ab76e4a17e0efc6b506af15fd1df654c043ff.zip
Adding missing imports for tests, and gate off others
-rw-r--r--src/libcore/bool.rs4
-rw-r--r--src/libcore/char.rs7
-rw-r--r--src/libcore/flate.rs2
-rw-r--r--src/libcore/logging.rs9
-rw-r--r--src/libcore/nil.rs1
-rw-r--r--src/libcore/num/f32.rs5
-rw-r--r--src/libcore/num/f64.rs5
-rw-r--r--src/libcore/num/float.rs5
-rw-r--r--src/libcore/num/int-template.rs1
-rw-r--r--src/libcore/num/uint-template.rs3
-rw-r--r--src/libcore/num/uint-template/uint.rs87
-rw-r--r--src/libcore/option.rs3
-rw-r--r--src/libcore/owned.rs2
-rw-r--r--src/libcore/ptr.rs21
-rw-r--r--src/libcore/repr.rs4
-rw-r--r--src/libcore/run.rs1
-rw-r--r--src/libcore/str.rs4
-rw-r--r--src/libcore/tuple.rs3
-rw-r--r--src/libcore/unstable.rs5
-rw-r--r--src/libcore/unstable/at_exit.rs2
-rw-r--r--src/libcore/unstable/finally.rs2
-rw-r--r--src/libcore/unstable/global.rs6
-rw-r--r--src/libcore/util.rs1
-rw-r--r--src/librustc/back/rpath.rs2
-rw-r--r--src/librustc/driver/session.rs3
-rw-r--r--src/librustc/middle/astencode.rs5
-rw-r--r--src/librustdoc/attr_parser.rs2
-rw-r--r--src/librustdoc/fold.rs2
-rw-r--r--src/librustdoc/markdown_pass.rs4
-rw-r--r--src/librustdoc/markdown_writer.rs6
-rw-r--r--src/librustdoc/pass.rs2
-rw-r--r--src/librustdoc/path_pass.rs2
-rw-r--r--src/librustdoc/prune_hidden_pass.rs2
-rw-r--r--src/librustdoc/sort_item_name_pass.rs3
-rw-r--r--src/librustdoc/sort_item_type_pass.rs3
-rw-r--r--src/librustdoc/sort_pass.rs2
-rw-r--r--src/librustdoc/trim_pass.rs2
-rw-r--r--src/libstd/arena.rs4
-rw-r--r--src/libstd/flatpipes.rs3
-rw-r--r--src/libstd/getopts.rs1
-rw-r--r--src/libstd/net_url.rs1
-rw-r--r--src/libsyntax/ast.rs8
-rw-r--r--src/libsyntax/ext/auto_encode.rs7
-rw-r--r--src/libsyntax/ext/base.rs1
-rw-r--r--src/libsyntax/ext/trace_macros.rs1
-rw-r--r--src/libsyntax/parse/lexer.rs1
46 files changed, 141 insertions, 109 deletions
diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs
index 33953e952e8..26a68e3a199 100644
--- a/src/libcore/bool.rs
+++ b/src/libcore/bool.rs
@@ -11,8 +11,8 @@
 
 //! Boolean logic
 
-use cmp;
 use option::{None, Option, Some};
+#[cfg(notest)] use cmp;
 
 /// Negation / inverse
 pub pure fn not(v: bool) -> bool { !v }
@@ -80,7 +80,7 @@ impl cmp::Eq for bool {
 #[test]
 pub fn test_bool_from_str() {
     do all_values |v| {
-        assert Some(v) == from_str(bool::to_str(v))
+        assert Some(v) == from_str(to_str(v))
     }
 }
 
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index ea12d5fd7ec..36b03af2d38 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -10,13 +10,14 @@
 
 //! Utilities for manipulating the char type
 
-use cmp::Eq;
 use option::{None, Option, Some};
 use str;
 use u32;
 use uint;
 use unicode;
 
+#[cfg(notest)] use cmp::Eq;
+
 /*
     Lu  Uppercase_Letter    an uppercase letter
     Ll  Lowercase_Letter    a lowercase letter
@@ -304,8 +305,8 @@ fn test_to_digit() {
 
 #[test]
 fn test_is_ascii() {
-   assert str::all(~"banana", char::is_ascii);
-   assert ! str::all(~"ประเทศไทย中华Việt Nam", char::is_ascii);
+   assert str::all(~"banana", is_ascii);
+   assert ! str::all(~"ประเทศไทย中华Việt Nam", is_ascii);
 }
 
 #[test]
diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs
index f89aa3411f1..4d01c102707 100644
--- a/src/libcore/flate.rs
+++ b/src/libcore/flate.rs
@@ -19,6 +19,8 @@ use libc::{c_void, size_t, c_int};
 use ptr;
 use vec;
 
+#[cfg(test)] use rand;
+
 extern mod rustrt {
     unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
                                          src_buf_len: size_t,
diff --git a/src/libcore/logging.rs b/src/libcore/logging.rs
index 357a3415ac2..73af0ad3714 100644
--- a/src/libcore/logging.rs
+++ b/src/libcore/logging.rs
@@ -10,11 +10,7 @@
 
 //! Logging
 
-use cast::transmute;
-use io;
 use libc;
-use repr;
-use vec;
 
 #[nolink]
 extern mod rustrt {
@@ -48,6 +44,11 @@ pub fn console_off() {
 #[cfg(notest)]
 #[lang="log_type"]
 pub fn log_type<T>(level: u32, object: &T) {
+    use cast::transmute;
+    use io;
+    use repr;
+    use vec;
+
     let bytes = do io::with_bytes_writer |writer| {
         repr::write_repr(writer, object);
     };
diff --git a/src/libcore/nil.rs b/src/libcore/nil.rs
index 62ed1d24d79..cf2af7e38cc 100644
--- a/src/libcore/nil.rs
+++ b/src/libcore/nil.rs
@@ -14,6 +14,7 @@ Functions for the unit type.
 
 */
 
+#[cfg(notest)]
 use cmp::{Eq, Ord};
 
 #[cfg(notest)]
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index d4808bd111f..5100021b954 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -11,17 +11,18 @@
 //! Operations and constants for `f32`
 
 use cmath;
-use cmp;
 use libc::{c_float, c_int};
 use num::NumCast;
 use num::strconv;
 use num;
-use ops;
 use option::Option;
 use unstable::intrinsics::floorf32;
 use from_str;
 use to_str;
 
+#[cfg(notest)] use cmp;
+#[cfg(notest)] use ops;
+
 pub use cmath::c_float_targ_consts::*;
 
 macro_rules! delegate(
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index 1c9f8286bcb..9470922b881 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -11,17 +11,18 @@
 //! Operations and constants for `f64`
 
 use cmath;
-use cmp;
 use libc::{c_double, c_int};
 use num::NumCast;
 use num::strconv;
 use num;
-use ops;
 use option::Option;
 use unstable::intrinsics::floorf64;
 use to_str;
 use from_str;
 
+#[cfg(notest)] use cmp;
+#[cfg(notest)] use ops;
+
 pub use cmath::c_double_targ_consts::*;
 pub use cmp::{min, max};
 
diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs
index 366f9e5f7b7..5d912472d7d 100644
--- a/src/libcore/num/float.rs
+++ b/src/libcore/num/float.rs
@@ -20,16 +20,17 @@
 
 // PORT this must match in width according to architecture
 
-use cmp::{Eq, Ord};
 use f64;
 use num::NumCast;
 use num::strconv;
 use num;
-use ops;
 use option::{None, Option, Some};
 use to_str;
 use from_str;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
+#[cfg(notest)] use ops;
+
 pub use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt};
 pub use f64::logarithm;
 pub use f64::{acos, asin, atan2, cbrt, ceil, copysign, cosh, floor};
diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs
index 98e3bebd466..c0351e2c619 100644
--- a/src/libcore/num/int-template.rs
+++ b/src/libcore/num/int-template.rs
@@ -10,7 +10,6 @@
 
 use T = self::inst::T;
 
-use cmp::{Eq, Ord};
 use to_str::ToStr;
 use from_str::FromStr;
 use num::{ToStrRadix, FromStrRadix};
diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs
index 0811c955078..0dbf7403e27 100644
--- a/src/libcore/num/uint-template.rs
+++ b/src/libcore/num/uint-template.rs
@@ -11,7 +11,6 @@
 use T = self::inst::T;
 use T_SIGNED = self::inst::T_SIGNED;
 
-use cmp::{Eq, Ord};
 use to_str::ToStr;
 use from_str::FromStr;
 use num::{ToStrRadix, FromStrRadix};
@@ -20,6 +19,8 @@ use num;
 use option::{None, Option, Some};
 use prelude::*;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
+
 pub use cmp::{min, max};
 
 pub const bits : uint = inst::bits;
diff --git a/src/libcore/num/uint-template/uint.rs b/src/libcore/num/uint-template/uint.rs
index 0131bff685d..206f8c0f6ca 100644
--- a/src/libcore/num/uint-template/uint.rs
+++ b/src/libcore/num/uint-template/uint.rs
@@ -143,50 +143,51 @@ pub mod inst {
 
     #[test]
     fn test_next_power_of_two() {
-        assert (uint::next_power_of_two(0u) == 0u);
-        assert (uint::next_power_of_two(1u) == 1u);
-        assert (uint::next_power_of_two(2u) == 2u);
-        assert (uint::next_power_of_two(3u) == 4u);
-        assert (uint::next_power_of_two(4u) == 4u);
-        assert (uint::next_power_of_two(5u) == 8u);
-        assert (uint::next_power_of_two(6u) == 8u);
-        assert (uint::next_power_of_two(7u) == 8u);
-        assert (uint::next_power_of_two(8u) == 8u);
-        assert (uint::next_power_of_two(9u) == 16u);
-        assert (uint::next_power_of_two(10u) == 16u);
-        assert (uint::next_power_of_two(11u) == 16u);
-        assert (uint::next_power_of_two(12u) == 16u);
-        assert (uint::next_power_of_two(13u) == 16u);
-        assert (uint::next_power_of_two(14u) == 16u);
-        assert (uint::next_power_of_two(15u) == 16u);
-        assert (uint::next_power_of_two(16u) == 16u);
-        assert (uint::next_power_of_two(17u) == 32u);
-        assert (uint::next_power_of_two(18u) == 32u);
-        assert (uint::next_power_of_two(19u) == 32u);
-        assert (uint::next_power_of_two(20u) == 32u);
-        assert (uint::next_power_of_two(21u) == 32u);
-        assert (uint::next_power_of_two(22u) == 32u);
-        assert (uint::next_power_of_two(23u) == 32u);
-        assert (uint::next_power_of_two(24u) == 32u);
-        assert (uint::next_power_of_two(25u) == 32u);
-        assert (uint::next_power_of_two(26u) == 32u);
-        assert (uint::next_power_of_two(27u) == 32u);
-        assert (uint::next_power_of_two(28u) == 32u);
-        assert (uint::next_power_of_two(29u) == 32u);
-        assert (uint::next_power_of_two(30u) == 32u);
-        assert (uint::next_power_of_two(31u) == 32u);
-        assert (uint::next_power_of_two(32u) == 32u);
-        assert (uint::next_power_of_two(33u) == 64u);
-        assert (uint::next_power_of_two(34u) == 64u);
-        assert (uint::next_power_of_two(35u) == 64u);
-        assert (uint::next_power_of_two(36u) == 64u);
-        assert (uint::next_power_of_two(37u) == 64u);
-        assert (uint::next_power_of_two(38u) == 64u);
-        assert (uint::next_power_of_two(39u) == 64u);
+        assert (next_power_of_two(0u) == 0u);
+        assert (next_power_of_two(1u) == 1u);
+        assert (next_power_of_two(2u) == 2u);
+        assert (next_power_of_two(3u) == 4u);
+        assert (next_power_of_two(4u) == 4u);
+        assert (next_power_of_two(5u) == 8u);
+        assert (next_power_of_two(6u) == 8u);
+        assert (next_power_of_two(7u) == 8u);
+        assert (next_power_of_two(8u) == 8u);
+        assert (next_power_of_two(9u) == 16u);
+        assert (next_power_of_two(10u) == 16u);
+        assert (next_power_of_two(11u) == 16u);
+        assert (next_power_of_two(12u) == 16u);
+        assert (next_power_of_two(13u) == 16u);
+        assert (next_power_of_two(14u) == 16u);
+        assert (next_power_of_two(15u) == 16u);
+        assert (next_power_of_two(16u) == 16u);
+        assert (next_power_of_two(17u) == 32u);
+        assert (next_power_of_two(18u) == 32u);
+        assert (next_power_of_two(19u) == 32u);
+        assert (next_power_of_two(20u) == 32u);
+        assert (next_power_of_two(21u) == 32u);
+        assert (next_power_of_two(22u) == 32u);
+        assert (next_power_of_two(23u) == 32u);
+        assert (next_power_of_two(24u) == 32u);
+        assert (next_power_of_two(25u) == 32u);
+        assert (next_power_of_two(26u) == 32u);
+        assert (next_power_of_two(27u) == 32u);
+        assert (next_power_of_two(28u) == 32u);
+        assert (next_power_of_two(29u) == 32u);
+        assert (next_power_of_two(30u) == 32u);
+        assert (next_power_of_two(31u) == 32u);
+        assert (next_power_of_two(32u) == 32u);
+        assert (next_power_of_two(33u) == 64u);
+        assert (next_power_of_two(34u) == 64u);
+        assert (next_power_of_two(35u) == 64u);
+        assert (next_power_of_two(36u) == 64u);
+        assert (next_power_of_two(37u) == 64u);
+        assert (next_power_of_two(38u) == 64u);
+        assert (next_power_of_two(39u) == 64u);
     }
 
     #[test]
     fn test_overflows() {
+        use uint;
         assert (uint::max_value > 0u);
         assert (uint::min_value <= 0u);
         assert (uint::min_value + uint::max_value + 1u == 0u);
@@ -194,9 +195,9 @@ pub mod inst {
 
     #[test]
     fn test_div() {
-        assert(uint::div_floor(3u, 4u) == 0u);
-        assert(uint::div_ceil(3u, 4u)  == 1u);
-        assert(uint::div_round(3u, 4u) == 1u);
+        assert(div_floor(3u, 4u) == 0u);
+        assert(div_ceil(3u, 4u)  == 1u);
+        assert(div_round(3u, 4u) == 1u);
     }
 
     #[test]
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 55244b81b93..e5719b599bd 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -46,6 +46,9 @@ use kinds::Copy;
 use util;
 use num::Zero;
 
+#[cfg(test)] use ptr;
+#[cfg(test)] use str;
+
 /// The option type
 #[deriving_eq]
 pub enum Option<T> {
diff --git a/src/libcore/owned.rs b/src/libcore/owned.rs
index 3b839e5a9e0..486ce44147a 100644
--- a/src/libcore/owned.rs
+++ b/src/libcore/owned.rs
@@ -10,7 +10,7 @@
 
 //! Operations on unique pointer types
 
-use cmp::{Eq, Ord};
+#[cfg(notest)] use cmp::{Eq, Ord};
 
 #[cfg(notest)]
 impl<T:Eq> Eq for ~T {
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 8996d404dbc..bc2d285ad14 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -11,12 +11,15 @@
 //! Unsafe pointer utility functions
 
 use cast;
-use cmp::{Eq, Ord};
 use libc;
 use libc::{c_void, size_t};
 use unstable::intrinsics::{memmove32,memmove64};
 use sys;
 
+#[cfg(test)] use vec;
+#[cfg(test)] use str;
+#[cfg(notest)] use cmp::{Eq, Ord};
+
 #[nolink]
 #[abi = "cdecl"]
 extern mod libc_ {
@@ -313,13 +316,13 @@ pub fn test() {
         let mut v0 = ~[32000u16, 32001u16, 32002u16];
         let mut v1 = ~[0u16, 0u16, 0u16];
 
-        ptr::copy_memory(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 1u),
-                    ptr::offset(vec::raw::to_ptr(v0), 1u), 1u);
+        copy_memory(mut_offset(vec::raw::to_mut_ptr(v1), 1u),
+                    offset(vec::raw::to_ptr(v0), 1u), 1u);
         assert (v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16);
-        ptr::copy_memory(vec::raw::to_mut_ptr(v1),
-                    ptr::offset(vec::raw::to_ptr(v0), 2u), 1u);
+        copy_memory(vec::raw::to_mut_ptr(v1),
+                    offset(vec::raw::to_ptr(v0), 2u), 1u);
         assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 0u16);
-        ptr::copy_memory(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 2u),
+        copy_memory(mut_offset(vec::raw::to_mut_ptr(v1), 2u),
                     vec::raw::to_ptr(v0), 1u);
         assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 32000u16);
     }
@@ -358,15 +361,15 @@ pub fn test_buf_len() {
 
 #[test]
 pub fn test_is_null() {
-   let p: *int = ptr::null();
+   let p: *int = null();
    assert p.is_null();
    assert !p.is_not_null();
 
-   let q = ptr::offset(p, 1u);
+   let q = offset(p, 1u);
    assert !q.is_null();
    assert q.is_not_null();
 
-   let mp: *mut int = ptr::mut_null();
+   let mp: *mut int = mut_null();
    assert mp.is_null();
    assert !mp.is_not_null();
 
diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs
index dd5a427c4ce..d0910e7cefb 100644
--- a/src/libcore/repr.rs
+++ b/src/libcore/repr.rs
@@ -32,6 +32,8 @@ use vec::UnboxedVecRepr;
 use vec::raw::{VecRepr, SliceRepr};
 use vec;
 
+#[cfg(test)] use io;
+
 pub use managed::raw::BoxRepr;
 
 /// Helpers
@@ -575,7 +577,7 @@ struct P {a: int, b: float}
 fn test_repr() {
 
     fn exact_test<T>(t: &T, e:&str) {
-        let s : &str = io::with_str_writer(|w| repr::write_repr(w, t));
+        let s : &str = io::with_str_writer(|w| write_repr(w, t));
         if s != e {
             error!("expected '%s', got '%s'",
                    e, s);
diff --git a/src/libcore/run.rs b/src/libcore/run.rs
index 99a0405cbf8..80d7b4fffdb 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -451,7 +451,6 @@ pub fn waitpid(pid: pid_t) -> int {
 #[cfg(test)]
 mod tests {
     use debug;
-    use io::WriterUtil;
     use option::{None, Some};
     use os;
     use run::{readclose, writeclose};
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index dfe58365850..471e1ae5396 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -20,7 +20,7 @@
 use at_vec;
 use cast;
 use char;
-use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
+use cmp::{TotalOrd, Ordering, Less, Equal, Greater};
 use libc;
 use option::{None, Option, Some};
 use ptr;
@@ -29,6 +29,8 @@ use u8;
 use uint;
 use vec;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
+
 /*
 Section: Creating a string
 */
diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs
index dde7d718c13..ae53081c2db 100644
--- a/src/libcore/tuple.rs
+++ b/src/libcore/tuple.rs
@@ -10,10 +10,11 @@
 
 //! Operations on tuples
 
-use cmp::{Eq, Ord};
 use kinds::Copy;
 use vec;
 
+#[cfg(notest)] use cmp::{Eq, Ord};
+
 pub trait CopyableTuple<T, U> {
     pure fn first() -> T;
     pure fn second() -> U;
diff --git a/src/libcore/unstable.rs b/src/libcore/unstable.rs
index a70a2144c73..dcec424f290 100644
--- a/src/libcore/unstable.rs
+++ b/src/libcore/unstable.rs
@@ -306,13 +306,8 @@ pub impl<T:Owned> Exclusive<T> {
 
 #[cfg(test)]
 pub mod tests {
-    use core::option::{None, Some};
-
-    use cell::Cell;
     use comm;
-    use option;
     use super::exclusive;
-    use result;
     use task;
     use uint;
 
diff --git a/src/libcore/unstable/at_exit.rs b/src/libcore/unstable/at_exit.rs
index cb3d6fddc22..63e7613714d 100644
--- a/src/libcore/unstable/at_exit.rs
+++ b/src/libcore/unstable/at_exit.rs
@@ -15,6 +15,8 @@ use vec;
 use rand;
 use libc::{c_void, size_t};
 
+#[cfg(test)] use uint;
+
 /**
 Register a function to be run during runtime shutdown.
 
diff --git a/src/libcore/unstable/finally.rs b/src/libcore/unstable/finally.rs
index dc6aae6c5cc..9a8b9bdde02 100644
--- a/src/libcore/unstable/finally.rs
+++ b/src/libcore/unstable/finally.rs
@@ -25,6 +25,8 @@ do || {
 
 use ops::Drop;
 
+#[cfg(test)] use task::failing;
+
 pub trait Finally<T> {
     fn finally(&self, dtor: &fn()) -> T;
 }
diff --git a/src/libcore/unstable/global.rs b/src/libcore/unstable/global.rs
index 1187dafdabb..a0c2955673d 100644
--- a/src/libcore/unstable/global.rs
+++ b/src/libcore/unstable/global.rs
@@ -37,8 +37,10 @@ use unstable::intrinsics::atomic_cxchg;
 use hashmap::linear::LinearMap;
 use sys::Closure;
 
-#[cfg(test)]
-use private::{SharedMutableState, shared_mutable_state};
+#[cfg(test)] use unstable::{SharedMutableState, shared_mutable_state};
+#[cfg(test)] use unstable::get_shared_immutable_state;
+#[cfg(test)] use task::spawn;
+#[cfg(test)] use uint;
 
 pub type GlobalDataKey<T> = &fn(v: T);
 
diff --git a/src/libcore/util.rs b/src/libcore/util.rs
index 48be6178ed2..742eee7dc27 100644
--- a/src/libcore/util.rs
+++ b/src/libcore/util.rs
@@ -103,6 +103,7 @@ pub fn unreachable() -> ! {
 
 #[cfg(test)]
 mod tests {
+    use option::{None, Some};
     use util::{NonCopyable, id, replace, swap};
 
     #[test]
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index 669cb669fe1..ce51bb9229e 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -208,6 +208,8 @@ mod test {
     use back::rpath::{get_relative_to, get_rpath_relative_to_output};
     #[cfg(test)]
     use back::rpath::{minimize_rpaths, rpaths_to_flags};
+    #[cfg(test)]
+    use driver::session;
 
     #[test]
     pub fn test_rpaths_to_flags() {
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs
index 14ed35d4485..e03e6bc19b3 100644
--- a/src/librustc/driver/session.rs
+++ b/src/librustc/driver/session.rs
@@ -344,13 +344,10 @@ pub fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
 
 #[cfg(test)]
 pub mod test {
-    use core::prelude::*;
-
     use driver::session::{bin_crate, building_library, lib_crate};
     use driver::session::{unknown_crate};
 
     use syntax::ast;
-    use syntax::ast_util;
     use syntax::codemap;
 
     pub fn make_crate_type_attr(+t: ~str) -> ast::attribute {
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 9cc057f862d..ccdd73053e0 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -41,6 +41,9 @@ use syntax::fold;
 use syntax;
 use writer = std::ebml::writer;
 
+#[cfg(test)] use syntax::parse;
+#[cfg(test)] use syntax::print::pprust;
+
 // Auxiliary maps of things to be encoded
 pub struct Maps {
     mutbl_map: middle::borrowck::mutbl_map,
@@ -1226,6 +1229,8 @@ fn mk_ctxt() -> fake_ext_ctxt {
 
 #[cfg(test)]
 fn roundtrip(in_item: Option<@ast::item>) {
+    use std::prettyprint;
+
     let in_item = in_item.get();
     let bytes = do io::with_bytes_writer |wr| {
         let ebml_w = writer::Encoder(wr);
diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs
index bf55d6f2edf..1d1a5209cae 100644
--- a/src/librustdoc/attr_parser.rs
+++ b/src/librustdoc/attr_parser.rs
@@ -34,10 +34,8 @@ mod test {
 
     pub fn parse_attributes(source: ~str) -> ~[ast::attribute] {
         use syntax::parse;
-        use syntax::parse::parser;
         use syntax::parse::attr::parser_attr;
         use syntax::codemap;
-        use syntax::diagnostic;
 
         let parse_sess = syntax::parse::new_parse_sess(None);
         let parser = parse::new_parser_from_source_str(
diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs
index 65d465ad235..4ea67c1bff6 100644
--- a/src/librustdoc/fold.rs
+++ b/src/librustdoc/fold.rs
@@ -11,6 +11,8 @@
 use core::prelude::*;
 
 use doc;
+#[cfg(test)] use extract;
+#[cfg(test)] use parse;
 
 use core::vec;
 
diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs
index 99fa7df96ab..cb92e078fdd 100644
--- a/src/librustdoc/markdown_pass.rs
+++ b/src/librustdoc/markdown_pass.rs
@@ -22,6 +22,10 @@ use markdown_writer::WriterFactory;
 use pass::Pass;
 use sort_pass;
 
+#[cfg(test)] use config;
+#[cfg(test)] use markdown_writer;
+#[cfg(test)] use page_pass;
+
 use core::cell::Cell;
 use core::str;
 use core::vec;
diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs
index 3d2965c6e35..acd456e77be 100644
--- a/src/librustdoc/markdown_writer.rs
+++ b/src/librustdoc/markdown_writer.rs
@@ -220,7 +220,7 @@ pub fn make_filename(
 
 #[test]
 fn should_use_markdown_file_name_based_off_crate() {
-    let config = Config {
+    let config = config::Config {
         output_dir: Path("output/dir"),
         output_format: config::Markdown,
         output_style: config::DocPerCrate,
@@ -234,7 +234,7 @@ fn should_use_markdown_file_name_based_off_crate() {
 
 #[test]
 fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
-    let config = Config {
+    let config = config::Config {
         output_dir: Path("output/dir"),
         output_format: config::PandocHtml,
         output_style: config::DocPerMod,
@@ -248,7 +248,7 @@ fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
 
 #[test]
 fn should_name_mod_file_names_by_path() {
-    let config = Config {
+    let config = config::Config {
         output_dir: Path("output/dir"),
         output_format: config::PandocHtml,
         output_style: config::DocPerMod,
diff --git a/src/librustdoc/pass.rs b/src/librustdoc/pass.rs
index 44c9cd033cf..b4d0cfe7c93 100644
--- a/src/librustdoc/pass.rs
+++ b/src/librustdoc/pass.rs
@@ -14,6 +14,8 @@ use astsrv;
 use doc;
 use time;
 
+#[cfg(test)] use extract;
+
 use core::vec;
 
 /// A single operation on the document model
diff --git a/src/librustdoc/path_pass.rs b/src/librustdoc/path_pass.rs
index 201c91ce864..2663ca8c876 100644
--- a/src/librustdoc/path_pass.rs
+++ b/src/librustdoc/path_pass.rs
@@ -19,6 +19,8 @@ use fold::Fold;
 use fold;
 use pass::Pass;
 
+#[cfg(test)] use extract;
+
 use syntax::ast;
 
 pub fn mk_pass() -> Pass {
diff --git a/src/librustdoc/prune_hidden_pass.rs b/src/librustdoc/prune_hidden_pass.rs
index f3870db26e2..3755fd706c0 100644
--- a/src/librustdoc/prune_hidden_pass.rs
+++ b/src/librustdoc/prune_hidden_pass.rs
@@ -63,6 +63,8 @@ fn is_hidden(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
 
 #[test]
 fn should_prune_hidden_items() {
+    use core::vec;
+
     let doc = test::mk_doc(~"#[doc(hidden)] mod a { }");
     assert vec::is_empty(doc.cratemod().mods())
 }
diff --git a/src/librustdoc/sort_item_name_pass.rs b/src/librustdoc/sort_item_name_pass.rs
index bc4154c1ace..b20faf44fa4 100644
--- a/src/librustdoc/sort_item_name_pass.rs
+++ b/src/librustdoc/sort_item_name_pass.rs
@@ -24,6 +24,9 @@ pub fn mk_pass() -> Pass {
 
 #[test]
 fn test() {
+    use astsrv;
+    use extract;
+
     let source = ~"mod z { } fn y() { }";
     do astsrv::from_str(source) |srv| {
         let doc = extract::from_srv(srv.clone(), ~"");
diff --git a/src/librustdoc/sort_item_type_pass.rs b/src/librustdoc/sort_item_type_pass.rs
index bf5c5c30a6b..8b39dcb1f8f 100644
--- a/src/librustdoc/sort_item_type_pass.rs
+++ b/src/librustdoc/sort_item_type_pass.rs
@@ -38,6 +38,9 @@ pub fn mk_pass() -> Pass {
 
 #[test]
 fn test() {
+    use astsrv;
+    use extract;
+
     let source =
         ~"mod imod { } \
          extern mod inmod {
diff --git a/src/librustdoc/sort_pass.rs b/src/librustdoc/sort_pass.rs
index 9962906a3ad..c1e58f30c7a 100644
--- a/src/librustdoc/sort_pass.rs
+++ b/src/librustdoc/sort_pass.rs
@@ -17,6 +17,8 @@ use fold;
 use pass::Pass;
 use util::NominalOp;
 
+#[cfg(test)] use extract;
+
 use std::sort;
 
 pub type ItemLtEqOp = @pure fn(v1: &doc::ItemTag, v2:  &doc::ItemTag) -> bool;
diff --git a/src/librustdoc/trim_pass.rs b/src/librustdoc/trim_pass.rs
index 2f3b634dda3..eb63d9a52d0 100644
--- a/src/librustdoc/trim_pass.rs
+++ b/src/librustdoc/trim_pass.rs
@@ -26,6 +26,8 @@ pub fn mk_pass() -> Pass {
 
 #[test]
 fn should_trim_text() {
+    use core::option::Some;
+
     let doc = test::mk_doc(~"#[doc = \" desc \"] \
                             mod m {
                             }");
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index b280c8eab6f..c7b50bf8908 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -273,7 +273,7 @@ pub impl &Arena {
 
 #[test]
 fn test_arena_destructors() {
-    let arena = arena::Arena();
+    let arena = Arena();
     for uint::range(0, 10) |i| {
         // Arena allocate something with drop glue to make sure it
         // doesn't leak.
@@ -286,7 +286,7 @@ fn test_arena_destructors() {
 
 #[test] #[should_fail] #[ignore(cfg(windows))]
 fn test_arena_destructors_fail() {
-    let arena = arena::Arena();
+    let arena = Arena();
     // Put some stuff in the arena.
     for uint::range(0, 10) |i| {
         // Arena allocate something with drop glue to make sure it
diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs
index 4ae4de1b878..564d34f73d7 100644
--- a/src/libstd/flatpipes.rs
+++ b/src/libstd/flatpipes.rs
@@ -635,8 +635,8 @@ mod test {
     use flatpipes::pod;
     use flatpipes::serial;
     use io_util::BufReader;
-    use net::tcp::TcpSocketBuf;
     use flatpipes::{BytePort, FlatChan, FlatPort};
+    use net::tcp::TcpSocketBuf;
 
     use core::int;
     use core::io::{BytesReader, BytesWriter};
@@ -762,7 +762,6 @@ mod test {
 
         use core::cell::Cell;
         use net::ip;
-        use net::tcp::TcpSocket;
         use net::tcp;
         use uv;
 
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index cc7aec1f450..4e851005de5 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -639,7 +639,6 @@ pub mod groups {
 mod tests {
     use core::prelude::*;
 
-    use opt = getopts;
     use getopts::groups::OptGroup;
     use getopts::*;
 
diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs
index 3a990ce9108..18f38e074c7 100644
--- a/src/libstd/net_url.rs
+++ b/src/libstd/net_url.rs
@@ -819,7 +819,6 @@ mod tests {
     use net_url::*;
 
     use core::hashmap::linear::LinearMap;
-    use core::str;
 
     #[test]
     pub fn test_url_parse() {
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 16266236a12..47948cc3ead 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1334,15 +1334,15 @@ pub enum inlined_item {
 
 #[cfg(test)]
 mod test {
-    use std;
-    use codemap::*;
-    use super::*;
-
     //are asts encodable?
 
     // it looks like this *will* be a compiler bug, after
     // I get deriving_eq for crates into incoming :)
     /*
+    use std;
+    use codemap::*;
+    use super::*;
+
     #[test] fn check_asts_encodable() {
         let bogus_span = span {lo:BytePos(10),
                                hi:BytePos(20),
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index 33b768bdb61..644afaff37c 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -1206,14 +1206,7 @@ fn mk_enum_deser_body(
 mod test {
     use std::serialize::Encodable;
     use std::serialize::Encoder;
-    use core::dvec::*;
     use util::testing::*;
-    use core::io;
-    use core::str;
-    use core::option::Option;
-    use core::option::Some;
-    use core::option::None;
-    use std;
 
     // just adding the ones I want to test, for now:
     #[deriving_eq]
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index c076936a12c..e9a3f47ab7b 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -500,7 +500,6 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
 
 #[cfg(test)]
 mod test {
-    use super::*;
     use super::MapChain;
     use util::testing::check_equal;
     use core::hashmap::linear::LinearMap;
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index d7f7f7c6510..b53523f78a4 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -10,7 +10,6 @@
 
 use core::prelude::*;
 
-use ast::tt_delim;
 use ast;
 use codemap::span;
 use ext::base::ext_ctxt;
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index 6e3c712273b..524f9b48dd5 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -779,7 +779,6 @@ pub mod test {
     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)