about summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-30 08:02:39 +0000
committerbors <bors@rust-lang.org>2014-12-30 08:02:39 +0000
commitd2368c3c11ddab9d812c4ddec2e44579326ad347 (patch)
treeb976bc0eb040da67646a9d99bb9b901cb9f55abd /src/libstd/io
parentfea5aa656ff4349f4d3e1fea1447d26986762ae1 (diff)
parent470ae101d6e26a6ce07292b7fca6eaed527451c7 (diff)
auto merge of #20320 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/extensions.rs2
-rw-r--r--src/libstd/io/fs.rs13
-rw-r--r--src/libstd/io/mem.rs4
-rw-r--r--src/libstd/io/mod.rs10
-rw-r--r--src/libstd/io/net/pipe.rs2
-rw-r--r--src/libstd/io/net/tcp.rs7
-rw-r--r--src/libstd/io/net/udp.rs4
-rw-r--r--src/libstd/io/process.rs7
-rw-r--r--src/libstd/io/stdio.rs20
-rw-r--r--src/libstd/io/util.rs2
10 files changed, 45 insertions, 26 deletions
diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs
index c1f1a5b7869..e8765e3c231 100644
--- a/src/libstd/io/extensions.rs
+++ b/src/libstd/io/extensions.rs
@@ -22,7 +22,7 @@ use num::Int;
 use ops::FnOnce;
 use option::Option;
 use option::Option::{Some, None};
-use ptr::RawPtr;
+use ptr::PtrExt;
 use result::Result::{Ok, Err};
 use slice::{SliceExt, AsSlice};
 
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index f2db2875ebf..caa6590bb28 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -1149,6 +1149,19 @@ mod test {
     }
 
     #[test]
