diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index 370c9bb4404..3181cb24ea7 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -16,6 +16,7 @@ //! Boolean logic +use bool; use cmp; use cmp::Eq; diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 79ce8d35858..4fe60810dc3 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -14,6 +14,7 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use char; use cmp::Eq; use str; use u32; diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index e4b18646b32..89789a38b24 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -473,6 +473,10 @@ impl DList { #[cfg(test)] mod tests { #[legacy_exports]; + + use iter; + use vec; + #[test] fn test_dlist_concat() { let a = from_vec(~[1,2]); diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index a6d568c5892..220b1a653af 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -21,6 +21,7 @@ Simple compression use libc; use libc::{c_void, size_t, c_int}; use ptr; +use rand; use vec; extern mod rustrt { @@ -91,8 +92,8 @@ fn test_flate_round_trip() { } debug!("de/inflate of %u bytes of random word-sequences", in.len()); - let cmp = flate::deflate_bytes(in); - let out = flate::inflate_bytes(cmp); + let cmp = deflate_bytes(in); + let out = inflate_bytes(cmp); debug!("%u bytes deflated to %u (%.1f%% size)", in.len(), cmp.len(), 100.0 * ((cmp.len() as float) / (in.len() as float))); diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 2f8422fa4f7..34269b88748 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -27,6 +27,7 @@ use m_float = f64; use cmp::{Eq, Ord}; +use cmp; use f64; use num; use num::Num::from_int; diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index 3d65c65221e..d04123fdb2b 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -16,6 +16,7 @@ use T = self::inst::T; use char; use cmp::{Eq, Ord}; +use cmp; use from_str::FromStr; use iter; use num; diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 1d25adb1e31..ade4f9d7fc8 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1113,6 +1113,12 @@ pub mod fsync { #[cfg(test)] mod tests { + use i32; + use io; + use result; + use str; + use u64; + use vec; #[test] fn test_simple() { diff --git a/src/libcore/oldcomm.rs b/src/libcore/oldcomm.rs index 9206f78b915..2ce2c323cbf 100644 --- a/src/libcore/oldcomm.rs +++ b/src/libcore/oldcomm.rs @@ -49,9 +49,11 @@ will once again be the preferred module for intertask communication. use cast; use either; use either::Either; +use iter; use libc; use libc::size_t; use ptr; +use result; use sys; use task; use vec; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 747b0a45501..e7c82cb8f66 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -46,6 +46,8 @@ let unwrapped_msg = match move msg { use cmp::Eq; use option; +use ptr; +use str; use util; /// The option type diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 4fe2050574d..3b340d6de79 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -920,6 +920,13 @@ pub fn arch() -> str { ~"arm" } #[cfg(test)] #[allow(non_implicitly_copyable_typarams)] mod tests { + use libc; + use option; + use os; + use rand; + use run; + use str; + use vec; #[test] pub fn last_os_error() { diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 7b745c477b1..14c7c288bdd 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -748,7 +748,7 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] { } // Various windows helpers, and tests for the impl. -mod windows { +pub mod windows { use libc; #[inline(always)] @@ -792,6 +792,9 @@ mod windows { #[cfg(test)] mod tests { + use path::windows; + use str; + #[test] fn test_double_slash_collapsing() { let path = PosixPath("tmp/"); diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 12c01b307d5..a129a9f4c5a 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -1246,6 +1246,9 @@ pub mod rt { #[cfg(test)] pub mod test { + use pipes::oneshot; + use pipes; + #[test] pub fn test_select2() { let (p1, c1) = pipes::stream(); diff --git a/src/libcore/private.rs b/src/libcore/private.rs index c9fda4b69ec..efa5062ad98 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -16,13 +16,16 @@ #[doc(hidden)]; use cast; +use iter; use libc; use oldcomm; use option; use pipes; use ptr; +use result; use task; use task::{TaskBuilder, atomically}; +use uint; extern mod rustrt { #[legacy_exports]; @@ -577,6 +580,12 @@ pub fn unwrap_exclusive(arc: Exclusive) -> T { #[cfg(test)] pub mod tests { + use option; + use pipes; + use result; + use task; + use uint; + #[test] pub fn exclusive_arc() { let mut futures = ~[]; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index f7faeb2b573..0bca8729d97 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -17,7 +17,10 @@ use cast; use cmp::{Eq, Ord}; use libc; use libc::{c_void, size_t}; +use ptr; +use str; use sys; +use vec; #[nolink] #[abi = "cdecl"] diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 651b62d3412..d816f23d4c0 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -362,6 +362,9 @@ pub fn random() -> uint { #[cfg(test)] pub mod tests { + use option::Option; + use rand; + #[test] pub fn rng_seeded() { let seed = rand::seed(); diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 539c8394fdf..9e9886e66ab 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -381,6 +381,9 @@ pub pure fn unwrap_err(res: Result) -> U { #[allow(non_implicitly_copyable_typarams)] mod tests { #[legacy_exports]; + + use result; + fn op1() -> result::Result { result::Ok(666) } fn op2(i: int) -> result::Result { diff --git a/src/libcore/run.rs b/src/libcore/run.rs index faa01519032..b753c647627 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -418,6 +418,8 @@ pub fn waitpid(pid: pid_t) -> int { #[cfg(test)] mod tests { use io::WriterUtil; + use os; + use run; // Regression test for memory leaks #[ignore(cfg(windows))] // FIXME (#2626) diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index 9159fee30d1..8be220e76d7 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -458,6 +458,8 @@ pub mod linear { #[test] pub mod test { use send_map::linear::LinearMap; + use send_map::linear; + use uint; #[test] pub fn inserts() { diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 5ba6c708001..a1595e4135e 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -2307,8 +2307,12 @@ impl &str: StrSlice { #[cfg(test)] mod tests { - + use char; use libc::c_char; + use libc; + use ptr; + use str::raw; + use vec; #[test] fn test_eq() { diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 1d1a3778ef7..d79fa3a86ff 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -145,6 +145,7 @@ pub pure fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! { #[cfg(test)] pub mod tests { + use cast; #[test] pub fn size_of_basic() { diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index b1bf2965919..0cfceb6358a 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -28,6 +28,7 @@ magic. use rt; use task::local_data_priv::{local_get, local_pop, local_modify, local_set}; +use task; /** * Indexes a task-local data slot. The function's code pointer is used for diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 2b7da541b1c..245b955c871 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -38,15 +38,21 @@ * ~~~ */ +use cast; use cmp; use cmp::Eq; +use iter; +use libc; use oldcomm; use option; use result::Result; use pipes::{stream, Chan, Port}; +use pipes; +use ptr; use result; use task::local_data_priv::{local_get, local_set}; use task::rt::{task_id, rust_task}; +use task; use util; use util::replace; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 3ae3eb2e8d4..a904cbec3e5 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -74,7 +74,9 @@ #[warn(deprecated_mode)]; use cast; +use oldcomm; use option; +use pipes; use private; use ptr; use send_map; diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 1f3808fab1b..ec280568282 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -20,6 +20,7 @@ use from_str::FromStr; use iter; use num; use str; +use uint; use vec; pub const bits : uint = inst::bits; diff --git a/src/libcore/uint-template/uint.rs b/src/libcore/uint-template/uint.rs index fb1762ef300..4d2da7180ef 100644 --- a/src/libcore/uint-template/uint.rs +++ b/src/libcore/uint-template/uint.rs @@ -17,6 +17,7 @@ pub use self::inst::{ mod inst { use sys; + use uint; pub type T = uint; diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 2742e5f6e4f..1920edc8253 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -2245,6 +2245,8 @@ impl @[A] : iter::CopyableNonstrictIter { #[cfg(test)] mod tests { + use option; + use vec::raw; fn square(n: uint) -> uint { return n * n; } @@ -2597,7 +2599,9 @@ mod tests { fn halve(i: &int) -> Option { if *i % 2 == 0 { return option::Some::(*i / 2); - } else { return option::None::; } + } else { + return option::None::; + } } fn halve_for_sure(i: &int) -> int { return *i / 2; } let all_even: ~[int] = ~[0, 2, 8, 6]; diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 834b45f4944..c1e940d6f24 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -238,6 +238,10 @@ fn nospan(t: T) -> ast::spanned { } fn path_node(ids: ~[ast::ident]) -> @ast::path { + @{span: dummy_sp(), global: false, idents: ids, rp: None, types: ~[]} +} + +fn path_node_global(ids: ~[ast::ident]) -> @ast::path { @{span: dummy_sp(), global: true, idents: ids, rp: None, types: ~[]} } @@ -284,8 +288,8 @@ fn mk_path(cx: test_ctxt, path: ~[ast::ident]) -> ~[ast::ident] { // The ast::Ty of ~[std::test::test_desc] fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::Ty { let test_desc_ty_path = - path_node(mk_path(cx, ~[cx.sess.ident_of(~"test"), - cx.sess.ident_of(~"TestDesc")])); + path_node_global(mk_path(cx, ~[cx.sess.ident_of(~"test"), + cx.sess.ident_of(~"TestDesc")])); let test_desc_ty: ast::Ty = {id: cx.sess.next_node_id(), @@ -345,7 +349,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { nospan({mutbl: ast::m_imm, ident: cx.sess.ident_of(~"name"), expr: @name_expr}); - let fn_path = path_node(path); + let fn_path = path_node_global(path); let fn_expr: ast::expr = {id: cx.sess.next_node_id(), @@ -464,7 +468,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { // Call os::args to generate the vector of test_descs - let args_path = path_node(~[ + let args_path = path_node_global(~[ cx.sess.ident_of(~"os"), cx.sess.ident_of(~"args") ]); @@ -497,7 +501,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { node: test_call_expr_, span: dummy_sp()}; // Call std::test::test_main - let test_main_path = path_node( + let test_main_path = path_node_global( mk_path(cx, ~[cx.sess.ident_of(~"test"), cx.sess.ident_of(~"test_main")])); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index a9eff93e6b8..27565b44c6d 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -298,10 +298,10 @@ fn core_macros() -> ~str { { $c:ident: $in:ty -> $out:ty; } => { mod $c { - fn key(_x: @core::condition::Handler<$in,$out>) { } + fn key(_x: @::core::condition::Handler<$in,$out>) { } - pub const cond : core::condition::Condition<$in,$out> = - core::condition::Condition { + pub const cond : ::core::condition::Condition<$in,$out> = + ::core::condition::Condition { name: stringify!(c), key: key };