diff options
| author | bors <bors@rust-lang.org> | 2014-01-08 10:06:45 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-08 10:06:45 -0800 |
| commit | 430652c970db41f718936bb649516c401b02964b (patch) | |
| tree | a41d51a20c1b3c876a345039bcfdd86a5c9b8cc2 /src/libstd | |
| parent | f3a8baafbecdb6e41f001c8f218d4796a9ca8d40 (diff) | |
| parent | 0547fb9cad4053f3ec66e722b7a05df259d63038 (diff) | |
| download | rust-430652c970db41f718936bb649516c401b02964b.tar.gz rust-430652c970db41f718936bb649516c401b02964b.zip | |
auto merge of #11370 : alexcrichton/rust/issue-10465, r=pwalton
Turned out to be a 2-line fix, but the compiler fallout was huge.
Diffstat (limited to 'src/libstd')
54 files changed, 147 insertions, 128 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index adc10c456e3..c52ff2d088d 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -478,10 +478,10 @@ static ASCII_UPPER_MAP: &'static [u8] = &[ #[cfg(test)] mod tests { + use prelude::*; use super::*; use str::from_char; use char::from_u32; - use option::{Some, None}; macro_rules! v2ascii ( ( [$($e:expr),*]) => ( [$(Ascii{chr:$e}),*]); diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs index fd8b88417e0..aedda59bbac 100644 --- a/src/libstd/at_vec.rs +++ b/src/libstd/at_vec.rs @@ -169,6 +169,7 @@ pub mod raw { use at_vec::capacity; use cast; use cast::{transmute, transmute_copy}; + use container::Container; use option::None; use ptr; use mem; diff --git a/src/libstd/bool.rs b/src/libstd/bool.rs index 923aacf352b..a20ddc14147 100644 --- a/src/libstd/bool.rs +++ b/src/libstd/bool.rs @@ -317,10 +317,7 @@ impl Zero for bool { #[cfg(test)] mod tests { - use cmp::{Equal, Greater, Less, Eq, TotalOrd}; - use ops::{BitAnd, BitXor, BitOr}; - use from_str::{FromStr, from_str}; - use option::{Some, None}; + use prelude::*; use super::all_values; #[test] diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index a7e502be32e..b924378a0e7 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -377,10 +377,10 @@ pub unsafe fn from_c_multistring(buf: *libc::c_char, #[cfg(test)] mod tests { + use prelude::*; use super::*; use libc; use ptr; - use option::{Some, None}; #[test] fn test_str_multistring_parsing() { @@ -568,11 +568,10 @@ mod tests { #[cfg(test)] mod bench { - use iter::range; + use extra::test::BenchHarness; use libc; - use option::Some; + use prelude::*; use ptr; - use extra::test::BenchHarness; #[inline] fn check(s: &str, c_str: *libc::c_char) { diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index b21b255dbfc..bf37e5fca6a 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -238,7 +238,7 @@ use rt::local::Local; use rt::task::{Task, BlockedTask}; use rt::thread::Thread; use sync::atomics::{AtomicInt, AtomicBool, SeqCst, Relaxed}; -use vec::{ImmutableVector, OwnedVector}; +use vec::OwnedVector; use spsc = sync::spsc_queue; use mpsc = sync::mpsc_queue; diff --git a/src/libstd/gc.rs b/src/libstd/gc.rs index d3bec8ca6c9..df7111ca510 100644 --- a/src/libstd/gc.rs +++ b/src/libstd/gc.rs @@ -54,6 +54,7 @@ impl<T: DeepClone + Send + 'static> DeepClone for Gc<T> { #[cfg(test)] mod tests { + use prelude::*; use super::*; use cell::RefCell; diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index fd8fd0c6814..fa85f286af7 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -318,9 +318,10 @@ impl<S: Stream> Decorator<S> for BufferedStream<S> { #[cfg(test)] mod test { + use io::Decorator; + use io; use prelude::*; use super::*; - use io; use super::super::mem::{MemReader, MemWriter}; use Harness = extra::test::BenchHarness; diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index 1b6d1171a52..860ff644018 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -16,6 +16,7 @@ use iter::Iterator; use option::Option; use io::Reader; +use vec::OwnedVector; /// An iterator that reads a single byte on each iteration, /// until `.read_byte()` returns `None`. @@ -130,10 +131,11 @@ pub fn u64_from_be_bytes(data: &[u8], #[cfg(test)] mod test { - use option::{None, Option, Some}; + use unstable::finally::Finally; + use io::Decorator; + use prelude::*; use io::mem::{MemReader, MemWriter}; - use io::{Reader, io_error, placeholder_error}; - use vec::ImmutableVector; + use io::{io_error, placeholder_error}; struct InitialZeroByteReader { count: int, @@ -375,7 +377,7 @@ mod test { fn push_bytes_fail_reset_len() { // push_bytes unsafely sets the vector length. This is testing that // upon failure the length is reset correctly. - let mut reader = ErroringLaterReader { + let reader = ErroringLaterReader { count: 0, }; // FIXME (#7049): Figure out some other way to do this. diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 6d968de209c..fe29a112262 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -100,8 +100,8 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>) #[cfg(test)] mod test { - use option::Some; use io::net::ip::Ipv4Addr; + use prelude::*; use super::*; #[test] diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 9fd183ca770..4fb631eb3d6 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -10,9 +10,11 @@ use container::Container; use from_str::FromStr; +use iter::Iterator; use option::{Option, None, Some}; +use str::StrSlice; use to_str::ToStr; -use vec::{MutableCloneableVector, ImmutableVector}; +use vec::{MutableCloneableVector, ImmutableVector, MutableVector}; pub type Port = u16; @@ -335,9 +337,8 @@ impl FromStr for SocketAddr { #[cfg(test)] mod test { + use prelude::*; use super::*; - use from_str::FromStr; - use option::{Option, Some, None}; #[test] fn test_from_str_ipv4() { diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index 8994f6b461a..eaee48dc6e0 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -100,8 +100,6 @@ impl Writer for UdpStream { mod test { use super::*; use io::net::ip::{SocketAddr}; - use io::*; - use prelude::*; iotest!(fn bind_error() { let mut called = false; diff --git a/src/libstd/io/option.rs b/src/libstd/io/option.rs index a661d6ab7eb..60e63e95dcc 100644 --- a/src/libstd/io/option.rs +++ b/src/libstd/io/option.rs @@ -104,8 +104,9 @@ impl<T, A: Acceptor<T>> Acceptor<T> for Option<A> { #[cfg(test)] mod test { - use option::*; + use prelude::*; use super::super::mem::*; + use io::Decorator; use super::super::{PreviousIoError, io_error}; #[test] diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 396e892520c..6e6cdfb25de 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -26,6 +26,7 @@ out.write(bytes!("Hello, world!")); */ +use container::Container; use fmt; use io::buffered::LineBufferedWriter; use io::{Reader, Writer, io_error, IoError, OtherIoError, @@ -37,7 +38,9 @@ use result::{Ok, Err}; use rt::local::Local; use rt::rtio::{DontClose, IoFactory, LocalIo, RtioFileStream, RtioTTY}; use rt::task::Task; +use str::StrSlice; use util; +use vec::ImmutableVector; // And so begins the tale of acquiring a uv handle to a stdio stream on all // platforms in all situations. Our story begins by splitting the world into two diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 48030543336..86538c37249 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -193,6 +193,7 @@ pub fn copy<R: Reader, W: Writer>(r: &mut R, w: &mut W) { #[cfg(test)] mod test { + use io::Decorator; use io::mem::{MemReader, MemWriter}; use super::*; use prelude::*; diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index a08faf66199..0e7e4277dd6 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -445,6 +445,7 @@ mod tests { use int; use i32; use num; + use num::CheckedDiv; use mem; #[test] diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 7dcae69f70d..ba51ac3e88d 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -21,7 +21,7 @@ use str; use vec::{CopyableVector, ImmutableVector, MutableVector}; use vec::OwnedVector; use num::{NumCast, Zero, One, cast, pow_with_uint, Integer}; -use num::{Round, Float, FPNaN, FPInfinite}; +use num::{Round, Float, FPNaN, FPInfinite, ToPrimitive}; pub enum ExponentFormat { ExpNone, diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index 6da3e43a5d6..1a256981d74 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -324,6 +324,7 @@ mod tests { use super::*; use num; + use num::CheckedDiv; use mem; use u16; diff --git a/src/libstd/option.rs b/src/libstd/option.rs index a44b280aa84..f49244a3607 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -457,6 +457,7 @@ pub fn collect<T, Iter: Iterator<Option<T>>, V: FromIterator<T>>(iter: Iter) -> #[cfg(test)] mod tests { use super::*; + use prelude::*; use iter::range; use str::StrSlice; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 8f2f2190885..4042e13a592 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -81,13 +81,15 @@ pub fn getcwd() -> Path { #[cfg(windows)] pub mod win32 { + use libc::types::os::arch::extra::DWORD; use libc; - use vec; - use str; use option::{None, Option}; use option; use os::TMPBUF_SZ; - use libc::types::os::arch::extra::DWORD; + use str::StrSlice; + use str; + use vec::{MutableVector, ImmutableVector, OwnedVector}; + use vec; pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) -> Option<~str> { @@ -1237,16 +1239,14 @@ pub mod consts { #[cfg(test)] mod tests { + use prelude::*; use c_str::ToCStr; - use option::Some; use option; use os::{env, getcwd, getenv, make_absolute, args}; use os::{setenv, unsetenv}; use os; - use path::Path; use rand::Rng; use rand; - use str::StrSlice; #[test] diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 6488595ea4f..354cc10f022 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -687,6 +687,7 @@ fn from_utf8_with_replacement(mut v: &[u8]) -> ~str { } #[cfg(test)] mod tests { + use prelude::*; use super::{GenericPath, PosixPath, WindowsPath}; use c_str::ToCStr; diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index d149634a396..7b94de6c094 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -21,7 +21,8 @@ use str; use str::Str; use to_bytes::IterBytes; use vec; -use vec::{CopyableVector, RSplitIterator, SplitIterator, Vector, VectorVector}; +use vec::{CopyableVector, RSplitIterator, SplitIterator, Vector, VectorVector, + ImmutableEqVector, OwnedVector, ImmutableVector, OwnedCopyableVector}; use super::{BytesContainer, GenericPath, GenericPathUnsafe}; /// Iterator that yields successive components of a Path as &[u8] @@ -441,11 +442,9 @@ static dot_dot_static: &'static [u8] = bytes!(".."); #[cfg(test)] mod tests { + use prelude::*; use super::*; - use option::{Option, Some, None}; - use iter::Iterator; use str; - use vec::Vector; macro_rules! t( (s: $path:expr, $exp:expr) => ( @@ -1324,6 +1323,7 @@ mod tests { mod bench { use extra::test::BenchHarness; use super::*; + use prelude::*; #[bench] fn join_home_dir(bh: &mut BenchHarness) { diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 913b314c00b..09b00be7e9d 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -13,14 +13,16 @@ use ascii::AsciiCast; use c_str::{CString, ToCStr}; use cast; +use clone::Clone; +use container::Container; use cmp::Eq; use from_str::FromStr; use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Invert, Iterator, Map}; use option::{Option, Some, None}; use str; -use str::{CharSplitIterator, OwnedStr, Str, StrVector}; +use str::{CharSplitIterator, OwnedStr, Str, StrVector, StrSlice}; use to_bytes::IterBytes; -use vec::Vector; +use vec::{Vector, OwnedVector, ImmutableVector}; use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe}; /// Iterator that yields successive components of a Path as &str @@ -1051,11 +1053,9 @@ fn prefix_len(p: Option<PathPrefix>) -> uint { #[cfg(test)] mod tests { + use prelude::*; use super::*; use super::parse_prefix; - use option::{Some,None}; - use iter::Iterator; - use vec::Vector; macro_rules! t( (s: $path:expr, $exp:expr) => ( diff --git a/src/libstd/rand/distributions/exponential.rs b/src/libstd/rand/distributions/exponential.rs index 6164ecd1a2b..336528eeb25 100644 --- a/src/libstd/rand/distributions/exponential.rs +++ b/src/libstd/rand/distributions/exponential.rs @@ -10,6 +10,7 @@ //! The exponential distribution. +use num::Exponential; use rand::{Rng, Rand}; use rand::distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample}; @@ -90,10 +91,10 @@ impl IndependentSample<f64> for Exp { #[cfg(test)] mod test { + use rand::distributions::*; + use prelude::*; use rand::*; use super::*; - use iter::range; - use option::{Some, None}; #[test] fn test_exp() { @@ -119,11 +120,11 @@ mod test { #[cfg(test)] mod bench { use extra::test::BenchHarness; + use mem::size_of; + use prelude::*; use rand::{XorShiftRng, RAND_BENCH_N}; use super::*; - use iter::range; - use option::{Some, None}; - use mem::size_of; + use rand::distributions::*; #[bench] fn rand_exp(bh: &mut BenchHarness) { diff --git a/src/libstd/rand/distributions/gamma.rs b/src/libstd/rand/distributions/gamma.rs index 731baa0f305..96efa948015 100644 --- a/src/libstd/rand/distributions/gamma.rs +++ b/src/libstd/rand/distributions/gamma.rs @@ -10,10 +10,11 @@ //! The Gamma and derived distributions. +use num::Algebraic; +use num; use rand::{Rng, Open01}; -use super::{IndependentSample, Sample, Exp}; use super::normal::StandardNormal; -use num; +use super::{IndependentSample, Sample, Exp}; /// The Gamma distribution `Gamma(shape, scale)` distribution. /// @@ -309,10 +310,10 @@ impl IndependentSample<f64> for StudentT { #[cfg(test)] mod test { + use rand::distributions::*; + use prelude::*; use rand::*; use super::*; - use iter::range; - use option::{Some, None}; #[test] fn test_chi_squared_one() { @@ -370,13 +371,12 @@ mod test { #[cfg(test)] mod bench { - use super::*; + use extra::test::BenchHarness; use mem::size_of; + use prelude::*; use rand::distributions::IndependentSample; use rand::{StdRng, RAND_BENCH_N}; - use extra::test::BenchHarness; - use iter::range; - use option::{Some, None}; + use super::*; #[bench] diff --git a/src/libstd/rand/distributions/mod.rs b/src/libstd/rand/distributions/mod.rs index a297bbee1e6..a996233abe3 100644 --- a/src/libstd/rand/distributions/mod.rs +++ b/src/libstd/rand/distributions/mod.rs @@ -20,11 +20,14 @@ that do not need to record state. */ -use iter::range; +use container::Container; +use iter::{range, Iterator}; use option::{Some, None}; use num; +use num::CheckedAdd; use rand::{Rng, Rand}; use clone::Clone; +use vec::MutableVector; pub use self::range::Range; pub use self::gamma::{Gamma, ChiSquared, FisherF, StudentT}; @@ -250,9 +253,9 @@ fn ziggurat<R:Rng>( #[cfg(test)] mod tests { + use prelude::*; use rand::*; use super::*; - use option::{Some, None}; #[deriving(Eq)] struct ConstRand(uint); diff --git a/src/libstd/rand/distributions/normal.rs b/src/libstd/rand/distributions/normal.rs index 8dc9372aec9..7a15091df9d 100644 --- a/src/libstd/rand/distributions/normal.rs +++ b/src/libstd/rand/distributions/normal.rs @@ -10,6 +10,7 @@ //! The normal and derived distributions. +use num::Exponential; use rand::{Rng, Rand, Open01}; use rand::distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample}; @@ -147,10 +148,10 @@ impl IndependentSample<f64> for LogNormal { #[cfg(test)] mod tests { + use prelude::*; use rand::*; use super::*; - use iter::range; - use option::{Some, None}; + use rand::distributions::*; #[test] fn test_normal() { @@ -187,11 +188,11 @@ mod tests { #[cfg(test)] mod bench { use extra::test::BenchHarness; + use mem::size_of; + use prelude::*; use rand::{XorShiftRng, RAND_BENCH_N}; + use rand::distributions::*; use super::*; - use iter::range; - use option::{Some, None}; - use mem::size_of; #[bench] fn rand_normal(bh: &mut BenchHarness) { diff --git a/src/libstd/rand/distributions/range.rs b/src/libstd/rand/distributions/range.rs index fc6cdde162d..8141b3d3e89 100644 --- a/src/libstd/rand/distributions/range.rs +++ b/src/libstd/rand/distributions/range.rs @@ -163,12 +163,11 @@ float_impl! { f64 } #[cfg(test)] mod tests { + use prelude::*; use super::*; use rand::*; + use rand::distributions::*; use num::Bounded; - use iter::range; - use option::{Some, None}; - use vec::ImmutableVector; #[should_fail] #[test] diff --git a/src/libstd/rand/isaac.rs b/src/libstd/rand/isaac.rs index 38d7a683a70..6fd2cde9dfb 100644 --- a/src/libstd/rand/isaac.rs +++ b/src/libstd/rand/isaac.rs @@ -12,8 +12,9 @@ use rand::{Rng, SeedableRng, OSRng}; use iter::{Iterator, range, range_step, Repeat}; +use num::Times; use option::{None, Some}; -use vec::raw; +use vec::{raw, MutableVector, ImmutableVector}; use mem; static RAND_SIZE_LEN: u32 = 8; @@ -432,8 +433,7 @@ impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng { mod test { use super::*; use rand::{Rng, SeedableRng, OSRng}; - use option::Some; - use iter::range; + use prelude::*; use vec; #[test] diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 0fa436b2447..e52a3850011 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -656,8 +656,7 @@ pub struct Closed01<F>(F); #[cfg(test)] mod test { - use iter::{Iterator, range}; - use option::{Option, Some}; + use prelude::*; use vec; use super::*; @@ -845,11 +844,10 @@ static RAND_BENCH_N: u64 = 100; #[cfg(test)] mod bench { + use prelude::*; use extra::test::BenchHarness; use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, Rng, RAND_BENCH_N}; use mem::size_of; - use iter::range; - use option::{Some, None}; #[bench] fn rand_xorshift(bh: &mut BenchHarness) { diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 1eaff3f51a6..a8fd75c1bee 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -106,6 +106,9 @@ impl Rng for OSRng { unsafe { cast::transmute(v) } } fn fill_bytes(&mut self, v: &mut [u8]) { + use container::Container; + use vec::MutableVector; + extern { fn rust_win32_rand_gen(hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: *mut BYTE); diff --git a/src/libstd/rand/rand_impls.rs b/src/libstd/rand/rand_impls.rs index dd6edca94ac..1c90ef148fc 100644 --- a/src/libstd/rand/rand_impls.rs +++ b/src/libstd/rand/rand_impls.rs @@ -226,9 +226,8 @@ impl<T: Rand + 'static> Rand for @T { #[cfg(test)] mod tests { + use prelude::*; use rand::{Rng, task_rng, Open01, Closed01}; - use iter::range; - use option::{None, Some}; struct ConstantRng(u64); impl Rng for ConstantRng { diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index 95a82225123..7af98e418a8 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -10,6 +10,7 @@ //! A wrapper around any Reader to treat it as an RNG. +use container::Container; use option::{Some, None}; use io::Reader; @@ -77,6 +78,8 @@ mod test { use super::*; use io::mem::MemReader; use cast; + use rand::*; + use prelude::*; #[test] fn test_reader_rng_u64() { diff --git a/src/libstd/rand/reseeding.rs b/src/libstd/rand/reseeding.rs index 7055b7af3de..c0a7d14bf70 100644 --- a/src/libstd/rand/reseeding.rs +++ b/src/libstd/rand/reseeding.rs @@ -11,8 +11,9 @@ //! A wrapper around another RNG that reseeds it after it //! generates a certain number of random bytes. -use rand::{Rng, SeedableRng}; +use container::Container; use default::Default; +use rand::{Rng, SeedableRng}; /// How many bytes of entropy the underling RNG is allowed to generate /// before it is reseeded. @@ -141,11 +142,9 @@ impl Default for ReseedWithDefault { #[cfg(test)] mod test { + use prelude::*; use super::*; use rand::{SeedableRng, Rng}; - use default::Default; - use iter::range; - use option::{None, Some}; struct Counter { i: u32 diff --git a/src/libstd/rc.rs b/src/libstd/rc.rs index 9158e8cdb89..ad2305c2410 100644 --- a/src/libstd/rc.rs +++ b/src/libstd/rc.rs @@ -170,6 +170,7 @@ impl<T> Drop for Rc<T> { #[cfg(test)] mod test_rc { + use prelude::*; use super::*; use cell::RefCell; diff --git a/src/libstd/result.rs b/src/libstd/result.rs index 4e8db15a92e..1a4e6d5bcfd 100644 --- a/src/libstd/result.rs +++ b/src/libstd/result.rs @@ -293,10 +293,9 @@ pub fn fold_<T,E,Iter:Iterator<Result<T,E>>>(iterator: Iter) -> Result<(),E> { #[cfg(test)] mod tests { use super::*; + use prelude::*; use iter::range; - use to_str::ToStr; - use vec::ImmutableVector; pub fn op1() -> Result<int, ~str> { Ok(666) } pub fn op2() -> Result<int, ~str> { Err(~"sadface") } diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index a767af4cc0e..526ad60bb21 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -64,8 +64,10 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) } #[cfg(target_os = "freebsd")] mod imp { use cast; + use clone::Clone; #[cfg(not(test))] use libc; use option::{Option, Some, None}; + use ptr::RawPtr; use iter::Iterator; #[cfg(not(test))] use str; use unstable::finally::Finally; @@ -138,7 +140,7 @@ mod imp { #[cfg(test)] mod tests { - use option::{Some, None}; + use prelude::*; use super::*; use unstable::finally::Finally; diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs index d1e97cb6ec0..7dcbae995ed 100644 --- a/src/libstd/rt/borrowck.rs +++ b/src/libstd/rt/borrowck.rs @@ -9,6 +9,8 @@ // except according to those terms. use c_str::{ToCStr, CString}; +use container::Container; +use iter::Iterator; use libc::{c_char, size_t}; use option::{Option, None, Some}; use ptr::RawPtr; @@ -19,7 +21,7 @@ use str::OwnedStr; use str; use uint; use unstable::raw; -use vec::ImmutableVector; +use vec::{ImmutableVector, OwnedVector}; pub static FROZEN_BIT: uint = 1 << (uint::bits - 1); pub static MUT_BIT: uint = 1 << (uint::bits - 2); diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs index d9b40cfbb6e..16c1ad25448 100644 --- a/src/libstd/rt/crate_map.rs +++ b/src/libstd/rt/crate_map.rs @@ -10,7 +10,9 @@ use container::MutableSet; use hashmap::HashSet; +use iter::Iterator; use option::{Some, None, Option}; +use ptr::RawPtr; use vec::ImmutableVector; use rt::rtio::EventLoop; diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs index c094344f6b9..7a417990a4c 100644 --- a/src/libstd/rt/global_heap.rs +++ b/src/libstd/rt/global_heap.rs @@ -9,6 +9,7 @@ // except according to those terms. use libc::{c_void, c_char, size_t, uintptr_t, free, malloc, realloc}; +use ptr::RawPtr; use unstable::intrinsics::TyDesc; use unstable::raw; use mem::size_of; diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs index f2edc6e7ede..1be942b2db1 100644 --- a/src/libstd/rt/local_heap.rs +++ b/src/libstd/rt/local_heap.rs @@ -11,18 +11,21 @@ //! The local, garbage collected heap use cast; +use iter::Iterator; use libc::{c_void, uintptr_t}; use libc; use mem; use ops::Drop; use option::{Option, None, Some}; use ptr; +use ptr::RawPtr; use rt::env; use rt::global_heap; use rt::local::Local; use rt::task::Task; use unstable::intrinsics::TyDesc; use unstable::raw; +use vec::ImmutableVector; // This has no meaning with out rtdebug also turned on. #[cfg(rtdebug)] diff --git a/src/libstd/rt/local_ptr.rs b/src/libstd/rt/local_ptr.rs index 546a6476b57..f4efd8e27d0 100644 --- a/src/libstd/rt/local_ptr.rs +++ b/src/libstd/rt/local_ptr.rs @@ -19,6 +19,7 @@ use cast; use ops::Drop; +use ptr::RawPtr; #[cfg(windows)] // mingw-w32 doesn't like thread_local things #[cfg(target_os = "android")] // see #10686 @@ -79,6 +80,7 @@ pub unsafe fn borrow<T>() -> Borrowed<T> { pub mod compiled { use cast; use option::{Option, Some, None}; + use ptr::RawPtr; #[cfg(not(test))] use libc::c_void; #[cfg(test)] @@ -177,6 +179,7 @@ pub mod native { use libc::c_void; use option::{Option, Some, None}; use ptr; + use ptr::RawPtr; use tls = rt::thread_local_storage; static mut RT_TLS_KEY: tls::Key = -1; diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs index 586d26a24e3..b86a9612d70 100644 --- a/src/libstd/rt/logging.rs +++ b/src/libstd/rt/logging.rs @@ -8,12 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use container::Container; use from_str::from_str; +use iter::Iterator; use libc::exit; use option::{Some, None, Option}; use rt::crate_map::{ModEntry, CrateMap, iter_crate_map, get_crate_map}; use str::StrSlice; -use vec::{ImmutableVector, MutableTotalOrdVector}; +use vec::{ImmutableVector, MutableTotalOrdVector, OwnedVector}; #[cfg(test)] use cast::transmute; struct LogDirective { diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 050caef86eb..d839ef62af9 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -58,14 +58,9 @@ Several modules in `core` are clients of `rt`: #[allow(missing_doc)]; use any::Any; -use clone::Clone; -use container::Container; -use iter::Iterator; use option::Option; -use ptr::RawPtr; use result::Result; use task::TaskOpts; -use vec::{OwnedVector, MutableVector, ImmutableVector}; use self::task::{Task, BlockedTask}; diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 2d9105d6766..6c94f237789 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -17,6 +17,7 @@ use any::AnyOwnExt; use borrow; use cast; use cleanup; +use clone::Clone; use io::Writer; use iter::{Iterator, Take}; use local_data; diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index cb5360200d5..3a07e8c373b 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -62,6 +62,7 @@ use kinds::Send; use libc::{c_void, c_char, size_t}; use option::{Some, None, Option}; use prelude::drop; +use ptr::RawPtr; use result::{Err, Ok}; use rt::local::Local; use rt::task::Task; @@ -76,6 +77,7 @@ mod libunwind { //! Unwind library interface #[allow(non_camel_case_types)]; + #[allow(dead_code)] // these are just bindings use libc::{uintptr_t, uint64_t}; @@ -261,7 +263,8 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class { // This is achieved by overriding the return value in search phase to always // say "catch!". -#[cfg(not(target_arch = "arm"))] +#[cfg(not(target_arch = "arm"), not(test))] +#[doc(hidden)] pub mod eabi { use uw = super::libunwind; use libc::c_int; @@ -277,8 +280,6 @@ pub mod eabi { #[lang="eh_personality"] #[no_mangle] // so we can reference it by name from middle/trans/base.rs - #[doc(hidden)] - #[cfg(not(test))] pub extern "C" fn rust_eh_personality( version: c_int, actions: uw::_Unwind_Action, @@ -294,8 +295,6 @@ pub mod eabi { } #[no_mangle] // referenced from rust_try.ll - #[doc(hidden)] - #[cfg(not(test))] pub extern "C" fn rust_eh_personality_catch( version: c_int, actions: uw::_Unwind_Action, @@ -318,7 +317,7 @@ pub mod eabi { // ARM EHABI uses a slightly different personality routine signature, // but otherwise works the same. -#[cfg(target_arch = "arm")] +#[cfg(target_arch = "arm", not(test))] pub mod eabi { use uw = super::libunwind; use libc::c_int; @@ -332,8 +331,6 @@ pub mod eabi { #[lang="eh_personality"] #[no_mangle] // so we can reference it by name from middle/trans/base.rs - #[doc(hidden)] - #[cfg(not(test))] pub extern "C" fn rust_eh_personality( state: uw::_Unwind_State, ue_header: *uw::_Unwind_Exception, @@ -346,8 +343,6 @@ pub mod eabi { } #[no_mangle] // referenced from rust_try.ll - #[doc(hidden)] - #[cfg(not(test))] pub extern "C" fn rust_eh_personality_catch( state: uw::_Unwind_State, ue_header: *uw::_Unwind_Exception, diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 730a38ce886..ee336d7d847 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -11,11 +11,13 @@ use container::Container; use fmt; use from_str::FromStr; +use iter::Iterator; use libc; use option::{Some, None, Option}; use os; use str::StrSlice; use unstable::running_on_valgrind; +use vec::ImmutableVector; // Indicates whether we should perform expensive sanity checks, including rtassert! // XXX: Once the runtime matures remove the `true` below to turn off rtassert, etc. diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 337cb744080..3595a7d45ac 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -330,16 +330,15 @@ pub fn process_output(prog: &str, args: &[~str]) -> Option<ProcessOutput> { #[cfg(test)] mod tests { + use prelude::*; use libc::c_int; - use option::{Option, None, Some}; use os; - use path::Path; use run; use str; use task::spawn; use unstable::running_on_valgrind; use io::pipe::PipeStream; - use io::{Writer, Reader, io_error, FileNotFound}; + use io::{io_error, FileNotFound}; #[test] #[cfg(not(target_os="android"))] // FIXME(#10380) diff --git a/src/libstd/send_str.rs b/src/libstd/send_str.rs index f10818b052d..c8143442d6e 100644 --- a/src/libstd/send_str.rs +++ b/src/libstd/send_str.rs @@ -176,14 +176,8 @@ impl IterBytes for SendStr { #[cfg(test)] mod tests { - use clone::{Clone, DeepClone}; - use cmp::{TotalEq, Ord, TotalOrd, Equiv}; - use cmp::Equal; - use container::Container; - use default::Default; + use prelude::*; use send_str::{SendStrOwned, SendStrStatic}; - use str::Str; - use to_str::ToStr; #[test] fn test_send_str_traits() { diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 230564c6bf1..35e188964c1 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -977,11 +977,13 @@ static TAG_CONT_U8: u8 = 128u8; /// Unsafe operations pub mod raw { use cast; + use container::Container; use libc; use ptr; - use str::{is_utf8, OwnedStr}; + use ptr::RawPtr; + use str::{is_utf8, OwnedStr, StrSlice}; use vec; - use vec::MutableVector; + use vec::{MutableVector, ImmutableVector, OwnedVector}; use unstable::raw::Slice; /// Create a Rust string from a *u8 buffer of the given length @@ -1137,10 +1139,12 @@ Section: Trait implementations #[cfg(not(test))] #[allow(missing_doc)] pub mod traits { - use ops::Add; + use container::Container; use cmp::{TotalOrd, Ordering, Less, Equal, Greater, Eq, Ord, Equiv, TotalEq}; - use super::{Str, eq_slice}; + use iter::Iterator; + use ops::Add; use option::{Some, None}; + use str::{Str, StrSlice, OwnedStr, eq_slice}; impl<'a> Add<&'a str,~str> for &'a str { #[inline] @@ -2764,14 +2768,11 @@ impl Default for @str { #[cfg(test)] mod tests { - use container::Container; - use option::{None, Some, Option}; + use iter::AdditiveIterator; + use prelude::*; use ptr; use str::*; - use vec::{Vector, ImmutableVector, CopyableVector}; - use cmp::{TotalOrd, Less, Equal, Greater}; use send_str::{SendStrOwned, SendStrStatic}; - use from_str::from_str; #[test] fn test_eq() { diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 0569fe32c58..24568fe13e5 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -199,11 +199,12 @@ pub mod dl { #[cfg(target_os = "win32")] pub mod dl { - use os; use libc; + use os; + use path::GenericPath; use path; use ptr; - use result::*; + use result::{Ok, Err, Result}; pub unsafe fn open_external(filename: &path::Path) -> *libc::c_void { os::win32::as_utf16_p(filename.as_str().unwrap(), |raw_name| { diff --git a/src/libstd/unstable/mutex.rs b/src/libstd/unstable/mutex.rs index e11557ff337..4d12435e01a 100644 --- a/src/libstd/unstable/mutex.rs +++ b/src/libstd/unstable/mutex.rs @@ -167,6 +167,7 @@ mod imp { use libc::c_void; use libc; use ptr; + use ptr::RawPtr; type pthread_mutex_t = libc::c_void; type pthread_mutexattr_t = libc::c_void; @@ -248,6 +249,8 @@ mod imp { use libc; use libc::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES, c_void, DWORD, LPCSTR}; use ptr; + use ptr::RawPtr; + type LPCRITICAL_SECTION = *c_void; static SPIN_COUNT: DWORD = 4000; diff --git a/src/libstd/unstable/stack.rs b/src/libstd/unstable/stack.rs index d6cd690eaa9..66a9d18aaec 100644 --- a/src/libstd/unstable/stack.rs +++ b/src/libstd/unstable/stack.rs @@ -36,9 +36,10 @@ static RED_ZONE: uint = 20 * 1024; // irrelevant for documentation purposes. #[cfg(not(test))] // in testing, use the original libstd's version pub extern "C" fn rust_stack_exhausted() { - use rt::task::Task; use option::None; use rt::local::Local; + use rt::task::Task; + use str::Str; use unstable::intrinsics; unsafe { diff --git a/src/libstd/util.rs b/src/libstd/util.rs index 6c0424b50e1..06c7923bfed 100644 --- a/src/libstd/util.rs +++ b/src/libstd/util.rs @@ -78,10 +78,7 @@ impl Void { #[cfg(test)] mod tests { use super::*; - - use clone::Clone; - use ops::Drop; - use option::{None, Some}; + use prelude::*; use mem::size_of; #[test] diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 3cb7fcd9533..9964c6842ab 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -611,6 +611,7 @@ impl<'a, T> RandomAccessIterator<&'a [T]> for ChunkIter<'a, T> { pub mod traits { use super::*; + use container::Container; use clone::Clone; use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Equiv}; use iter::order; @@ -2520,7 +2521,7 @@ pub unsafe fn from_buf<T>(ptr: *T, elts: uint) -> ~[T] { pub mod raw { use cast; use ptr; - use vec::{with_capacity, MutableVector}; + use vec::{with_capacity, MutableVector, OwnedVector}; use unstable::raw::Slice; /** @@ -2599,8 +2600,9 @@ pub mod raw { /// Operations on `[u8]`. pub mod bytes { use container::Container; - use vec::MutableVector; + use vec::{MutableVector, OwnedVector, ImmutableVector}; use ptr; + use ptr::RawPtr; /// A trait for operations on mutable `[u8]`s. pub trait MutableByteVector { @@ -2968,10 +2970,10 @@ impl<A> Extendable<A> for ~[A] { #[cfg(test)] mod tests { + use prelude::*; use mem; use vec::*; use cmp::*; - use prelude::*; use rand::{Rng, task_rng}; fn square(n: uint) -> uint { n * n } @@ -4452,13 +4454,11 @@ mod tests { #[cfg(test)] mod bench { use extra::test::BenchHarness; - use iter::range; - use vec; - use vec::{VectorVector, MutableTotalOrdVector}; - use option::*; + use mem; + use prelude::*; use ptr; use rand::{weak_rng, Rng}; - use mem; + use vec; #[bench] fn iterator(bh: &mut BenchHarness) { |
