diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index e986b204430..a783d8e6339 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -54,7 +54,6 @@ use core::default::Default; use core::fmt; use core::hash::{mod, Hash}; use core::kinds::marker::{ContravariantLifetime, InvariantType}; -use core::kinds::Sized; use core::mem; use core::num::{Int, UnsignedInt}; use core::ops; diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 8faa9c1c522..75b7c917ced 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -21,7 +21,6 @@ use core::hash::{Hash, Writer}; use core::iter; use core::iter::{Enumerate, FilterMap, Map}; use core::mem::replace; -use core::ops::FnOnce; use {vec, slice}; use vec::Vec; diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 79e776c3308..2dc0d87c546 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -22,7 +22,7 @@ use middle::expr_use_visitor as euv; use middle::mem_categorization::cmt; use middle::pat_util::*; use middle::ty::*; -use middle::ty::{mod, Ty}; +use middle::ty; use std::fmt; use std::iter::AdditiveIterator; use std::iter::range_inclusive; diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index d033fd808aa..5d2faa52f1a 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -14,8 +14,6 @@ pub use self::MoveKind::*; use borrowck::*; -use borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend}; -use borrowck::LoanPathElem::{LpInterior}; use rustc::middle::cfg; use rustc::middle::dataflow::DataFlowContext; use rustc::middle::dataflow::BitwiseOperator; diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index 3376479b7a4..1a753901f7e 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -487,7 +487,7 @@ pub fn trans_fn_ref_with_substs<'blk, 'tcx>( let opt_ref_id = match node { ExprId(id) => if id != 0 { Some(id) } else { None }, - MethodCall(_) => None, + MethodCallKey(_) => None, }; let (val, must_cast) = @@ -498,7 +498,7 @@ pub fn trans_fn_ref_with_substs<'blk, 'tcx>( // are subst'd) let ref_ty = match node { ExprId(id) => node_id_type(bcx, id), - MethodCall(method_call) => { + MethodCallKey(method_call) => { let t = (*bcx.tcx().method_map.borrow())[method_call].ty; monomorphize_type(bcx, t) } diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs index 4dd4e27c9c0..09a4bdcefc5 100644 --- a/src/librustc_trans/trans/common.rs +++ b/src/librustc_trans/trans/common.rs @@ -867,7 +867,7 @@ pub enum ExprOrMethodCall { ExprId(ast::NodeId), // Type parameters for a method call like `a.foo::()` - MethodCall(ty::MethodCall) + MethodCallKey(ty::MethodCall) } pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, @@ -879,7 +879,7 @@ pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ExprId(id) => { ty::node_id_item_substs(tcx, id).substs } - MethodCall(method_call) => { + MethodCallKey(method_call) => { (*tcx.method_map.borrow())[method_call].substs.clone() } }; diff --git a/src/librustc_trans/trans/controlflow.rs b/src/librustc_trans/trans/controlflow.rs index a1574aa2f0e..211f8a1f420 100644 --- a/src/librustc_trans/trans/controlflow.rs +++ b/src/librustc_trans/trans/controlflow.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use llvm::*; +use llvm::ValueRef; use middle::def; use middle::lang_items::{PanicFnLangItem, PanicBoundsCheckFnLangItem}; use trans::_match; diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs index f1c3c9be396..15f6d7bc3f4 100644 --- a/src/librustc_trans/trans/meth.rs +++ b/src/librustc_trans/trans/meth.rs @@ -124,7 +124,7 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, bcx: bcx, data: Fn(callee::trans_fn_ref(bcx, did, - MethodCall(method_call))), + MethodCallKey(method_call))), } } @@ -344,12 +344,12 @@ fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // those from the impl and those from the method: let callee_substs = combine_impl_and_methods_tps( - bcx, MethodCall(method_call), vtable_impl.substs); + bcx, MethodCallKey(method_call), vtable_impl.substs); // translate the function let llfn = trans_fn_ref_with_substs(bcx, mth_id, - MethodCall(method_call), + MethodCallKey(method_call), callee_substs); Callee { bcx: bcx, data: Fn(llfn) } @@ -359,7 +359,7 @@ fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // after passing through fulfill_obligation let llfn = trans_fn_ref_with_substs(bcx, closure_def_id, - MethodCall(method_call), + MethodCallKey(method_call), substs); Callee { diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 291f384d619..e520c70824e 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -15,21 +15,10 @@ #![experimental] #![allow(missing_docs)] -use clone::Clone; -use c_str::ToCStr; -use iter::IteratorExt; +use prelude::*; use mem; -use ops::*; -use option::*; -use option::Option::{None, Some}; use os; -use path::{Path,GenericPath}; -use result::*; -use result::Result::{Err, Ok}; -use slice::{AsSlice,SliceExt}; use str; -use string::String; -use vec::Vec; #[allow(missing_copy_implementations)] pub struct DynamicLibrary { @@ -213,13 +202,10 @@ mod test { pub mod dl { pub use self::Rtld::*; - use c_str::{CString, ToCStr}; + use prelude::*; + use c_str::CString; use libc; - use ops::FnOnce; use ptr; - use result::*; - use result::Result::{Err, Ok}; - use string::String; pub unsafe fn open_external(filename: T) -> *mut u8 { filename.with_c_str(|raw_name| { diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index fa527a70f83..77500ca74d0 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -20,7 +20,6 @@ use core::str; use libc::{mod, uintptr_t}; use os; -use str::{FromStr, from_str, Str}; use sync::atomic; /// Dynamically inquire about whether we're running under V. @@ -66,7 +65,7 @@ pub fn min_stack() -> uint { pub fn default_sched_threads() -> uint { match os::getenv("RUST_THREADS") { Some(nstr) => { - let opt_n: Option = FromStr::from_str(nstr.as_slice()); + let opt_n: Option = from_str(nstr.as_slice()); match opt_n { Some(n) if n > 0 => n, _ => panic!("`RUST_THREADS` is `{}`, should be a positive integer", nstr) diff --git a/src/libstd/sys/common/mutex.rs b/src/libstd/sys/common/mutex.rs index 117d33db328..1a8a92a105a 100644 --- a/src/libstd/sys/common/mutex.rs +++ b/src/libstd/sys/common/mutex.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub use sys::mutex::raw; - use sys::mutex as imp; /// An OS-based mutual exclusion lock. diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 66f7d85f20d..98d860f9646 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -18,14 +18,11 @@ use io; use prelude::*; use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode}; -use io::{IoResult, FileStat, SeekStyle, Reader}; +use io::{IoResult, FileStat, SeekStyle}; use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; -use result::Result::{Ok, Err}; use sys::retry; use sys_common::{keep_going, eof, mkerr_libc}; -pub use path::PosixPath as Path; - pub type fd_t = libc::c_int; pub struct FileDesc { diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 0ed079df55b..6c909d7562d 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -16,8 +16,8 @@ use error::{FromError, Error}; use fmt; use io::{IoError, IoResult}; use libc::{mod, c_int, c_char, c_void}; -use path::{Path, GenericPath, BytesContainer}; -use ptr::{mod, RawPtr}; +use path::BytesContainer; +use ptr; use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst}; use sys::fs::FileDesc; use os; diff --git a/src/libstd/sys/unix/tcp.rs b/src/libstd/sys/unix/tcp.rs index 00643ac0a79..dacd754582b 100644 --- a/src/libstd/sys/unix/tcp.rs +++ b/src/libstd/sys/unix/tcp.rs @@ -20,7 +20,7 @@ use sys::fs::FileDesc; use sys::{set_nonblocking, wouldblock}; use sys; use sys_common; -use sys_common::net::*; +use sys_common::net; pub use sys_common::net::TcpStream; @@ -34,17 +34,19 @@ pub struct TcpListener { impl TcpListener { pub fn bind(addr: ip::SocketAddr) -> IoResult { - let fd = try!(socket(addr, libc::SOCK_STREAM)); + let fd = try!(net::socket(addr, libc::SOCK_STREAM)); let ret = TcpListener { inner: FileDesc::new(fd, true) }; let mut storage = unsafe { mem::zeroed() }; - let len = addr_to_sockaddr(addr, &mut storage); + let len = net::addr_to_sockaddr(addr, &mut storage); let addrp = &storage as *const _ as *const libc::sockaddr; // On platforms with Berkeley-derived sockets, this allows // to quickly rebind a socket, without needing to wait for // the OS to clean up the previous one. - try!(setsockopt(fd, libc::SOL_SOCKET, libc::SO_REUSEADDR, 1 as libc::c_int)); + try!(net::setsockopt(fd, libc::SOL_SOCKET, + libc::SO_REUSEADDR, + 1 as libc::c_int)); match unsafe { libc::bind(fd, addrp, len) } { @@ -77,7 +79,7 @@ impl TcpListener { } pub fn socket_name(&mut self) -> IoResult { - sockname(self.fd(), libc::getsockname) + net::sockname(self.fd(), libc::getsockname) } } @@ -121,15 +123,15 @@ impl TcpAcceptor { -1 => return Err(last_net_error()), fd => return Ok(TcpStream::new(fd as sock_t)), } - try!(await(&[self.fd(), self.inner.reader.fd()], - deadline, Readable)); + try!(net::await(&[self.fd(), self.inner.reader.fd()], + deadline, net::Readable)); } Err(sys_common::eof()) } pub fn socket_name(&mut self) -> IoResult { - sockname(self.fd(), libc::getsockname) + net::sockname(self.fd(), libc::getsockname) } pub fn set_timeout(&mut self, timeout: Option) { diff --git a/src/libstd/sys/windows/condvar.rs b/src/libstd/sys/windows/condvar.rs index 3cabf3a6319..7f9d669c447 100644 --- a/src/libstd/sys/windows/condvar.rs +++ b/src/libstd/sys/windows/condvar.rs @@ -10,7 +10,6 @@ use cell::UnsafeCell; use libc::{mod, DWORD}; -use libc; use os; use sys::mutex::{mod, Mutex}; use sys::sync as ffi; diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 0fb52c758d5..d5bf8c5b629 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -26,10 +26,9 @@ use sys; use sys_common::{keep_going, eof, mkerr_libc}; use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode}; -use io::{IoResult, IoError, FileStat, SeekStyle, Seek, Writer, Reader}; +use io::{IoResult, IoError, FileStat, SeekStyle}; use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; -pub use path::WindowsPath as Path; pub type fd_t = libc::c_int; pub struct FileDesc { diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 2fbb9494c71..e2220b7b67b 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -20,12 +20,10 @@ use io::{IoResult, IoError}; use libc::{c_int, c_char, c_void}; use libc; use os; -use path::{Path, GenericPath, BytesContainer}; -use ptr::{mod, RawPtr}; +use path::BytesContainer; +use ptr; use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst}; use sys::fs::FileDesc; -use option::Option; -use option::Option::{Some, None}; use slice; use os::TMPBUF_SZ; diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index bbfd32ee76b..8945c155e66 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -29,7 +29,6 @@ use sys_common::helper_thread::Helper; use sys_common::{AsInner, mkerr_libc, timeout}; use io::fs::PathExtensions; -use string::String; pub use sys_common::ProcessConfig; diff --git a/src/libstd/sys/windows/tcp.rs b/src/libstd/sys/windows/tcp.rs index b577372d2fc..505e6137bf9 100644 --- a/src/libstd/sys/windows/tcp.rs +++ b/src/libstd/sys/windows/tcp.rs @@ -18,8 +18,7 @@ use super::{last_error, last_net_error, retry, sock_t}; use sync::{Arc, atomic}; use sys::fs::FileDesc; use sys::{mod, c, set_nonblocking, wouldblock, timer}; -use sys_common::{mod, timeout, eof}; -use sys_common::net::*; +use sys_common::{mod, timeout, eof, net}; pub use sys_common::net::TcpStream; @@ -54,11 +53,11 @@ impl TcpListener { pub fn bind(addr: ip::SocketAddr) -> IoResult { sys::init_net(); - let sock = try!(socket(addr, libc::SOCK_STREAM)); + let sock = try!(net::socket(addr, libc::SOCK_STREAM)); let ret = TcpListener { sock: sock }; let mut storage = unsafe { mem::zeroed() }; - let len = addr_to_sockaddr(addr, &mut storage); + let len = net::addr_to_sockaddr(addr, &mut storage); let addrp = &storage as *const _ as *const libc::sockaddr; match unsafe { libc::bind(sock, addrp, len) } { @@ -95,7 +94,7 @@ impl TcpListener { } pub fn socket_name(&mut self) -> IoResult { - sockname(self.socket(), libc::getsockname) + net::sockname(self.socket(), libc::getsockname) } } @@ -195,7 +194,7 @@ impl TcpAcceptor { } pub fn socket_name(&mut self) -> IoResult { - sockname(self.socket(), libc::getsockname) + net::sockname(self.socket(), libc::getsockname) } pub fn set_timeout(&mut self, timeout: Option) { diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index 8ef53a22aeb..ff9ee01b40a 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -124,13 +124,17 @@ //! //! * It can be implemented highly efficiently on many platforms. -use core::prelude::*; - use any::Any; use borrow::IntoCow; use boxed::Box; use cell::UnsafeCell; +use clone::Clone; +use kinds::Send; +use ops::{Drop, FnOnce}; +use option::Option::{mod, Some, None}; +use result::Result::{Err, Ok}; use sync::{Mutex, Condvar, Arc}; +use str::Str; use string::String; use rt::{mod, unwind}; use io::{Writer, stdio};