+    fn mkdir_path_already_exists_error() {
+        use io::{IoError, PathAlreadyExists};
+
+        let tmpdir = tmpdir();
+        let dir = &tmpdir.join("mkdir_error_twice");
+        check!(mkdir(dir, io::USER_RWX));
+        match mkdir(dir, io::USER_RWX) {
+            Err(IoError{kind:PathAlreadyExists,..}) => (),
+            _ => assert!(false)
+        };
+    }
+
+    #[test]
     fn recursive_mkdir() {
         let tmpdir = tmpdir();
         let dir = tmpdir.join("d1/d2");
diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs
index 20b1162d859..79327a29615 100644
--- a/src/libstd/io/mem.rs
+++ b/src/libstd/io/mem.rs
@@ -400,8 +400,8 @@ impl<'a> Buffer for BufReader<'a> {
 mod test {
     extern crate "test" as test_crate;
     use super::*;
-    use io::*;
-    use prelude::*;
+    use io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek};
+    use prelude::{Ok, Err, range,  Vec, Buffer,  AsSlice, SliceExt, IteratorExt, CloneSliceExt};
     use io;
     use self::test_crate::Bencher;
 
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index e1f5efae79f..7a25360e695 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -935,7 +935,7 @@ impl<'a> Reader for &'a mut (Reader+'a) {
 // API yet. If so, it should be a method on Vec.
 unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -> &'a mut [T] {
     use raw::Slice;
-    use ptr::RawPtr;
+    use ptr::PtrExt;
 
     assert!(start <= end);
     assert!(end <= v.capacity());
@@ -1724,7 +1724,7 @@ pub fn standard_error(kind: IoErrorKind) -> IoError {
 /// A mode specifies how a file should be opened or created. These modes are
 /// passed to `File::open_mode` and are used to control where the file is
 /// positioned when it is initially opened.
-#[deriving(Copy)]
+#[deriving(Copy, Clone, PartialEq, Eq)]
 pub enum FileMode {
     /// Opens a file positioned at the beginning.
     Open,
@@ -1736,7 +1736,7 @@ pub enum FileMode {
 
 /// Access permissions with which the file should be opened. `File`s
 /// opened with `Read` will return an error if written to.
-#[deriving(Copy)]
+#[deriving(Copy, Clone, PartialEq, Eq)]
 pub enum FileAccess {
     /// Read-only access, requests to write will result in an error
     Read,
@@ -1959,8 +1959,8 @@ impl fmt::Show for FilePermission {
 #[cfg(test)]
 mod tests {
     use self::BadReaderBehavior::*;
-    use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput};
-    use prelude::*;
+    use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput, Writer};
+    use prelude::{Ok, Vec, Buffer, CloneSliceExt};
     use uint;
 
     #[deriving(Clone, PartialEq, Show)]
diff --git a/src/libstd/io/net/pipe.rs b/src/libstd/io/net/pipe.rs
index 4afc72cde71..93f37a8c98f 100644
--- a/src/libstd/io/net/pipe.rs
+++ b/src/libstd/io/net/pipe.rs
@@ -269,7 +269,7 @@ mod tests {
     use super::*;
     use io::*;
     use io::test::*;
-    use prelude::*;
+    use prelude::{Ok, Err, spawn, range, drop,  Some, None, channel, Send, FnOnce, Clone};
     use io::fs::PathExtensions;
     use time::Duration;
 
diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs
index 6adb5387f2e..24cf06973cc 100644
--- a/src/libstd/io/net/tcp.rs
+++ b/src/libstd/io/net/tcp.rs
@@ -484,9 +484,12 @@ impl sys_common::AsInner<TcpAcceptorImp> for TcpAcceptor {
 mod test {
     use io::net::tcp::*;
     use io::net::ip::*;
-    use io::*;
+    use io::{EndOfFile, TimedOut, IoError, ShortWrite, OtherIoError, ConnectionAborted};
+    use io::{ConnectionRefused, ConnectionReset, BrokenPipe, NotConnected};
+    use io::{PermissionDenied, Listener, Acceptor};
     use io::test::*;
-    use prelude::*;
+    use prelude::{Ok, Err, spawn, range, drop, Some, None, channel, Clone};
+    use prelude::{Reader, Writer, IteratorExt};
 
     // 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/io/net/udp.rs b/src/libstd/io/net/udp.rs
index 5bf47dceb5a..1431067d4c6 100644
--- a/src/libstd/io/net/udp.rs
+++ b/src/libstd/io/net/udp.rs
@@ -250,9 +250,9 @@ impl Writer for UdpStream {
 mod test {
     use super::*;
     use io::net::ip::*;
-    use io::*;
+    use io::{ShortWrite, IoError, TimedOut, PermissionDenied};
     use io::test::*;
-    use prelude::*;
+    use prelude::{Ok, Err, spawn, range, drop, Some, None, channel, Clone, 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/io/process.rs b/src/libstd/io/process.rs
index 93aa627ffba..b127507f048 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -745,8 +745,10 @@ mod tests {
 
     use super::*;
     use io::timer::*;
-    use io::*;
-    use prelude::*;
+    use io::{Truncate, Write, TimedOut, timer, process, FileNotFound};
+    use prelude::{Ok, Err, spawn, range, drop, Box, Some, None, Option, Vec, Buffer};
+    use prelude::{from_str, Path, String, channel, Reader, Writer, Clone, Slice};
+    use prelude::{SliceExt, Str, StrExt, AsSlice, ToString, GenericPath};
     use io::fs::PathExtensions;
     use time::Duration;
     use str;
@@ -1205,6 +1207,7 @@ mod tests {
     #[test]
     #[cfg(windows)]
     fn env_map_keys_ci() {
+        use c_str::ToCStr;
         use super::EnvKey;
         let mut cmd = Command::new("");
         cmd.env("path", "foo");
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index 6bd721599f3..6c8e4eea40f 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -146,7 +146,7 @@ impl StdinReader {
     /// ```
     pub fn lock<'a>(&'a mut self) -> StdinReaderGuard<'a> {
         StdinReaderGuard {
-            inner: self.inner.lock()
+            inner: self.inner.lock().unwrap()
         }
     }
 
@@ -155,7 +155,7 @@ impl StdinReader {
     /// The read is performed atomically - concurrent read calls in other
     /// threads will not interleave with this one.
     pub fn read_line(&mut self) -> IoResult<String> {
-        self.inner.lock().0.read_line()
+        self.inner.lock().unwrap().0.read_line()
     }
 
     /// Like `Buffer::read_until`.
@@ -163,7 +163,7 @@ impl StdinReader {
     /// The read is performed atomically - concurrent read calls in other
     /// threads will not interleave with this one.
     pub fn read_until(&mut self, byte: u8) -> IoResult<Vec<u8>> {
-        self.inner.lock().0.read_until(byte)
+        self.inner.lock().unwrap().0.read_until(byte)
     }
 
     /// Like `Buffer::read_char`.
@@ -171,13 +171,13 @@ impl StdinReader {
     /// The read is performed atomically - concurrent read calls in other
     /// threads will not interleave with this one.
     pub fn read_char(&mut self) -> IoResult<char> {
-        self.inner.lock().0.read_char()
+        self.inner.lock().unwrap().0.read_char()
     }
 }
 
 impl Reader for StdinReader {
     fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
-        self.inner.lock().0.read(buf)
+        self.inner.lock().unwrap().0.read(buf)
     }
 
     // We have to manually delegate all of these because the default impls call
@@ -185,23 +185,23 @@ impl Reader for StdinReader {
     // incur the costs of repeated locking).
 
     fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult<uint> {
-        self.inner.lock().0.read_at_least(min, buf)
+        self.inner.lock().unwrap().0.read_at_least(min, buf)
     }
 
     fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
-        self.inner.lock().0.push_at_least(min, len, buf)
+        self.inner.lock().unwrap().0.push_at_least(min, len, buf)
     }
 
     fn read_to_end(&mut self) -> IoResult<Vec<u8>> {
-        self.inner.lock().0.read_to_end()
+        self.inner.lock().unwrap().0.read_to_end()
     }
 
     fn read_le_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
-        self.inner.lock().0.read_le_uint_n(nbytes)
+        self.inner.lock().unwrap().0.read_le_uint_n(nbytes)
     }
 
     fn read_be_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
-        self.inner.lock().0.read_be_uint_n(nbytes)
+        self.inner.lock().unwrap().0.read_be_uint_n(nbytes)
     }
 }
 
diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs
index 43893ca0126..90d7c1388a1 100644
--- a/src/libstd/io/util.rs
+++ b/src/libstd/io/util.rs
@@ -280,7 +280,7 @@ mod test {
     use io;
     use boxed::Box;
     use super::*;
-    use prelude::*;
+    use prelude::{Ok, range, Vec, Buffer, Writer, Reader, ToString, AsSlice};
 
     #[test]
     fn test_limit_reader_unlimited() {