about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-03-13 20:22:16 +0000
committerbors <bors@rust-lang.org>2015-03-13 20:22:16 +0000
commit3e4be02b80a3dd27bce20870958fe0aef7e7336d (patch)
tree156b54e84eeb1df2818be29b53ab7f35b5bc80f0 /src/libstd/sys
parent9eb69abad8ffbce840e7dc7038ddea434dc987f1 (diff)
parent981bf5f690d1d7c5cf3e1419ac7a7c86dbc7a4d5 (diff)
downloadrust-3e4be02b80a3dd27bce20870958fe0aef7e7336d.tar.gz
rust-3e4be02b80a3dd27bce20870958fe0aef7e7336d.zip
Auto merge of #23292 - alexcrichton:stabilize-io, r=aturon
The new `std::io` module has had some time to bake now, and this commit
stabilizes its functionality. There are still portions of the module which
remain unstable, and below contains a summart of the actions taken.

This commit also deprecates the entire contents of the `old_io` module in a
blanket fashion. All APIs should now have a reasonable replacement in the
new I/O modules.

Stable APIs:

* `std::io` (the name)
* `std::io::prelude` (the name)
* `Read`
* `Read::read`
* `Read::{read_to_end, read_to_string}` after being modified to return a `usize`
  for the number of bytes read.
* `ReadExt`
* `Write`
* `Write::write`
* `Write::{write_all, write_fmt}`
* `WriteExt`
* `BufRead`
* `BufRead::{fill_buf, consume}`
* `BufRead::{read_line, read_until}` after being modified to return a `usize`
  for the number of bytes read.
* `BufReadExt`
* `BufReader`
* `BufReader::{new, with_capacity}`
* `BufReader::{get_ref, get_mut, into_inner}`
* `{Read,BufRead} for BufReader`
* `BufWriter`
* `BufWriter::{new, with_capacity}`
* `BufWriter::{get_ref, get_mut, into_inner}`
* `Write for BufWriter`
* `IntoInnerError`
* `IntoInnerError::{error, into_inner}`
* `{Error,Display} for IntoInnerError`
* `LineWriter`
* `LineWriter::{new, with_capacity}` - `with_capacity` was added
* `LineWriter::{get_ref, get_mut, into_inner}` - `get_mut` was added)
* `Write for LineWriter`
* `BufStream`
* `BufStream::{new, with_capacities}`
* `BufStream::{get_ref, get_mut, into_inner}`
* `{BufRead,Read,Write} for BufStream`
* `stdin`
* `Stdin`
* `Stdin::lock`
* `Stdin::read_line` - added method
* `StdinLock`
* `Read for Stdin`
* `{Read,BufRead} for StdinLock`
* `stdout`
* `Stdout`
* `Stdout::lock`
* `StdoutLock`
* `Write for Stdout`
* `Write for StdoutLock`
* `stderr`
* `Stderr`
* `Stderr::lock`
* `StderrLock`
* `Write for Stderr`
* `Write for StderrLock`
* `io::Result`
* `io::Error`
* `io::Error::last_os_error`
* `{Display, Error} for Error`

Unstable APIs:

(reasons can be found in the commit itself)

* `Write::flush`
* `Seek`
* `ErrorKind`
* `Error::new`
* `Error::from_os_error`
* `Error::kind`

Deprecated APIs

* `Error::description` - available via the `Error` trait
* `Error::detail` - available via the `Display` implementation
* `thread::Builder::{stdout, stderr}`

Changes in functionality:

* `old_io::stdio::set_stderr` is now a noop as the infrastructure for printing
  backtraces has migrated to `std::io`.

