diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 19:29:16 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 19:29:16 -0800 |
| commit | 44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46 (patch) | |
| tree | 83f3d67a9e21c6ce1b99c2ce8f6a737896c673db /src/libcore | |
| parent | a8d37af2473da79be704c9ce2374f278c47177b6 (diff) | |
| download | rust-44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46.tar.gz rust-44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46.zip | |
Revert "librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc"
This reverts commit a8d37af2473da79be704c9ce2374f278c47177b6.
Diffstat (limited to 'src/libcore')
45 files changed, 60 insertions, 341 deletions
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index d78d241d2b1..4f3f63c83fc 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -15,10 +15,8 @@ #[forbid(deprecated_pattern)]; use cast::transmute; -use kinds::Copy; use iter; use libc; -use option::Option; use ptr::addr_of; use sys; use uint; @@ -152,10 +150,6 @@ pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] { #[cfg(notest)] pub mod traits { - use at_vec::append; - use kinds::Copy; - use ops::Add; - pub impl<T: Copy> @[T] : Add<&[const T],@[T]> { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> @[T] { @@ -168,10 +162,8 @@ pub mod traits { pub mod traits {} pub mod raw { - use at_vec::{capacity, rusti, rustrt}; - use cast::transmute; + use at_vec::{rusti, rustrt}; use libc; - use ptr::addr_of; use ptr; use sys; use uint; diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index 3e7b88b7b78..3181cb24ea7 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -19,7 +19,6 @@ use bool; use cmp; use cmp::Eq; -use option::{None, Option, Some}; /// Negation / inverse pub pure fn not(v: bool) -> bool { !v } diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs index 950a753d73f..4ae89191545 100644 --- a/src/libcore/cast.rs +++ b/src/libcore/cast.rs @@ -108,8 +108,6 @@ pub unsafe fn copy_lifetime_vec<S,T>(_ptr: &a/[S], ptr: &T) -> &a/T { #[cfg(test)] pub mod tests { - use cast::{bump_box_refcount, reinterpret_cast, transmute}; - #[test] pub fn test_reinterpret_cast() { assert 1u == unsafe { reinterpret_cast(&1) }; diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 8403c621608..4fe60810dc3 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -16,7 +16,6 @@ use char; use cmp::Eq; -use option::{None, Option, Some}; use str; use u32; use uint; diff --git a/src/libcore/condition.rs b/src/libcore/condition.rs index a40121445fa..9ea48a45d3c 100644 --- a/src/libcore/condition.rs +++ b/src/libcore/condition.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::*; use task; use task::local_data::{local_data_pop, local_data_set}; diff --git a/src/libcore/core.rc b/src/libcore/core.rc index b422d76e02d..13e0e300242 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -53,9 +53,6 @@ Implicitly, all crates behave as if they included the following prologue: #[warn(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; -/* The Prelude. */ - -pub mod prelude; /* Primitive types */ @@ -246,8 +243,6 @@ pub mod core { pub use cmp; pub use condition; - pub use option; - pub use kinds; } diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 1aa6c5a0197..89789a38b24 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -22,9 +22,7 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate. #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; -use kinds::Copy; use managed; -use option::{None, Option, Some}; use option; use vec; @@ -96,13 +94,13 @@ impl<T> DListNode<T> { } /// Creates a new dlist node with the given data. -pub pure fn new_dlist_node<T>(data: T) -> DListNode<T> { +pure fn new_dlist_node<T>(data: T) -> DListNode<T> { DListNode(@{data: move data, mut linked: false, mut prev: None, mut next: None}) } /// Creates a new, empty dlist. -pub pure fn DList<T>() -> DList<T> { +pure fn DList<T>() -> DList<T> { DList_(@{mut size: 0, mut hd: None, mut tl: None}) } @@ -122,7 +120,7 @@ pub fn from_vec<T: Copy>(vec: &[T]) -> DList<T> { /// Produce a list from a list of lists, leaving no elements behind in the /// input. O(number of sub-lists). -pub fn concat<T>(lists: DList<DList<T>>) -> DList<T> { +fn concat<T>(lists: DList<DList<T>>) -> DList<T> { let result = DList(); while !lists.is_empty() { result.append(lists.pop().get()); @@ -476,9 +474,7 @@ impl<T: Copy> DList<T> { mod tests { #[legacy_exports]; - use dlist::{DList, concat, from_vec, new_dlist_node}; use iter; - use option::{None, Some}; use vec; #[test] diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 92ac1faf306..dd6b0721121 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -25,7 +25,6 @@ Note that recursive use is not permitted. use cast; use cast::reinterpret_cast; -use prelude::*; use ptr::null; use vec; diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 4902edcedb1..b2c70916a00 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -14,11 +14,10 @@ //! A type that represents one of two alternatives -use cmp::Eq; use cmp; -use kinds::Copy; -use result::Result; +use cmp::Eq; use result; +use result::Result; use vec; /// The either type diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index 474e4ae77bb..312fc18a033 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -82,7 +82,6 @@ debug!("hello, %s!", "world"); use cmp::Eq; use option::{Some, None}; -use prelude::*; use str; /* @@ -100,7 +99,6 @@ use str; #[doc(hidden)] pub mod ct { use char; - use prelude::*; use str; use vec; diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 3e521764723..34269b88748 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -31,7 +31,6 @@ use cmp; use f64; use num; use num::Num::from_int; -use option::{None, Option, Some}; use str; use uint; diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index bab0c710c3a..89f5a4eb8f0 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -42,7 +42,6 @@ with destructors. use cast; use io; use libc::{size_t, uintptr_t}; -use option::{None, Option, Some}; use ptr; use send_map::linear::LinearMap; use stackwalk; diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index 4946a0997c1..d04123fdb2b 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -21,7 +21,6 @@ use from_str::FromStr; use iter; use num; use num::Num::from_int; -use prelude::*; use str; use uint; use vec; diff --git a/src/libcore/int-template/int.rs b/src/libcore/int-template/int.rs index 224da0dc062..9e06cc95270 100644 --- a/src/libcore/int-template/int.rs +++ b/src/libcore/int-template/int.rs @@ -50,8 +50,8 @@ mod inst { #[test] fn test_overflows() { - assert (::int::max_value > 0); - assert (::int::min_value <= 0); - assert (::int::min_value + ::int::max_value + 1 == 0); + assert (max_value > 0); + assert (min_value <= 0); + assert (min_value + max_value + 1 == 0); } } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index e0065f9c1e8..ade4f9d7fc8 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -28,7 +28,6 @@ use libc::consts::os::posix88::*; use libc::consts::os::extra::*; use option; use os; -use prelude::*; use ptr; use result; use str; @@ -36,7 +35,7 @@ use uint; use vec; #[allow(non_camel_case_types)] // not sure what to do about this -pub type fd_t = c_int; +type fd_t = c_int; #[abi = "cdecl"] extern mod rustrt { @@ -453,12 +452,12 @@ impl<T: Reader, C> {base: T, cleanup: C}: Reader { fn tell(&self) -> uint { self.base.tell() } } -pub struct FILERes { +struct FILERes { f: *libc::FILE, drop { libc::fclose(self.f); } } -pub fn FILERes(f: *libc::FILE) -> FILERes { +fn FILERes(f: *libc::FILE) -> FILERes { FILERes { f: f } @@ -630,12 +629,12 @@ impl fd_t: Writer { } } -pub struct FdRes { +struct FdRes { fd: fd_t, drop { libc::close(self.fd); } } -pub fn FdRes(fd: fd_t) -> FdRes { +fn FdRes(fd: fd_t) -> FdRes { FdRes { fd: fd } @@ -1029,10 +1028,7 @@ pub fn read_whole_file(file: &Path) -> Result<~[u8], ~str> { // fsync related pub mod fsync { - use io::{FILERes, FdRes, fd_t}; - use kinds::Copy; use libc; - use option::Option; use option; use os; @@ -1117,11 +1113,8 @@ pub mod fsync { #[cfg(test)] mod tests { - use debug; use i32; - use io::{BytesWriter, SeekCur, SeekEnd, SeekSet}; use io; - use path::Path; use result; use str; use u64; diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index a139daddcef..59eb9fbae8e 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -16,10 +16,7 @@ #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; -use iter::BaseIter; use iter; -use kinds::Copy; -use option::Option; use self::inst::{IMPL_T, EACH, SIZE_HINT}; diff --git a/src/libcore/iter-trait/dlist.rs b/src/libcore/iter-trait/dlist.rs index eb395c57ae8..42ed4b5f73c 100644 --- a/src/libcore/iter-trait/dlist.rs +++ b/src/libcore/iter-trait/dlist.rs @@ -11,7 +11,6 @@ mod inst { use dlist; use managed; - use option::{Option, Some}; use option; #[allow(non_camel_case_types)] diff --git a/src/libcore/iter-trait/dvec.rs b/src/libcore/iter-trait/dvec.rs index 28d1cf03d46..f338578d143 100644 --- a/src/libcore/iter-trait/dvec.rs +++ b/src/libcore/iter-trait/dvec.rs @@ -10,7 +10,6 @@ mod inst { use dvec; - use option::{Option, Some}; #[allow(non_camel_case_types)] pub type IMPL_T<A> = dvec::DVec<A>; diff --git a/src/libcore/iter-trait/option.rs b/src/libcore/iter-trait/option.rs index 2240db82f29..a3a18a5509a 100644 --- a/src/libcore/iter-trait/option.rs +++ b/src/libcore/iter-trait/option.rs @@ -9,8 +9,6 @@ // except according to those terms. mod inst { - use option::{None, Option, Some}; - #[allow(non_camel_case_types)] pub type IMPL_T<A> = Option<A>; @@ -27,4 +25,4 @@ mod inst { Some(_) => Some(1) } } -} +} \ No newline at end of file diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 1e56b0f14af..db82fa14950 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -18,8 +18,6 @@ The iteration traits and common implementation #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; -use kinds::Copy; -use option::{None, Option, Some}; use vec; /// A function used to initialize the elements of a sequence diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs index 8e468bab15d..ae29bbe3085 100644 --- a/src/libcore/libc.rs +++ b/src/libcore/libc.rs @@ -164,7 +164,7 @@ pub use libc::funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read}; pub use libc::funcs::posix88::unistd::{rmdir, unlink, write}; -pub mod types { +mod types { // Types tend to vary *per architecture* so we pull their definitions out // into this module. @@ -230,8 +230,6 @@ pub mod types { pub type uintptr_t = uint; } pub mod posix88 { - use prelude::*; - pub type off_t = i32; pub type dev_t = u64; pub type ino_t = u32; @@ -530,6 +528,33 @@ pub mod types { pub mod os { pub mod common { pub mod posix01 { + pub type nlink_t = u16; + pub type blksize_t = i64; + pub type blkcnt_t = i32; + pub struct stat { + st_dev: dev_t, + st_mode: mode_t, + st_nlink: nlink_t, + st_ino: ino_t, + st_uid: uid_t, + st_gid: gid_t, + st_rdev: dev_t, + st_atime: time_t, + st_atime_nsec: c_long, + st_mtime: time_t, + st_mtime_nsec: c_long, + st_ctime: time_t, + st_ctime_nsec: c_long, + st_birthtime: time_t, + st_birthtime_nsec: c_long, + st_size: off_t, + st_blocks: blkcnt_t, + st_blksize: blksize_t, + st_flags: uint32_t, + st_gen: uint32_t, + st_lspare: int32_t, + st_qspare: [int64_t * 2], + } } } @@ -571,34 +596,6 @@ pub mod types { pub type ssize_t = i32; } pub mod posix01 { - pub type nlink_t = u16; - pub type blksize_t = i64; - pub type blkcnt_t = i32; - - pub struct stat { - st_dev: dev_t, - st_mode: mode_t, - st_nlink: nlink_t, - st_ino: ino_t, - st_uid: uid_t, - st_gid: gid_t, - st_rdev: dev_t, - st_atime: time_t, - st_atime_nsec: c_long, - st_mtime: time_t, - st_mtime_nsec: c_long, - st_ctime: time_t, - st_ctime_nsec: c_long, - st_birthtime: time_t, - st_birthtime_nsec: c_long, - st_size: off_t, - st_blocks: blkcnt_t, - st_blksize: blksize_t, - st_flags: uint32_t, - st_gen: uint32_t, - st_lspare: int32_t, - st_qspare: [int64_t * 2], - } } pub mod posix08 { } @@ -646,40 +643,6 @@ pub mod types { pub type ssize_t = i64; } pub mod posix01 { - use libc::types::common::c99::{int32_t, int64_t}; - use libc::types::common::c99::{uint32_t}; - use libc::types::os::arch::c95::{c_long, time_t}; - use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t}; - use libc::types::os::arch::posix88::{mode_t, off_t, uid_t}; - - pub type nlink_t = u16; - pub type blksize_t = i64; - pub type blkcnt_t = i32; - - pub struct stat { - st_dev: dev_t, - st_mode: mode_t, - st_nlink: nlink_t, - st_ino: ino_t, - st_uid: uid_t, - st_gid: gid_t, - st_rdev: dev_t, - st_atime: time_t, - st_atime_nsec: c_long, - st_mtime: time_t, - st_mtime_nsec: c_long, - st_ctime: time_t, - st_ctime_nsec: c_long, - st_birthtime: time_t, - st_birthtime_nsec: c_long, - st_size: off_t, - st_blocks: blkcnt_t, - st_blksize: blksize_t, - st_flags: uint32_t, - st_gen: uint32_t, - st_lspare: int32_t, - st_qspare: [int64_t * 2], - } } pub mod posix08 { } @@ -971,11 +934,6 @@ pub mod funcs { // or anything. The same is not true of POSIX. pub mod c95 { - use libc::types::common::c95::{FILE, c_void, fpos_t}; - use libc::types::common::posix88::dirent_t; - use libc::types::os::arch::c95::{c_char, c_double, c_int, c_long}; - use libc::types::os::arch::c95::{c_uint, c_ulong, c_void, size_t}; - #[nolink] #[abi = "cdecl"] pub extern mod ctype { @@ -1216,14 +1174,6 @@ pub mod funcs { #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] pub mod posix88 { - use libc::types::common::c95::{FILE, c_void}; - use libc::types::common::posix88::{DIR, dirent_t}; - use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint}; - use libc::types::os::arch::c95::{size_t}; - use libc::types::os::arch::posix01::stat; - use libc::types::os::arch::posix88::{gid_t, mode_t, off_t, pid_t}; - use libc::types::os::arch::posix88::{ssize_t, uid_t}; - #[nolink] #[abi = "cdecl"] pub extern mod stat_ { @@ -1332,10 +1282,6 @@ pub mod funcs { #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] pub mod posix01 { - use libc::types::os::arch::c95::{c_char, c_int, size_t}; - use libc::types::os::arch::posix01::stat; - use libc::types::os::arch::posix88::{pid_t, ssize_t}; - #[nolink] #[abi = "cdecl"] pub extern mod stat_ { @@ -1403,9 +1349,6 @@ pub mod funcs { #[nolink] #[abi = "cdecl"] pub extern mod bsd44 { - use libc::types::common::c95::{c_void}; - use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t}; - fn sysctl(name: *c_int, namelen: c_uint, oldp: *mut c_void, oldlenp: *mut size_t, newp: *c_void, newlen: size_t) -> c_int; @@ -1428,8 +1371,6 @@ pub mod funcs { #[nolink] #[abi = "cdecl"] pub extern mod extra { - use libc::types::os::arch::c95::{c_char, c_int}; - fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32) -> c_int; } diff --git a/src/libcore/managed.rs b/src/libcore/managed.rs index b334d246743..5bbb5f6bec2 100644 --- a/src/libcore/managed.rs +++ b/src/libcore/managed.rs @@ -15,12 +15,10 @@ #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; -use prelude::*; +use intrinsic::TyDesc; use ptr; pub mod raw { - use intrinsic::TyDesc; - pub struct BoxHeaderRepr { ref_count: uint, type_desc: *TyDesc, diff --git a/src/libcore/oldcomm.rs b/src/libcore/oldcomm.rs index 4425858bcff..2ce2c323cbf 100644 --- a/src/libcore/oldcomm.rs +++ b/src/libcore/oldcomm.rs @@ -52,13 +52,11 @@ use either::Either; use iter; use libc; use libc::size_t; -use prelude::*; use ptr; use result; use sys; use task; use vec; - // After snapshot, change p2::addr_of => addr_of /** diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 49ba10dfffb..a46736055a0 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -45,7 +45,6 @@ let unwrapped_msg = match move msg { #[forbid(deprecated_pattern)]; use cmp::Eq; -use kinds::Copy; use option; use ptr; use str; diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 587d684c60c..b42d6d363e3 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -38,7 +38,6 @@ use libc::{c_char, c_void, c_int, c_uint, size_t, ssize_t}; use libc::{mode_t, pid_t, FILE}; use option; use option::{Some, None}; -use prelude::*; use private; use ptr; use str; @@ -145,7 +144,6 @@ mod global_env { use either; use libc; use oldcomm; - use option::Option; use private; use str; use task; @@ -219,7 +217,6 @@ mod global_env { mod impl_ { use cast; use libc; - use option::Option; use option; use ptr; use str; @@ -783,7 +780,7 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] { * Returns a list of the command line arguments. */ #[cfg(target_os = "macos")] -pub fn real_args() -> ~[~str] { +fn real_args() -> ~[~str] { unsafe { let (argc, argv) = (*_NSGetArgc() as c_int, *_NSGetArgv() as **c_char); @@ -793,7 +790,7 @@ pub fn real_args() -> ~[~str] { #[cfg(target_os = "linux")] #[cfg(target_os = "freebsd")] -pub fn real_args() -> ~[~str] { +fn real_args() -> ~[~str] { unsafe { let argc = rustrt::rust_get_argc(); let argv = rustrt::rust_get_argv(); @@ -802,7 +799,7 @@ pub fn real_args() -> ~[~str] { } #[cfg(windows)] -pub fn real_args() -> ~[~str] { +fn real_args() -> ~[~str] { let mut nArgs: c_int = 0; let lpArgCount = ptr::to_mut_unsafe_ptr(&mut nArgs); let lpCmdLine = GetCommandLineW(); @@ -876,7 +873,7 @@ extern { pub fn _NSGetArgv() -> ***c_char; } -pub mod consts { +mod consts { #[cfg(unix)] use os::consts::unix::*; @@ -957,15 +954,9 @@ pub mod consts { #[cfg(test)] #[allow(non_implicitly_copyable_typarams)] mod tests { - use debug; - use libc::{c_int, c_void, size_t}; use libc; - use option::{None, Option, Some}; use option; - use os::{as_c_charp, env, getcwd, getenv, make_absolute, real_args}; - use os::{remove_file, setenv}; use os; - use path::Path; use rand; use run; use str; @@ -973,7 +964,7 @@ mod tests { #[test] pub fn last_os_error() { - log(debug, os::last_os_error()); + log(debug, last_os_error()); } #[test] diff --git a/src/libcore/path.rs b/src/libcore/path.rs index d1d7d00bab8..115983e5fdb 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -20,10 +20,8 @@ Cross-platform file path handling use cmp::Eq; use libc; -use option::{None, Option, Some}; use ptr; use str; -use to_str::ToStr; #[deriving_eq] pub struct WindowsPath { @@ -753,8 +751,6 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] { // Various windows helpers, and tests for the impl. pub mod windows { use libc; - use option::{None, Option, Some}; - use to_str::ToStr; #[inline(always)] pub pure fn is_sep(u: u8) -> bool { @@ -797,8 +793,7 @@ pub mod windows { #[cfg(test)] mod tests { - use option::{None, Some}; - use path::{PosixPath, WindowsPath, windows}; + use path::windows; use str; #[test] diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 260bc7e2476..a129a9f4c5a 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -90,13 +90,11 @@ bounded and unbounded protocols allows for less code duplication. use cmp::Eq; use cast::{forget, reinterpret_cast, transmute}; use either::{Either, Left, Right}; -use kinds::Owned; use libc; use option; use option::unwrap; use pipes; use ptr; -use prelude::*; use private; use task; use vec; @@ -1240,8 +1238,6 @@ pub fn try_send_one<T: Owned>(chan: ChanOne<T>, data: T) } pub mod rt { - use option::{None, Option, Some}; - // These are used to hide the option constructors from the // compiler because their names are changing pub fn make_some<T>(val: T) -> Option<T> { Some(move val) } @@ -1250,8 +1246,7 @@ pub mod rt { #[cfg(test)] pub mod test { - use either::{Either, Left, Right}; - use pipes::{Chan, Port, oneshot, recv_one, stream}; + use pipes::oneshot; use pipes; #[test] diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs deleted file mode 100644 index 3d5139a2d32..00000000000 --- a/src/libcore/prelude.rs +++ /dev/null @@ -1,93 +0,0 @@ -// This file is imported into every module by default. - -/* Reexported core operators */ - -pub use kinds::{Const, Copy, Owned, Durable}; -pub use ops::{Drop}; -pub use ops::{Add, Sub, Mul, Div, Modulo, Neg}; -pub use ops::{BitAnd, BitOr, BitXor}; -pub use ops::{Shl, Shr, Index}; -pub use option::{Option, Some, None}; -pub use result::{Result, Ok, Err}; - -/* Reexported types and traits */ - -pub use path::Path; -pub use path::GenericPath; -pub use path::WindowsPath; -pub use path::PosixPath; - -pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps}; -pub use str::{StrSlice, Trimmable}; -pub use vec::{ConstVector, CopyableVector, ImmutableVector}; -pub use vec::{ImmutableEqVector, ImmutableCopyableVector}; -pub use vec::{MutableVector, MutableCopyableVector}; -pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; -pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times}; - -pub use num::Num; -pub use ptr::Ptr; -pub use to_str::ToStr; -pub use clone::Clone; - -pub use cmp::{Eq, Ord}; -pub use hash::Hash; -pub use to_bytes::IterBytes; - -/* Reexported modules */ - -pub use at_vec; -pub use bool; -pub use cast; -pub use char; -pub use cmp; -pub use dvec; -pub use either; -pub use extfmt; -pub use f32; -pub use f64; -pub use float; -pub use i16; -pub use i32; -pub use i64; -pub use i8; -pub use int; -pub use io; -pub use iter; -pub use libc; -pub use num; -pub use oldcomm; -pub use ops; -pub use option; -pub use os; -pub use path; -pub use pipes; -pub use private; -pub use ptr; -pub use rand; -pub use result; -pub use str; -pub use sys; -pub use task; -pub use to_str; -pub use u16; -pub use u32; -pub use u64; -pub use u8; -pub use uint; -pub use vec; - -/* - * Export the log levels as global constants. Higher levels mean - * more-verbosity. Error is the bottom level, default logging level is - * warn-and-below. - */ - -/// The error log level -pub const error : u32 = 1_u32; -/// The warning log level -pub const warn : u32 = 2_u32; -/// The info log level -pub const info : u32 = 3_u32; -/// The debug log level -pub const debug : u32 = 4_u32; diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 273e933f530..efa5062ad98 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -21,7 +21,6 @@ use libc; use oldcomm; use option; use pipes; -use prelude::*; use ptr; use result; use task; @@ -581,11 +580,8 @@ pub fn unwrap_exclusive<T: Owned>(arc: Exclusive<T>) -> T { #[cfg(test)] pub mod tests { - use core::option::{None, Some}; - use option; use pipes; - use private::{exclusive, unwrap_exclusive}; use result; use task; use uint; diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index cf114f0b5bc..d816f23d4c0 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -15,7 +15,6 @@ #[forbid(deprecated_pattern)]; use int; -use prelude::*; use str; use task; use u32; @@ -363,8 +362,7 @@ pub fn random() -> uint { #[cfg(test)] pub mod tests { - use debug; - use option::{None, Option, Some}; + use option::Option; use rand; #[test] diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 91f51908be8..9e9886e66ab 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -19,8 +19,6 @@ use cmp; use cmp::Eq; use either; use either::Either; -use kinds::Copy; -use option::{None, Option, Some}; use vec; /// The result type @@ -384,7 +382,6 @@ pub pure fn unwrap_err<T, U>(res: Result<T, U>) -> U { mod tests { #[legacy_exports]; - use result::{Err, Ok, Result, chain, get, get_err}; use result; fn op1() -> result::Result<int, ~str> { result::Ok(666) } diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 60fe54109d0..b753c647627 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -20,7 +20,6 @@ use libc::{pid_t, c_void, c_int}; use oldcomm; use option::{Some, None}; use os; -use prelude::*; use ptr; use run; use str; @@ -350,7 +349,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> return {status: status, out: move outs, err: move errs}; } -pub fn writeclose(fd: c_int, s: ~str) { +fn writeclose(fd: c_int, s: ~str) { use io::WriterUtil; error!("writeclose %d, %s", fd as int, s); @@ -360,7 +359,7 @@ pub fn writeclose(fd: c_int, s: ~str) { os::close(fd); } -pub fn readclose(fd: c_int) -> ~str { +fn readclose(fd: c_int) -> ~str { let file = os::fdopen(fd); let reader = io::FILE_reader(file, false); let buf = io::with_bytes_writer(|writer| { @@ -418,11 +417,8 @@ 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}; use run; // Regression test for memory leaks diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index 4cd3502bd62..b6f237e14fb 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -20,7 +20,6 @@ Sendable hash maps. Very much a work in progress. use cmp::Eq; use hash::Hash; -use prelude::*; use to_bytes::IterBytes; pub trait SendMap<K:Eq Hash, V: Copy> { @@ -46,14 +45,9 @@ pub trait SendMap<K:Eq Hash, V: Copy> { /// Open addressing with linear probing. pub mod linear { - use cmp::Eq; use cmp; - use hash::Hash; - use kinds::Copy; - use option::{None, Option, Some}; use option; use rand; - use to_bytes::IterBytes; use uint; use vec; @@ -464,7 +458,6 @@ pub mod linear { #[test] pub mod test { - use option::{None, Some}; use send_map::linear::LinearMap; use send_map::linear; use uint; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 722d62626a6..a1595e4135e 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -27,7 +27,6 @@ use cmp::{Eq, Ord}; use libc; use libc::size_t; use io::WriterUtil; -use option::{None, Option, Some}; use ptr; use str; use to_str::ToStr; @@ -1950,7 +1949,6 @@ pub mod raw { use libc; use ptr; use str::raw; - use str::{as_buf, is_utf8, len, reserve_at_least}; use vec; /// Create a Rust string from a null-terminated *u8 buffer @@ -2131,9 +2129,6 @@ impl ~str: Trimmable { #[cfg(notest)] pub mod traits { - use ops::Add; - use str::append; - impl ~str : Add<&str,~str> { #[inline(always)] pure fn add(&self, rhs: & &self/str) -> ~str { @@ -2313,11 +2308,10 @@ impl &str: StrSlice { #[cfg(test)] mod tests { use char; - use debug; use libc::c_char; use libc; use ptr; - use str::*; + use str::raw; use vec; #[test] diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 4cefe2fea1c..d79fa3a86ff 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -146,7 +146,6 @@ pub pure fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! { #[cfg(test)] pub mod tests { use cast; - use sys::{Closure, pref_align_of, size_of}; #[test] pub fn size_of_basic() { diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index 990d309a159..0cfceb6358a 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -26,7 +26,6 @@ magic. */ -use prelude::*; use rt; use task::local_data_priv::{local_get, local_pop, local_modify, local_set}; use task; diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index c08f0f9c997..c6b3cfa6626 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -11,11 +11,9 @@ #[doc(hidden)]; // FIXME #3538 use cast; -use cmp::Eq; use dvec; use libc; use option; -use prelude::*; use task::rt; use task::local_data::LocalDataKey; diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 62d30bdc45c..245b955c871 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -48,7 +48,6 @@ use option; use result::Result; use pipes::{stream, Chan, Port}; use pipes; -use prelude::*; use ptr; use result; use task::local_data_priv::{local_get, local_set}; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 1ffd7fee6b1..a904cbec3e5 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -76,19 +76,13 @@ use cast; use oldcomm; use option; -use pipes::{Chan, Port}; use pipes; -use prelude::*; use private; use ptr; use send_map; -use task::local_data_priv::{local_get, local_set}; +use task::rt; use task::rt::rust_task; use task::rt::rust_closure; -use task::rt; -use task::{Failure, ManualThreads, PlatformThread, SchedOpts, SingleThreaded}; -use task::{Success, TaskOpts, TaskResult, ThreadPerCore, ThreadPerTask}; -use task::{default_task_opts, unkillable}; use uint; use util; diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 8f5ca4bc72a..edd69219c3f 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -20,7 +20,6 @@ The `ToBytes` and `IterBytes` traits use io; use io::Writer; -use option::{None, Option, Some}; use str; pub type Cb = fn(buf: &[const u8]) -> bool; @@ -182,8 +181,6 @@ pub mod x32 { #[cfg(target_word_size = "64")] pub mod x64 { - use to_bytes::{Cb, IterBytes}; - pub impl uint: IterBytes { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index fb4ea48ca95..963901c2c75 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -18,7 +18,6 @@ The `ToStr` trait for converting to strings #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; -use kinds::Copy; use str; use vec; diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 6ac7a1a04a3..c602c193170 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -15,7 +15,6 @@ //! Operations on tuples use cmp::{Eq, Ord}; -use kinds::Copy; use vec; pub trait CopyableTuple<T, U> { diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index ad6f73e56c0..ec280568282 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -19,7 +19,6 @@ use cmp::{Eq, Ord}; use from_str::FromStr; use iter; use num; -use option::{None, Option, Some}; use str; use uint; use vec; diff --git a/src/libcore/util.rs b/src/libcore/util.rs index 423dbaedf26..7dbc9f76f7a 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -19,7 +19,6 @@ Miscellaneous helpers for common patterns. #[forbid(deprecated_pattern)]; use cmp::Eq; -use prelude::*; /// The identity function. #[inline(always)] @@ -105,10 +104,6 @@ pub fn unreachable() -> ! { mod tests { #[legacy_exports]; - - use option::{None, Some}; - use util::{NonCopyable, id, replace, swap}; - #[test] fn identity_crisis() { // Writing a test for the identity function. How did it come to this? diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 541dcde2181..a128b45c350 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -16,12 +16,10 @@ use cast; use cmp::{Eq, Ord}; -use iter::BaseIter; use iter; -use kinds::Copy; use libc; use libc::size_t; -use option::{None, Option, Some}; +use option::{Some, None}; use ptr; use ptr::addr_of; use sys; @@ -675,7 +673,7 @@ pub pure fn append_one<T>(lhs: ~[T], x: T) -> ~[T] { } #[inline(always)] -pub pure fn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] { +pure fn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] { to_mut(append(from_mut(lhs), rhs)) } @@ -1519,10 +1517,6 @@ impl<T: Ord> @[T] : Ord { #[cfg(notest)] pub mod traits { - use kinds::Copy; - use ops::Add; - use vec::{append, append_mut}; - impl<T: Copy> ~[T] : Add<&[const T],~[T]> { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> ~[T] { @@ -1845,14 +1839,10 @@ pub struct UnboxedVecRepr { /// Unsafe operations pub mod raw { - use kinds::Copy; use managed; - use option::{None, Some}; use option; - use ptr::addr_of; use ptr; use sys; - use vec::{UnboxedVecRepr, as_const_buf, as_mut_buf, len, with_capacity}; use vec::rusti; /// The internal representation of a (boxed) vector @@ -2002,9 +1992,8 @@ pub mod raw { pub mod bytes { use libc; use uint; - use vec::len; - use vec::raw; use vec; + use vec::raw; /// Bytewise string comparison pub pure fn cmp(a: &~[u8], b: &~[u8]) -> int { @@ -2291,9 +2280,8 @@ impl<A:Copy> @[A] : iter::CopyableNonstrictIter<A> { #[cfg(test)] mod tests { - use option::{None, Option, Some}; use option; - use vec::*; + use vec::raw; fn square(n: uint) -> uint { return n * n; } |
