diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-17 13:33:26 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-20 20:07:19 -0700 |
| commit | 212e03181e422f569b6426bc08b713a9efc0d0eb (patch) | |
| tree | 4ab0963cf9b9a231d092636782703117c8c3fc6d /src/libstd | |
| parent | 68d69415637186755482d2584e6ba82b67bc1d89 (diff) | |
| download | rust-212e03181e422f569b6426bc08b713a9efc0d0eb.tar.gz rust-212e03181e422f569b6426bc08b713a9efc0d0eb.zip | |
std: Remove old_io/old_path from the prelude
This commit removes the reexports of `old_io` traits as well as `old_path` types and traits from the prelude. This functionality is now all deprecated and needs to be removed to make way for other functionality like `Seek` in the `std::io` module (currently reexported as `NewSeek` in the io prelude). Closes #23377 Closes #23378
Diffstat (limited to 'src/libstd')
33 files changed, 168 insertions, 98 deletions
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index a42809127bf..085bf01612d 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -18,11 +18,12 @@ use prelude::v1::*; +use env; use ffi::CString; use mem; -use env; -use str; +use old_path::{Path, GenericPath}; use os; +use str; pub struct DynamicLibrary { handle: *mut u8 @@ -133,6 +134,7 @@ mod test { use super::*; use prelude::v1::*; use libc; + use old_path::Path; use mem; #[test] @@ -140,8 +142,7 @@ mod test { fn test_loading_cosine() { // The math library does not need to be loaded since it is already // statically linked in - let none: Option<&Path> = None; // appease the typechecker - let libm = match DynamicLibrary::open(none) { + let libm = match DynamicLibrary::open(None) { Err(error) => panic!("Could not load self as module: {}", error), Ok(libm) => libm }; diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 4b6fbe01f76..24882c7f7ab 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -729,10 +729,11 @@ mod arch { mod tests { use prelude::v1::*; use super::*; + use iter::repeat; use rand::{self, Rng}; use ffi::{OsString, OsStr}; - use path::PathBuf; + use path::{Path, PathBuf}; fn make_rand_name() -> OsString { let mut rng = rand::thread_rng(); diff --git a/src/libstd/fs/mod.rs b/src/libstd/fs/mod.rs index c56852cb18a..bb63bcb86bc 100644 --- a/src/libstd/fs/mod.rs +++ b/src/libstd/fs/mod.rs @@ -801,6 +801,7 @@ mod tests { use prelude::v1::*; use io::prelude::*; + use env; use fs::{self, File, OpenOptions}; use io::{ErrorKind, SeekFrom}; use path::PathBuf; @@ -848,8 +849,7 @@ mod tests { } pub fn tmpdir() -> TempDir { - let s = os::tmpdir(); - let p = Path2::new(s.as_str().unwrap()); + let p = env::temp_dir(); let ret = p.join(&format!("rust-{}", rand::random::<u32>())); check!(fs::create_dir(&ret)); TempDir(ret) @@ -1082,7 +1082,7 @@ mod tests { let dir = &tmpdir.join("di_readdir"); check!(fs::create_dir(dir)); let prefix = "foo"; - for n in range(0, 3) { + for n in 0..3 { let f = dir.join(&format!("{}.txt", n)); let mut w = check!(File::create(&f)); let msg_str = format!("{}{}", prefix, n.to_string()); diff --git a/src/libstd/io/prelude.rs b/src/libstd/io/prelude.rs index 6bf0ebd1a59..a2ceacbe1f8 100644 --- a/src/libstd/io/prelude.rs +++ b/src/libstd/io/prelude.rs @@ -23,8 +23,5 @@ #![stable(feature = "rust1", since = "1.0.0")] -pub use super::{Read, Write, BufRead}; +pub use super::{Read, Write, BufRead, Seek}; pub use fs::PathExt; - -// FIXME: pub use as `Seek` when the name isn't in the actual prelude any more -pub use super::Seek as NewSeek; diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 082dad613b5..562094a87f4 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -1650,7 +1650,7 @@ mod tests { #![test] assert_eq!((0 as $T).next_power_of_two(), 1); let mut next_power = 1; - for i in range::<$T>(1, 40) { + for i in 1 as $T..40 { assert_eq!(i.next_power_of_two(), next_power); if i == next_power { next_power *= 2 } } @@ -1673,7 +1673,7 @@ mod tests { assert_eq!(($T::MAX - 1).checked_next_power_of_two(), None); assert_eq!($T::MAX.checked_next_power_of_two(), None); let mut next_power = 1; - for i in range::<$T>(1, 40) { + for i in 1 as $T..40 { assert_eq!(i.checked_next_power_of_two(), Some(next_power)); if i == next_power { next_power *= 2 } } diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs index 56bc21303bb..3e5f732e345 100644 --- a/src/libstd/old_io/buffered.rs +++ b/src/libstd/old_io/buffered.rs @@ -33,7 +33,8 @@ use vec::Vec; /// # Examples /// /// ``` -/// use std::old_io::{BufferedReader, File}; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// let file = File::open(&Path::new("message.txt")); /// let mut reader = BufferedReader::new(file); @@ -136,7 +137,8 @@ impl<R: Reader> Reader for BufferedReader<R> { /// # Examples /// /// ``` -/// use std::old_io::{BufferedWriter, File}; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// let file = File::create(&Path::new("message.txt")).unwrap(); /// let mut writer = BufferedWriter::new(file); @@ -323,7 +325,8 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::{BufferedStream, File}; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// let file = File::open(&Path::new("message.txt")); /// let mut stream = BufferedStream::new(file); @@ -422,7 +425,7 @@ impl<S: Stream> Writer for BufferedStream<S> { #[cfg(test)] mod test { extern crate test; - use old_io; + use old_io::{self, Reader, Writer, Buffer, BufferPrelude}; use prelude::v1::*; use super::*; use super::super::{IoResult, EndOfFile}; diff --git a/src/libstd/old_io/comm_adapters.rs b/src/libstd/old_io/comm_adapters.rs index 2dc61f409e2..7e62a21f105 100644 --- a/src/libstd/old_io/comm_adapters.rs +++ b/src/libstd/old_io/comm_adapters.rs @@ -24,7 +24,7 @@ use vec::Vec; /// /// ``` /// use std::sync::mpsc::channel; -/// use std::old_io::ChanReader; +/// use std::old_io::*; /// /// let (tx, rx) = channel(); /// # drop(tx); @@ -116,7 +116,7 @@ impl Reader for ChanReader { /// ``` /// # #![allow(unused_must_use)] /// use std::sync::mpsc::channel; -/// use std::old_io::ChanWriter; +/// use std::old_io::*; /// /// let (tx, rx) = channel(); /// # drop(rx); @@ -160,7 +160,7 @@ mod test { use sync::mpsc::channel; use super::*; - use old_io; + use old_io::{self, Reader, Writer, Buffer}; use thread; #[test] diff --git a/src/libstd/old_io/extensions.rs b/src/libstd/old_io/extensions.rs index 12c9970aa84..2990c1c265d 100644 --- a/src/libstd/old_io/extensions.rs +++ b/src/libstd/old_io/extensions.rs @@ -179,7 +179,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 { #[cfg(test)] mod test { use prelude::v1::*; - use old_io; + use old_io::{self, Reader, Writer}; use old_io::{MemReader, BytesReader}; struct InitialZeroByteReader { diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index 2df925beb36..008db49dadf 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -32,7 +32,8 @@ //! ```rust //! # #![allow(unused_must_use)] //! use std::old_io::fs::PathExtensions; -//! use std::old_io::{File, fs}; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let path = Path::new("foo.txt"); //! @@ -104,7 +105,8 @@ impl File { /// # Examples /// /// ```rust,should_fail - /// use std::old_io::{File, Open, ReadWrite}; + /// use std::old_io::*; + /// use std::old_path::Path; /// /// let p = Path::new("/some/file/path.txt"); /// @@ -175,7 +177,8 @@ impl File { /// # Examples /// /// ``` - /// use std::old_io::File; + /// use std::old_io::*; + /// use std::old_path::Path; /// /// let contents = File::open(&Path::new("foo.txt")).read_to_end(); /// ``` @@ -195,7 +198,8 @@ impl File { /// /// ``` /// # #![allow(unused_must_use)] - /// use std::old_io::File; + /// use std::old_io::*; + /// use std::old_path::Path; /// /// let mut f = File::create(&Path::new("foo.txt")); /// f.write(b"This is a sample file"); @@ -286,7 +290,8 @@ impl File { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::fs; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// let p = Path::new("/some/file/path.txt"); /// fs::unlink(&p); @@ -316,7 +321,8 @@ pub fn unlink(path: &Path) -> IoResult<()> { /// # Examples /// /// ``` -/// use std::old_io::fs; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// let p = Path::new("/some/file/path.txt"); /// match fs::stat(&p) { @@ -359,7 +365,8 @@ pub fn lstat(path: &Path) -> IoResult<FileStat> { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::fs; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// fs::rename(&Path::new("foo"), &Path::new("bar")); /// ``` @@ -387,7 +394,8 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::fs; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// fs::copy(&Path::new("foo.txt"), &Path::new("bar.txt")); /// ``` @@ -438,7 +446,8 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> { /// ``` /// # #![allow(unused_must_use)] /// use std::old_io; -/// use std::old_io::fs; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// fs::chmod(&Path::new("file.txt"), old_io::USER_FILE); /// fs::chmod(&Path::new("file.txt"), old_io::USER_READ | old_io::USER_WRITE); @@ -509,7 +518,8 @@ pub fn readlink(path: &Path) -> IoResult<Path> { /// ``` /// # #![allow(unused_must_use)] /// use std::old_io; -/// use std::old_io::fs; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// let p = Path::new("/some/dir"); /// fs::mkdir(&p, old_io::USER_RWX); @@ -532,7 +542,8 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::fs; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// let p = Path::new("/some/dir"); /// fs::rmdir(&p); @@ -556,8 +567,9 @@ pub fn rmdir(path: &Path) -> IoResult<()> { /// /// ``` /// use std::old_io::fs::PathExtensions; -/// use std::old_io::fs; /// use std::old_io; +/// use std::old_io::*; +/// use std::old_path::Path; /// /// // one possible implementation of fs::walk_dir only visiting files /// fn visit_dirs<F>(dir: &Path, cb: &mut F) -> old_io::IoResult<()> where @@ -881,7 +893,8 @@ fn access_string(access: FileAccess) -> &'static str { mod test { use prelude::v1::*; use old_io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType}; - use old_io; + use old_io::{self, Reader, Writer, Seek}; + use old_path::{Path, GenericPath}; use str; use old_io::fs::*; diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index eb7691361d4..1acc6abc850 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -55,7 +55,7 @@ impl Writer for Vec<u8> { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::MemWriter; +/// use std::old_io::*; /// /// let mut w = MemWriter::new(); /// w.write(&[0, 1, 2]); @@ -115,7 +115,7 @@ impl Writer for MemWriter { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::MemReader; +/// use std::old_io::*; /// /// let mut r = MemReader::new(vec!(0, 1, 2)); /// @@ -245,7 +245,7 @@ impl<'a> Buffer for &'a [u8] { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::BufWriter; +/// use std::old_io::*; /// /// let mut buf = [0; 4]; /// { @@ -317,7 +317,7 @@ impl<'a> Seek for BufWriter<'a> { /// /// ``` /// # #![allow(unused_must_use)] -/// use std::old_io::BufReader; +/// use std::old_io::*; /// /// let buf = [0, 1, 2, 3]; /// let mut r = BufReader::new(&buf); @@ -394,8 +394,8 @@ impl<'a> Buffer for BufReader<'a> { #[cfg(test)] mod test { extern crate "test" as test_crate; - use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek}; - use prelude::v1::{Ok, Err, range, Vec, Buffer, AsSlice}; + use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek, Buffer}; + use prelude::v1::{Ok, Err, Vec, AsSlice}; use prelude::v1::IteratorExt; use old_io; use iter::repeat; diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index 6b6c36a31ec..6dfb54fd66c 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -49,6 +49,7 @@ //! //! ```rust //! use std::old_io as io; +//! use std::old_io::*; //! //! let mut stdin = io::stdin(); //! for line in stdin.lock().lines() { @@ -59,7 +60,8 @@ //! * Read a complete file //! //! ```rust -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let contents = File::open(&Path::new("message.txt")).read_to_end(); //! ``` @@ -68,7 +70,8 @@ //! //! ```rust //! # #![allow(unused_must_use)] -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let mut file = File::create(&Path::new("message.txt")); //! file.write_all(b"hello, file!\n"); @@ -79,8 +82,8 @@ //! * Iterate over the lines of a file //! //! ```rust,no_run -//! use std::old_io::BufferedReader; -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let path = Path::new("message.txt"); //! let mut file = BufferedReader::new(File::open(&path)); @@ -92,8 +95,8 @@ //! * Pull the lines of a file into a vector of strings //! //! ```rust,no_run -//! use std::old_io::BufferedReader; -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let path = Path::new("message.txt"); //! let mut file = BufferedReader::new(File::open(&path)); @@ -104,7 +107,7 @@ //! //! ```rust //! # #![allow(unused_must_use)] -//! use std::old_io::TcpStream; +//! use std::old_io::*; //! //! # // connection doesn't fail if a server is running on 8080 //! # // locally, we still want to be type checking this code, so lets @@ -122,8 +125,7 @@ //! # fn main() { } //! # fn foo() { //! # #![allow(dead_code)] -//! use std::old_io::{TcpListener, TcpStream}; -//! use std::old_io::{Acceptor, Listener}; +//! use std::old_io::*; //! use std::thread; //! //! let listener = TcpListener::bind("127.0.0.1:80"); @@ -185,7 +187,8 @@ //! //! ```rust //! # #![allow(unused_must_use)] -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! match File::create(&Path::new("diary.txt")).write_all(b"Met a girl.\n") { //! Ok(()) => (), // succeeded @@ -218,7 +221,8 @@ //! If you wanted to read several `u32`s from a file and return their product: //! //! ```rust -//! use std::old_io::{File, IoResult}; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! fn file_product(p: &Path) -> IoResult<u32> { //! let mut f = File::open(p); @@ -945,7 +949,7 @@ unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) - /// /// ``` /// use std::old_io as io; -/// use std::old_io::ByRefReader; +/// use std::old_io::*; /// use std::old_io::util::LimitReader; /// /// fn process_input<R: Reader>(r: R) {} @@ -1279,7 +1283,7 @@ impl<'a> Writer for &'a mut (Writer+'a) { /// /// ``` /// use std::old_io::util::TeeReader; -/// use std::old_io::{stdin, ByRefWriter}; +/// use std::old_io::*; /// /// fn process_input<R: Reader>(r: R) {} /// @@ -1403,7 +1407,7 @@ pub trait Buffer: Reader { /// # Examples /// /// ``` - /// use std::old_io::BufReader; + /// use std::old_io::*; /// /// let mut reader = BufReader::new(b"hello\nworld"); /// assert_eq!("hello\n", &*reader.read_line().unwrap()); @@ -1717,6 +1721,7 @@ pub enum FileType { /// ```no_run /// /// use std::old_io::fs::PathExtensions; +/// use std::old_path::Path; /// /// let info = match Path::new("foo.txt").stat() { /// Ok(stat) => stat, @@ -1845,7 +1850,8 @@ impl fmt::Display for FilePermission { mod tests { use self::BadReaderBehavior::*; use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput, Writer}; - use prelude::v1::{Ok, Vec, Buffer}; + use super::Buffer; + use prelude::v1::{Ok, Vec}; use usize; #[derive(Clone, PartialEq, Debug)] diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs index ad0e7a7284d..77efedbc327 100644 --- a/src/libstd/old_io/net/pipe.rs +++ b/src/libstd/old_io/net/pipe.rs @@ -31,6 +31,7 @@ use prelude::v1::*; use ffi::CString; use old_path::BytesContainer; use old_io::{Listener, Acceptor, IoResult, TimedOut, standard_error}; +use old_io::{Reader, Writer}; use sys::pipe::UnixAcceptor as UnixAcceptorImp; use sys::pipe::UnixListener as UnixListenerImp; use sys::pipe::UnixStream as UnixStreamImp; @@ -55,6 +56,8 @@ impl UnixStream { /// ``` /// # #![allow(unused_must_use)] /// use std::old_io::net::pipe::UnixStream; + /// use std::old_io::*; + /// use std::old_path::Path; /// /// let server = Path::new("path/to/my/socket"); /// let mut stream = UnixStream::connect(&server); @@ -180,7 +183,8 @@ impl UnixListener { /// ``` /// # fn foo() { /// use std::old_io::net::pipe::UnixListener; - /// use std::old_io::{Listener, Acceptor}; + /// use std::old_io::*; + /// use std::old_path::Path; /// /// let server = Path::new("/path/to/my/socket"); /// let stream = UnixListener::bind(&server); @@ -285,6 +289,7 @@ mod tests { use old_io::{EndOfFile, TimedOut, ShortWrite, IoError, ConnectionReset}; use old_io::{NotConnected, BrokenPipe, FileNotFound, InvalidInput, OtherIoError}; use old_io::{PermissionDenied, Acceptor, Listener}; + use old_io::{Reader, Writer}; use old_io::test::*; use super::*; use sync::mpsc::channel; diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs index 6fb8020a3d6..dbf3c4a4b1e 100644 --- a/src/libstd/old_io/net/tcp.rs +++ b/src/libstd/old_io/net/tcp.rs @@ -41,7 +41,7 @@ use sys_common; /// # Examples /// /// ```no_run -/// use std::old_io::TcpStream; +/// use std::old_io::*; /// /// { /// let mut stream = TcpStream::connect("127.0.0.1:34254"); @@ -134,8 +134,7 @@ impl TcpStream { /// /// ```no_run /// # #![allow(unused_must_use)] - /// use std::old_io::timer; - /// use std::old_io::TcpStream; + /// use std::old_io::*; /// use std::time::Duration; /// use std::thread; /// @@ -280,8 +279,7 @@ impl sys_common::AsInner<TcpStreamImp> for TcpStream { /// /// ``` /// # fn foo() { -/// use std::old_io::{TcpListener, TcpStream}; -/// use std::old_io::{Acceptor, Listener}; +/// use std::old_io::*; /// use std::thread; /// /// let listener = TcpListener::bind("127.0.0.1:80").unwrap(); @@ -376,8 +374,7 @@ impl TcpAcceptor { /// # Examples /// /// ```no_run - /// use std::old_io::TcpListener; - /// use std::old_io::{Listener, Acceptor, TimedOut}; + /// use std::old_io::*; /// /// let mut a = TcpListener::bind("127.0.0.1:8482").listen().unwrap(); /// @@ -420,7 +417,7 @@ impl TcpAcceptor { /// # Examples /// /// ``` - /// use std::old_io::{TcpListener, Listener, Acceptor, EndOfFile}; + /// use std::old_io::*; /// use std::thread; /// /// let mut a = TcpListener::bind("127.0.0.1:8482").listen().unwrap(); @@ -496,6 +493,7 @@ mod test { use old_io::{ConnectionReset, NotConnected, PermissionDenied, OtherIoError}; use old_io::{InvalidInput}; use old_io::{Acceptor, Listener}; + use old_io::{Reader, Writer}; // FIXME #11530 this fails on android because tests are run as root #[cfg_attr(any(windows, target_os = "android"), ignore)] diff --git a/src/libstd/old_io/pipe.rs b/src/libstd/old_io/pipe.rs index b78c8acb190..b2b28453c89 100644 --- a/src/libstd/old_io/pipe.rs +++ b/src/libstd/old_io/pipe.rs @@ -17,7 +17,7 @@ use prelude::v1::*; -use old_io::IoResult; +use old_io::{IoResult, Reader, Writer}; use libc; use sync::Arc; @@ -49,7 +49,7 @@ impl PipeStream { /// # #![allow(unused_must_use)] /// extern crate libc; /// - /// use std::old_io::pipe::PipeStream; + /// use std::old_io::*; /// /// fn main() { /// let mut pipe = PipeStream::open(libc::STDERR_FILENO); @@ -114,6 +114,7 @@ impl Writer for PipeStream { mod test { use prelude::v1::*; + use old_io::{Writer, Reader}; use sync::mpsc::channel; use thread; diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index 53b126ec000..54fd20f45e2 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -24,8 +24,9 @@ use collections::HashMap; use ffi::CString; use fmt; use old_io::pipe::{PipeStream, PipePair}; -use old_io::{IoResult, IoError}; +use old_io::{IoResult, IoError, Reader, Writer}; use old_io; +use old_path::{Path, GenericPath}; use libc; use os; use old_path::BytesContainer; @@ -60,7 +61,7 @@ use thread; /// # Examples /// /// ```should_fail -/// use std::old_io::Command; +/// use std::old_io::*; /// /// let mut child = match Command::new("/bin/cat").arg("file.txt").spawn() { /// Ok(child) => child, @@ -163,7 +164,7 @@ pub type EnvMap = HashMap<EnvKey, CString>; /// to be changed (for example, by adding arguments) prior to spawning: /// /// ``` -/// use std::old_io::Command; +/// use std::old_io::*; /// /// let mut process = match Command::new("sh").arg("-c").arg("echo hello").spawn() { /// Ok(p) => p, @@ -759,9 +760,11 @@ impl Drop for Process { #[cfg(test)] mod tests { use old_io::{Truncate, Write, TimedOut, timer, process, FileNotFound}; - use prelude::v1::{Ok, Err, range, drop, Some, None, Vec}; - use prelude::v1::{Path, String, Reader, Writer, Clone}; - use prelude::v1::{Str, AsSlice, ToString, GenericPath}; + use old_io::{Reader, Writer}; + use prelude::v1::{Ok, Err, drop, Some, None, Vec}; + use prelude::v1::{String, Clone}; + use prelude::v1::{Str, AsSlice, ToString}; + use old_path::{GenericPath, Path}; use old_io::fs::PathExtensions; use old_io::timer::*; use rt::running_on_valgrind; diff --git a/src/libstd/old_io/result.rs b/src/libstd/old_io/result.rs index cdf2bae1cba..9dcb487cdb0 100644 --- a/src/libstd/old_io/result.rs +++ b/src/libstd/old_io/result.rs @@ -80,7 +80,7 @@ impl<T, A: Acceptor<T>> Acceptor<T> for IoResult<A> { mod test { use prelude::v1::*; use super::super::mem::*; - use old_io; + use old_io::{self, Reader, Writer}; #[test] fn test_option_writer() { diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs index 4ca40382375..a1c8630e0ec 100644 --- a/src/libstd/old_io/stdio.rs +++ b/src/libstd/old_io/stdio.rs @@ -20,6 +20,7 @@ //! ```rust //! # #![allow(unused_must_use)] //! use std::old_io; +//! use std::old_io::*; //! //! let mut out = old_io::stdout(); //! out.write_all(b"Hello, world!"); @@ -140,6 +141,7 @@ impl StdinReader { /// /// ``` /// use std::old_io; + /// use std::old_io::*; /// /// let mut stdin = old_io::stdin(); /// for line in stdin.lock().lines() { diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs index 04bfd4409cf..90b3d1004c0 100644 --- a/src/libstd/old_io/tempfile.rs +++ b/src/libstd/old_io/tempfile.rs @@ -29,7 +29,8 @@ use string::String; /// # Examples /// /// ```no_run -/// use std::old_io::TempDir; +/// use std::old_io::*; +/// use std::old_path::{Path, GenericPath}; /// /// { /// // create a temporary directory diff --git a/src/libstd/old_io/test.rs b/src/libstd/old_io/test.rs index 9fbdac84a80..db409ecde45 100644 --- a/src/libstd/old_io/test.rs +++ b/src/libstd/old_io/test.rs @@ -14,7 +14,8 @@ use prelude::v1::*; use env; use libc; -use std::old_io::net::ip::*; +use old_io::net::ip::*; +use old_path::{Path, GenericPath}; use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; /// Get a port number, starting at 9600, for use in tests diff --git a/src/libstd/old_io/util.rs b/src/libstd/old_io/util.rs index 413184c84d2..1f782b6f221 100644 --- a/src/libstd/old_io/util.rs +++ b/src/libstd/old_io/util.rs @@ -14,7 +14,7 @@ use prelude::v1::*; use cmp; -use old_io; +use old_io::{self, Reader, Writer, Buffer}; use slice::bytes::MutableByteVector; /// Wraps a `Reader`, limiting the number of bytes that can be read from it. @@ -325,7 +325,7 @@ impl<T: Iterator<Item=u8>> Reader for IterReader<T> { mod test { use prelude::v1::*; - use old_io::{MemReader, ByRefReader}; + use old_io::{MemReader, ByRefReader, Reader, Writer, Buffer}; use old_io; use super::*; diff --git a/src/libstd/old_path/mod.rs b/src/libstd/old_path/mod.rs index fd117838f2f..909fa4062b6 100644 --- a/src/libstd/old_path/mod.rs +++ b/src/libstd/old_path/mod.rs @@ -50,6 +50,7 @@ //! //! ```rust //! use std::old_io::fs::PathExtensions; +//! use std::old_path::{Path, GenericPath}; //! //! let mut path = Path::new("/tmp/path"); //! println!("path: {}", path.display()); @@ -142,6 +143,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -166,6 +168,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -188,6 +191,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -205,6 +209,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -219,6 +224,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -234,6 +240,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -252,6 +259,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -269,6 +277,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -284,6 +293,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -303,6 +313,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -318,6 +329,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -337,6 +349,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -364,6 +377,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -384,6 +398,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -411,6 +426,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -429,6 +445,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -455,6 +472,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -505,6 +523,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -530,6 +549,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -554,6 +574,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -573,6 +594,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -588,6 +610,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -612,6 +635,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -641,6 +665,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -658,6 +683,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -683,6 +709,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -705,6 +732,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -722,6 +750,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -740,6 +769,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -759,6 +789,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { @@ -775,6 +806,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { diff --git a/src/libstd/old_path/posix.rs b/src/libstd/old_path/posix.rs index 4f28e9e44f1..0ab8612a7cb 100644 --- a/src/libstd/old_path/posix.rs +++ b/src/libstd/old_path/posix.rs @@ -1224,7 +1224,8 @@ mod bench { extern crate test; use self::test::Bencher; use super::*; - use prelude::v1::{Clone, GenericPath}; + use old_path::GenericPath; + use prelude::v1::Clone; #[bench] fn join_home_dir(b: &mut Bencher) { diff --git a/src/libstd/old_path/windows.rs b/src/libstd/old_path/windows.rs index ef873265b7b..cea2c238ece 100644 --- a/src/libstd/old_path/windows.rs +++ b/src/libstd/old_path/windows.rs @@ -605,6 +605,7 @@ impl Path { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// println!("{}", Path::new(r"C:\some\path").display()); /// ``` #[inline] @@ -619,6 +620,7 @@ impl Path { /// # Examples /// /// ``` + /// use std::old_path::{Path, GenericPath}; /// let path = Path::new_opt(r"C:\some\path"); /// /// match path { diff --git a/src/libstd/os.rs b/src/libstd/os.rs index a1a3afca7a9..3870b8614ff 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -126,6 +126,7 @@ pub const TMPBUF_SZ : uint = 1000; /// /// ``` /// use std::os; +/// use std::old_path::{Path, GenericPath}; /// /// // We assume that we are in a valid directory. /// let current_working_directory = os::getcwd().unwrap(); @@ -265,6 +266,7 @@ pub fn unsetenv(n: &str) { /// /// ``` /// use std::os; +/// use std::old_path::{Path, GenericPath}; /// /// let key = "PATH"; /// match os::getenv_as_bytes(key) { @@ -358,6 +360,7 @@ pub fn dll_filename(base: &str) -> String { /// /// ``` /// use std::os; +/// use std::old_path::{Path, GenericPath}; /// /// match os::self_exe_name() { /// Some(exe_path) => println!("Path of this executable is: {}", exe_path.display()), @@ -378,6 +381,7 @@ pub fn self_exe_name() -> Option<Path> { /// /// ``` /// use std::os; +/// use std::old_path::{Path, GenericPath}; /// /// match os::self_exe_path() { /// Some(exe_path) => println!("Executable's Path is: {}", exe_path.display()), @@ -407,6 +411,7 @@ pub fn self_exe_path() -> Option<Path> { /// /// ``` /// use std::os; +/// use std::old_path::{Path, GenericPath}; /// /// match os::homedir() { /// Some(ref p) => println!("{}", p.display()), @@ -497,7 +502,7 @@ pub fn tmpdir() -> Path { /// /// ``` /// use std::os; -/// use std::old_path::Path; +/// use std::old_path::{Path, GenericPath}; /// /// // Assume we're in a path like /home/someuser /// let rel_path = Path::new(".."); @@ -529,7 +534,7 @@ pub fn make_absolute(p: &Path) -> IoResult<Path> { /// /// ``` /// use std::os; -/// use std::old_path::Path; +/// use std::old_path::{Path, GenericPath}; /// /// let root = Path::new("/"); /// assert!(os::change_dir(&root).is_ok()); @@ -1496,6 +1501,8 @@ mod tests { use os; use rand::Rng; use rand; + use old_path::{Path, GenericPath}; + use old_io::{Reader, Writer, Seek}; #[test] pub fn last_os_error() { diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 2aaf6e82800..a0b4c80e9f3 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -48,12 +48,5 @@ #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use vec::Vec; -// NB: remove when path reform lands -#[doc(no_inline)] pub use old_path::{Path, GenericPath}; -// NB: remove when I/O reform lands -#[doc(no_inline)] pub use old_io::{Buffer, Writer, Reader, Seek, BufferPrelude}; -// NB: remove when range syntax lands -#[allow(deprecated)] -#[doc(no_inline)] pub use iter::range; - +// FIXME(#23454) should these be here? #[doc(no_inline)] pub use num::wrapping::{Wrapping, WrappingOps}; diff --git a/src/libstd/process.rs b/src/libstd/process.rs index cda37b19c48..6b09636c1df 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -533,8 +533,8 @@ mod tests { use io::prelude::*; use prelude::v1::{Ok, Err, drop, Some, Vec}; use prelude::v1::{String, Clone}; - use prelude::v1::{Str, AsSlice, ToString, GenericPath}; - use old_path; + use prelude::v1::{Str, AsSlice, ToString}; + use old_path::{self, GenericPath}; use old_io::fs::PathExtensions; use rt::running_on_valgrind; use str; diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index f1c43a07e6e..cf627ca2548 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -10,7 +10,6 @@ // // ignore-lexer-test FIXME #15677 -use prelude::v1::*; use io::prelude::*; use env; diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index c839ce65298..5292f78ca0e 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -20,6 +20,7 @@ use old_io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode use old_io::{IoResult, FileStat, SeekStyle}; use old_io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; use old_io; +use old_path::{Path, GenericPath}; use libc::{self, c_int, c_void}; use mem; use ptr; diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs index 8935f97ce5d..ffa4b37b487 100644 --- a/src/libstd/sys/windows/backtrace.rs +++ b/src/libstd/sys/windows/backtrace.rs @@ -26,14 +26,15 @@ #![allow(deprecated)] // for old path for dynamic lib use prelude::v1::*; +use io::prelude::*; use dynamic_lib::DynamicLibrary; -use io; -use io::prelude::*; use ffi::CStr; use intrinsics; +use io; use libc; use mem; +use old_path::Path; use ptr; use str; use sync::{StaticMutex, MUTEX_INIT}; diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index a218fb26fda..e7a01478908 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -22,6 +22,7 @@ use prelude::v1::*; use sys; use sys_common::{self, mkerr_libc}; +use old_path::{Path, GenericPath}; use old_io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode}; use old_io::{IoResult, IoError, FileStat, SeekStyle}; use old_io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index e465ecaa5f6..e08a6e6b3cd 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -24,7 +24,7 @@ use old_io::process::{ProcessExit, ExitStatus}; use old_io::{IoResult, IoError}; use old_io; use os; -use old_path::BytesContainer; +use old_path::{BytesContainer, GenericPath}; use ptr; use str; use sync::{StaticMutex, MUTEX_INIT}; diff --git a/src/libstd/sys/windows/tty.rs b/src/libstd/sys/windows/tty.rs index f542cb2323e..52f4cce4aa3 100644 --- a/src/libstd/sys/windows/tty.rs +++ b/src/libstd/sys/windows/tty.rs @@ -29,7 +29,7 @@ use prelude::v1::*; -use old_io::{self, IoError, IoResult, MemReader}; +use old_io::{self, IoError, IoResult, MemReader, Reader}; use iter::repeat; use libc::types::os::arch::extra::LPCVOID; use libc::{c_int, HANDLE, LPDWORD, DWORD, LPVOID}; diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index d2742d4b45a..6a316ee83fd 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -150,11 +150,12 @@ use io; use marker::PhantomData; use rt::{self, unwind}; use sync::{Mutex, Condvar, Arc}; +use sys::thread as imp; +use sys_common::{stack, thread_info}; use thunk::Thunk; use time::Duration; -use sys::thread as imp; -use sys_common::{stack, thread_info}; +#[allow(deprecated)] use old_io::Writer; /// Thread configuration. Provides detailed control over the properties /// and behavior of new threads. |