[breaking-change]
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/common/backtrace.rs41
-rw-r--r--src/libstd/sys/common/mod.rs5
-rw-r--r--src/libstd/sys/unix/backtrace.rs29
-rw-r--r--src/libstd/sys/unix/ext.rs3
-rw-r--r--src/libstd/sys/unix/fs.rs1
-rw-r--r--src/libstd/sys/unix/helper_signal.rs2
-rw-r--r--src/libstd/sys/unix/mod.rs9
-rw-r--r--src/libstd/sys/unix/os.rs9
-rw-r--r--src/libstd/sys/unix/pipe.rs2
-rw-r--r--src/libstd/sys/unix/stdio.rs10
-rw-r--r--src/libstd/sys/unix/timer.rs2
-rw-r--r--src/libstd/sys/unix/tty.rs2
-rw-r--r--src/libstd/sys/windows/backtrace.rs5
-rw-r--r--src/libstd/sys/windows/condvar.rs4
-rw-r--r--src/libstd/sys/windows/ext.rs2
-rw-r--r--src/libstd/sys/windows/mod.rs10
-rw-r--r--src/libstd/sys/windows/os.rs8
-rw-r--r--src/libstd/sys/windows/pipe.rs2
-rw-r--r--src/libstd/sys/windows/stdio.rs10
-rw-r--r--src/libstd/sys/windows/timer.rs2
-rw-r--r--src/libstd/sys/windows/tty.rs2
21 files changed, 113 insertions, 47 deletions
diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs
index 50a9f204799..c42a755b444 100644
--- a/src/libstd/sys/common/backtrace.rs
+++ b/src/libstd/sys/common/backtrace.rs
@@ -9,8 +9,9 @@
 // except according to those terms.
 
 use prelude::v1::*;
+use io::prelude::*;
 
-use old_io::IoResult;
+use io;
 
 #[cfg(target_pointer_width = "64")]
 pub const HEX_WIDTH: uint = 18;
@@ -35,7 +36,7 @@ pub const HEX_WIDTH: uint = 10;
 // Note that this demangler isn't quite as fancy as it could be. We have lots
 // of other information in our symbols like hashes, version, type information,
 // etc. Additionally, this doesn't handle glue symbols at all.
-pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
+pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> {
     // First validate the symbol. If it doesn't look like anything we're
     // expecting, we just print it literally. Note that we must handle non-rust
     // symbols because we could have any function in the backtrace.
@@ -72,12 +73,12 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
 
     // Alright, let's do this.
     if !valid {
-        try!(writer.write_str(s));
+        try!(writer.write_all(s.as_bytes()));
     } else {
         let mut first = true;
         while inner.len() > 0 {
             if !first {
-                try!(writer.write_str("::"));
+                try!(writer.write_all(b"::"));
             } else {
                 first = false;
             }
@@ -93,11 +94,11 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
                     macro_rules! demangle {
                         ($($pat:expr, => $demangled:expr),*) => ({
                             $(if rest.starts_with($pat) {
-                                try!(writer.write_str($demangled));
+                                try!(writer.write_all($demangled));
                                 rest = &rest[$pat.len()..];
                               } else)*
                             {
-                                try!(writer.write_str(rest));
+                                try!(writer.write_all(rest.as_bytes()));
                                 break;
                             }
 
@@ -106,29 +107,29 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
 
                     // see src/librustc/back/link.rs for these mappings
                     demangle! (
-                        "$SP$", => "@",
-                        "$BP$", => "*",
-                        "$RF$", => "&",
-                        "$LT$", => "<",
-                        "$GT$", => ">",
-                        "$LP$", => "(",
-                        "$RP$", => ")",
-                        "$C$", => ",",
+                        "$SP$", => b"@",
+                        "$BP$", => b"*",
+                        "$RF$", => b"&",
+                        "$LT$", => b"<",
+                        "$GT$", => b">",
+                        "$LP$", => b"(",
+                        "$RP$", => b")",
+                        "$C$", => b",",
 
                         // in theory we can demangle any Unicode code point, but
                         // for simplicity we just catch the common ones.
-                        "$u7e$", => "~",
-                        "$u20$", => " ",
-                        "$u27$", => "'",
-                        "$u5b$", => "[",
-                        "$u5d$", => "]"
+                        "$u7e$", => b"~",
+                        "$u20$", => b" ",
+                        "$u27$", => b"'",
+                        "$u5b$", => b"[",
+                        "$u5d$", => b"]"
                     )
                 } else {
                     let idx = match rest.find('$') {
                         None => rest.len(),
                         Some(i) => i,
                     };
-                    try!(writer.write_str(&rest[..idx]));
+                    try!(writer.write_all(rest[..idx].as_bytes()));
                     rest = &rest[idx..];
                 }
             }
diff --git a/src/libstd/sys/common/mod.rs b/src/libstd/sys/common/mod.rs
index 9a89b290980..29c05b1e0d8 100644
--- a/src/libstd/sys/common/mod.rs
+++ b/src/libstd/sys/common/mod.rs
@@ -37,6 +37,7 @@ pub mod wtf8;
 
 // common error constructors
 
+#[allow(deprecated)]
 pub fn eof() -> IoError {
     IoError {
         kind: old_io::EndOfFile,
@@ -45,6 +46,7 @@ pub fn eof() -> IoError {
     }
 }
 
+#[allow(deprecated)]
 pub fn timeout(desc: &'static str) -> IoError {
     IoError {
         kind: old_io::TimedOut,
@@ -53,6 +55,7 @@ pub fn timeout(desc: &'static str) -> IoError {
     }
 }
 
+#[allow(deprecated)]
 pub fn short_write(n: uint, desc: &'static str) -> IoError {
     IoError {
         kind: if n == 0 { old_io::TimedOut } else { old_io::ShortWrite(n) },
@@ -61,6 +64,7 @@ pub fn short_write(n: uint, desc: &'static str) -> IoError {
     }
 }
 
+#[allow(deprecated)]
 pub fn unimpl() -> IoError {
     IoError {
         kind: old_io::IoUnavailable,
@@ -70,6 +74,7 @@ pub fn unimpl() -> IoError {
 }
 
 // unix has nonzero values as errors
+#[allow(deprecated)]
 pub fn mkerr_libc<T: Int>(ret: T) -> IoResult<()> {
     if ret != Int::zero() {
         Err(last_error())
diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs
index 24d709e9928..3fa9f5d07aa 100644
--- a/src/libstd/sys/unix/backtrace.rs
+++ b/src/libstd/sys/unix/backtrace.rs
@@ -84,9 +84,10 @@
 /// all unix platforms we support right now, so it at least gets the job done.
 
 use prelude::v1::*;
+use io::prelude::*;
 
 use ffi::CStr;
-use old_io::IoResult;
+use io;
 use libc;
 use mem;
 use str;
@@ -105,7 +106,7 @@ use sys_common::backtrace::*;
 /// only viable option.
 #[cfg(all(target_os = "ios", target_arch = "arm"))]
 #[inline(never)]
-pub fn write(w: &mut Writer) -> IoResult<()> {
+pub fn write(w: &mut Write) -> io::Result<()> {
     use result;
 
     extern {
@@ -135,13 +136,11 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
 #[cfg(not(all(target_os = "ios", target_arch = "arm")))]
 #[inline(never)] // if we know this is a function call, we can skip it when
                  // tracing
-pub fn write(w: &mut Writer) -> IoResult<()> {
-    use old_io::IoError;
-
+pub fn write(w: &mut Write) -> io::Result<()> {
     struct Context<'a> {
         idx: int,
-        writer: &'a mut (Writer+'a),
-        last_error: Option<IoError>,
+        writer: &'a mut (Write+'a),
+        last_error: Option<io::Error>,
     }
 
     // When using libbacktrace, we use some necessary global state, so we
@@ -223,8 +222,8 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
 }
 
 #[cfg(any(target_os = "macos", target_os = "ios"))]
-fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void,
-         _symaddr: *mut libc::c_void) -> IoResult<()> {
+fn print(w: &mut Write, idx: int, addr: *mut libc::c_void,
+         _symaddr: *mut libc::c_void) -> io::Result<()> {
     use intrinsics;
     #[repr(C)]
     struct Dl_info {
@@ -249,8 +248,8 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void,
 }
 
 #[cfg(not(any(target_os = "macos", target_os = "ios")))]
-fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void,
-         symaddr: *mut libc::c_void) -> IoResult<()> {
+fn print(w: &mut Write, idx: int, addr: *mut libc::c_void,
+         symaddr: *mut libc::c_void) -> io::Result<()> {
     use env;
     use ffi::AsOsStr;
     use os::unix::prelude::*;
@@ -442,8 +441,8 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void,
 }
 
 // Finally, after all that work above, we can emit a symbol.
-fn output(w: &mut Writer, idx: int, addr: *mut libc::c_void,
-          s: Option<&[u8]>) -> IoResult<()> {
+fn output(w: &mut Write, idx: int, addr: *mut libc::c_void,
+          s: Option<&[u8]>) -> io::Result<()> {
     try!(write!(w, "  {:2}: {:2$?} - ", idx, addr, HEX_WIDTH));
     match s.and_then(|s| str::from_utf8(s).ok()) {
         Some(string) => try!(demangle(w, string)),
@@ -453,8 +452,8 @@ fn output(w: &mut Writer, idx: int, addr: *mut libc::c_void,
 }
 
 #[allow(dead_code)]
-fn output_fileline(w: &mut Writer, file: &[u8], line: libc::c_int,
-                   more: bool) -> IoResult<()> {
+fn output_fileline(w: &mut Write, file: &[u8], line: libc::c_int,
+                   more: bool) -> io::Result<()> {
     let file = str::from_utf8(file).ok().unwrap_or("<unknown>");
     // prior line: "  ##: {:2$} - func"
     try!(write!(w, "      {:3$}at {}:{}", "", file, line, HEX_WIDTH));
diff --git a/src/libstd/sys/unix/ext.rs b/src/libstd/sys/unix/ext.rs
index ca7f7c4c0ca..3dd05319194 100644
--- a/src/libstd/sys/unix/ext.rs
+++ b/src/libstd/sys/unix/ext.rs
@@ -43,7 +43,7 @@ use sys::os_str::Buf;
 use sys_common::{AsInner, AsInnerMut, IntoInner, FromInner};
 use libc::{self, gid_t, uid_t};
 
-use old_io;
+#[allow(deprecated)] use old_io;
 
 /// Raw file descriptors.
 pub type Fd = libc::c_int;
@@ -67,6 +67,7 @@ impl AsRawFd for fs::File {
     }
 }
 
+#[allow(deprecated)]
 impl AsRawFd for old_io::pipe::PipeStream {
     fn as_raw_fd(&self) -> Fd {
         self.as_inner().fd()
diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs
index f23619955e2..c839ce65298 100644
--- a/src/libstd/sys/unix/fs.rs
+++ b/src/libstd/sys/unix/fs.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 //! Blocking posix-based file I/O
+#![allow(deprecated)]
 
 #![allow(deprecated)] // this module itself is essentially deprecated
 
diff --git a/src/libstd/sys/unix/helper_signal.rs b/src/libstd/sys/unix/helper_signal.rs
index ed9bd0a239f..ff29dea254f 100644
--- a/src/libstd/sys/unix/helper_signal.rs
+++ b/src/libstd/sys/unix/helper_signal.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(deprecated)]
+
 use libc;
 use os;
 
diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs
index 865ea987279..a8cee74828d 100644
--- a/src/libstd/sys/unix/mod.rs
+++ b/src/libstd/sys/unix/mod.rs
@@ -60,10 +60,12 @@ pub type wrlen = libc::size_t;
 pub type msglen_t = libc::size_t;
 pub unsafe fn close_sock(sock: sock_t) { let _ = libc::close(sock); }
 
+#[allow(deprecated)]
 pub fn last_error() -> IoError {
     decode_error_detailed(os::errno() as i32)
 }
 
+#[allow(deprecated)]
 pub fn last_net_error() -> IoError {
     last_error()
 }
@@ -72,6 +74,7 @@ extern "system" {
     fn gai_strerror(errcode: libc::c_int) -> *const libc::c_char;
 }
 
+#[allow(deprecated)]
 pub fn last_gai_error(s: libc::c_int) -> IoError {
 
     let mut err = decode_error(s);
@@ -83,6 +86,7 @@ pub fn last_gai_error(s: libc::c_int) -> IoError {
 }
 
 /// Convert an `errno` value into a high-level error variant and description.
+#[allow(deprecated)]
 pub fn decode_error(errno: i32) -> IoError {
     // FIXME: this should probably be a bit more descriptive...
     let (kind, desc) = match errno {
@@ -119,12 +123,14 @@ pub fn decode_error(errno: i32) -> IoError {
     IoError { kind: kind, desc: desc, detail: None }
 }
 
+#[allow(deprecated)]
 pub fn decode_error_detailed(errno: i32) -> IoError {
     let mut err = decode_error(errno);
     err.detail = Some(os::error_string(errno));
     err
 }
 
+#[allow(deprecated)]
 pub fn decode_error_kind(errno: i32) -> ErrorKind {
     match errno as libc::c_int {
         libc::ECONNREFUSED => ErrorKind::ConnectionRefused,
@@ -155,6 +161,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
 }
 
 #[inline]
+#[allow(deprecated)]
 pub fn retry<T, F> (mut f: F) -> T where
     T: SignedInt,
     F: FnMut() -> T,
@@ -194,11 +201,13 @@ pub fn ms_to_timeval(ms: u64) -> libc::timeval {
     }
 }
 
+#[allow(deprecated)]
 pub fn wouldblock() -> bool {
     let err = os::errno();
     err == libc::EWOULDBLOCK as i32 || err == libc::EAGAIN as i32
 }
 
+#[allow(deprecated)]
 pub fn set_nonblocking(fd: sock_t, nb: bool) {
     let set = nb as libc::c_int;
     mkerr_libc(retry(|| unsafe { c::ioctl(fd, c::FIONBIO, &set) })).unwrap();
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index 3266da5eb31..d332556d188 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -22,7 +22,7 @@ use io;
 use iter;
 use libc::{self, c_int, c_char, c_void};
 use mem;
-use old_io::{IoError, IoResult};
+#[allow(deprecated)] use old_io::{IoError, IoResult};
 use ptr;
 use path::{self, PathBuf};
 use slice;
@@ -398,7 +398,7 @@ pub fn env() -> Env {
         let mut environ = *environ();
         if environ as usize == 0 {
             panic!("os::env() failure getting env string from OS: {}",
-                   IoError::last_error());
+                   io::Error::last_os_error());
         }
         let mut result = Vec::new();
         while *environ != ptr::null() {
@@ -434,7 +434,7 @@ pub fn setenv(k: &OsStr, v: &OsStr) {
         let k = k.to_cstring().unwrap();
         let v = v.to_cstring().unwrap();
         if libc::funcs::posix01::unistd::setenv(k.as_ptr(), v.as_ptr(), 1) != 0 {
-            panic!("failed setenv: {}", IoError::last_error());
+            panic!("failed setenv: {}", io::Error::last_os_error());
         }
     }
 }
@@ -443,11 +443,12 @@ pub fn unsetenv(n: &OsStr) {
     unsafe {
         let nbuf = n.to_cstring().unwrap();
         if libc::funcs::posix01::unistd::unsetenv(nbuf.as_ptr()) != 0 {
-            panic!("failed unsetenv: {}", IoError::last_error());
+            panic!("failed unsetenv: {}", io::Error::last_os_error());
         }
     }
 }
 
+#[allow(deprecated)]
 pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> {
     let mut fds = [0; 2];
     if libc::pipe(fds.as_mut_ptr()) == 0 {
diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs
index 9cddfca69cb..daa981720f6 100644
--- a/src/libstd/sys/unix/pipe.rs
+++ b/src/libstd/sys/unix/pipe.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 
 use ffi::CString;
diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs
index 2f9610fa5b5..5f5101e96d7 100644
--- a/src/libstd/sys/unix/stdio.rs
+++ b/src/libstd/sys/unix/stdio.rs
@@ -50,3 +50,13 @@ impl Stderr {
         return ret;
     }
 }
+
+// FIXME: right now this raw stderr handle is used in a few places because
+//        std::io::stderr_raw isn't exposed, but once that's exposed this impl
+//        should go away
+impl io::Write for Stderr {
+    fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+        Stderr::write(self, data)
+    }
+    fn flush(&mut self) -> io::Result<()> { Ok(()) }
+}
diff --git a/src/libstd/sys/unix/timer.rs b/src/libstd/sys/unix/timer.rs
index ce9748ede85..ef0274fdda9 100644
--- a/src/libstd/sys/unix/timer.rs
+++ b/src/libstd/sys/unix/timer.rs
@@ -46,6 +46,8 @@
 //!
 //! Note that all time units in this file are in *milliseconds*.
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 use self::Req::*;
 
diff --git a/src/libstd/sys/unix/tty.rs b/src/libstd/sys/unix/tty.rs
index 1d74b36a625..f607f7c6a2f 100644
--- a/src/libstd/sys/unix/tty.rs
+++ b/src/libstd/sys/unix/tty.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 
 use sys::fs::FileDesc;
diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs
index b464ba70911..8638099ca69 100644
--- a/src/libstd/sys/windows/backtrace.rs
+++ b/src/libstd/sys/windows/backtrace.rs
@@ -28,9 +28,10 @@
 use prelude::v1::*;
 
 use dynamic_lib::DynamicLibrary;
+use io;
+use io::prelude::*;
 use ffi::CStr;
 use intrinsics;
-use old_io::IoResult;
 use libc;
 use mem;
 use ptr;
@@ -292,7 +293,7 @@ impl Drop for Cleanup {
     fn drop(&mut self) { (self.SymCleanup)(self.handle); }
 }
 
-pub fn write(w: &mut Writer) -> IoResult<()> {
+pub fn write(w: &mut Write) -> io::Result<()> {
     // According to windows documentation, all dbghelp functions are
     // single-threaded.
     static LOCK: StaticMutex = MUTEX_INIT;
diff --git a/src/libstd/sys/windows/condvar.rs b/src/libstd/sys/windows/condvar.rs
index 071637e3a93..67552255fdb 100644
--- a/src/libstd/sys/windows/condvar.rs
+++ b/src/libstd/sys/windows/condvar.rs
@@ -12,7 +12,7 @@ use prelude::v1::*;
 
 use cell::UnsafeCell;
 use libc::{self, DWORD};
-use os;
+use sys::os;
 use sys::mutex::{self, Mutex};
 use sys::sync as ffi;
 use time::Duration;
@@ -46,7 +46,7 @@ impl Condvar {
                                                0);
         if r == 0 {
             const ERROR_TIMEOUT: DWORD = 0x5B4;
-            debug_assert_eq!(os::errno() as uint, ERROR_TIMEOUT as uint);
+            debug_assert_eq!(os::errno() as usize, ERROR_TIMEOUT as usize);
             false
         } else {
             true
diff --git a/src/libstd/sys/windows/ext.rs b/src/libstd/sys/windows/ext.rs
index 1d63da813c9..dc820a4ce45 100644
--- a/src/libstd/sys/windows/ext.rs
+++ b/src/libstd/sys/windows/ext.rs
@@ -25,6 +25,7 @@ use net;
 use sys::os_str::Buf;
 use sys_common::{AsInner, FromInner, AsInnerMut};
 
+#[allow(deprecated)]
 use old_io;
 
 /// Raw HANDLEs.
@@ -52,6 +53,7 @@ impl AsRawHandle for fs::File {
     }
 }
 
+#[allow(deprecated)]
 impl AsRawHandle for old_io::pipe::PipeStream {
     fn as_raw_handle(&self) -> Handle {
         self.as_inner().handle()
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index 46085826e60..6b0f6a78c85 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -64,6 +64,7 @@ pub type msglen_t = libc::c_int;
 pub unsafe fn close_sock(sock: sock_t) { let _ = libc::closesocket(sock); }
 
 // windows has zero values as errors
+#[allow(deprecated)]
 fn mkerr_winbool(ret: libc::c_int) -> IoResult<()> {
     if ret == 0 {
         Err(last_error())
@@ -72,6 +73,7 @@ fn mkerr_winbool(ret: libc::c_int) -> IoResult<()> {
     }
 }
 
+#[allow(deprecated)]
 pub fn last_error() -> IoError {
     let errno = os::errno() as i32;
     let mut err = decode_error(errno);
@@ -79,6 +81,7 @@ pub fn last_error() -> IoError {
     err
 }
 
+#[allow(deprecated)]
 pub fn last_net_error() -> IoError {
     let errno = unsafe { c::WSAGetLastError() as i32 };
     let mut err = decode_error(errno);
@@ -86,11 +89,13 @@ pub fn last_net_error() -> IoError {
     err
 }
 
+#[allow(deprecated)]
 pub fn last_gai_error(_errno: i32) -> IoError {
     last_net_error()
 }
 
 /// Convert an `errno` value into a high-level error variant and description.
+#[allow(deprecated)]
 pub fn decode_error(errno: i32) -> IoError {
     let (kind, desc) = match errno {
         libc::EOF => (old_io::EndOfFile, "end of file"),
@@ -134,6 +139,7 @@ pub fn decode_error(errno: i32) -> IoError {
     IoError { kind: kind, desc: desc, detail: None }
 }
 
+#[allow(deprecated)]
 pub fn decode_error_detailed(errno: i32) -> IoError {
     let mut err = decode_error(errno);
     err.detail = Some(os::error_string(errno));
@@ -178,11 +184,13 @@ pub fn ms_to_timeval(ms: u64) -> libc::timeval {
     }
 }
 
+#[allow(deprecated)]
 pub fn wouldblock() -> bool {
     let err = os::errno();
     err == libc::WSAEWOULDBLOCK as i32
 }
 
+#[allow(deprecated)]
 pub fn set_nonblocking(fd: sock_t, nb: bool) {
     let mut set = nb as libc::c_ulong;
     if unsafe { c::ioctlsocket(fd, c::FIONBIO, &mut set) } != 0 {
@@ -205,6 +213,7 @@ pub fn init_net() {
     }
 }
 
+#[allow(deprecated)]
 pub fn to_utf16(s: Option<&str>) -> IoResult<Vec<u16>> {
     match s {
         Some(s) => Ok(to_utf16_os(OsStr::from_str(s))),
@@ -283,6 +292,7 @@ fn fill_utf16_buf_base<F1, F2, T>(mut f1: F1, f2: F2) -> Result<T, ()>
     }
 }
 
+#[allow(deprecated)]
 fn fill_utf16_buf<F1, F2, T>(f1: F1, f2: F2) -> IoResult<T>
     where F1: FnMut(*mut u16, libc::DWORD) -> libc::DWORD,
           F2: FnOnce(&[u16]) -> T
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index 89cf8a08a68..ecd538abfb4 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -22,6 +22,7 @@ use io;
 use libc::types::os::arch::extra::LPWCH;
 use libc::{self, c_int, c_void};
 use mem;
+#[allow(deprecated)]
 use old_io::{IoError, IoResult};
 use ops::Range;
 use path::{self, PathBuf};
@@ -134,7 +135,7 @@ pub fn env() -> Env {
         let ch = GetEnvironmentStringsW();
         if ch as usize == 0 {
             panic!("failure getting env string from OS: {}",
-                   IoError::last_error());
+                   io::Error::last_os_error());
         }
         Env { base: ch, cur: ch }
     }
@@ -269,7 +270,7 @@ pub fn setenv(k: &OsStr, v: &OsStr) {
 
     unsafe {
         if libc::SetEnvironmentVariableW(k.as_ptr(), v.as_ptr()) == 0 {
-            panic!("failed to set env: {}", IoError::last_error());
+            panic!("failed to set env: {}", io::Error::last_os_error());
         }
     }
 }
@@ -278,7 +279,7 @@ pub fn unsetenv(n: &OsStr) {
     let v = super::to_utf16_os(n);
     unsafe {
         if libc::SetEnvironmentVariableW(v.as_ptr(), ptr::null()) == 0 {
-            panic!("failed to unset env: {}", IoError::last_error());
+            panic!("failed to unset env: {}", io::Error::last_os_error());
         }
     }
 }
@@ -333,6 +334,7 @@ pub fn page_size() -> usize {
     }
 }
 
+#[allow(deprecated)]
 pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> {
     // Windows pipes work subtly differently than unix pipes, and their
     // inheritance has to be handled in a different way that I do not
diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs
index 1f228b7d32e..2b03e9e7431 100644
--- a/src/libstd/sys/windows/pipe.rs
+++ b/src/libstd/sys/windows/pipe.rs
@@ -84,6 +84,8 @@
 //! the test suite passing (the suite is in libstd), and that's good enough for
 //! me!
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 
 use libc;
diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs
index 72ce8b7c6e3..d1bff0e135d 100644
--- a/src/libstd/sys/windows/stdio.rs
+++ b/src/libstd/sys/windows/stdio.rs
@@ -135,6 +135,16 @@ impl Stderr {
     }
 }
 
+// FIXME: right now this raw stderr handle is used in a few places because
+//        std::io::stderr_raw isn't exposed, but once that's exposed this impl
+//        should go away
+impl io::Write for Stderr {
+    fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+        Stderr::write(self, data)
+    }
+    fn flush(&mut self) -> io::Result<()> { Ok(()) }
+}
+
 impl NoClose {
     fn new(handle: libc::HANDLE) -> NoClose {
         NoClose(Some(Handle::new(handle)))
diff --git a/src/libstd/sys/windows/timer.rs b/src/libstd/sys/windows/timer.rs
index a23a90a9cf8..91a7f694181 100644
--- a/src/libstd/sys/windows/timer.rs
+++ b/src/libstd/sys/windows/timer.rs
@@ -20,6 +20,8 @@
 //! Other than that, the implementation is pretty straightforward in terms of
 //! the other two implementations of timers with nothing *that* new showing up.
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 use self::Req::*;
 
diff --git a/src/libstd/sys/windows/tty.rs b/src/libstd/sys/windows/tty.rs
index 37dce423a68..f542cb2323e 100644
--- a/src/libstd/sys/windows/tty.rs
+++ b/src/libstd/sys/windows/tty.rs
@@ -25,6 +25,8 @@
 //! wrapper that performs encoding/decoding, this implementation should switch
 //! to working in raw UTF-16, with such a wrapper around it.
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 
 use old_io::{self, IoError, IoResult, MemReader};