Browse Source

Merge pull request #8 from jseyfried/jeffrey/upgrade_rust

Update up to nightly-2016-06-15
jethrogb 7 years ago
parent
commit
e78ca2bc03

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "core_io"
-version = "0.1.20170408"
+version = "0.1.20170615"
 authors = ["The Rust Project Developers", "Jethro Beekman"]
 license = "MIT/Apache-2.0"
 description = """

+ 59 - 0
mapping.rs

@@ -270,3 +270,62 @@
 -Mapping("ccce2c6eb914a66571f60fa0afe8a46faa9fb3bd","8fba638b08eb85cda1bd2a4e855f7f76727dfc52")
 -Mapping("824c9ebbd5f0611e326648d90ee3e50caf04bb7f","031f9b15df3df5da19b64a1f824463053898d021")
 -Mapping("0f34b532af590d25e9178f87c620931dd671cc2e","a2d176e8f4774b84db22540a45eed7b29482f154")
+-Mapping("3b5754e5ce73d24c6684b3ed0c68a557dfdd2f52","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("c58c928e658d2e45f816fd05796a964aa83759da","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("28a74299778cdad4ea999e4ee8f8c1ef793338bd","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("bbdaad0dc8dc64e036ccee817f90a91876b32a9d","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("d5cf1cb64cd1948a8c289e29838716f03d49d5aa","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("7627e3d31dd641ae9042675e9032857f58d0c5d1","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("9f2abadca2d065bf81772cb84981d0a22d8e98b3","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("452bf0852e1d47f7478d8b81328c15b183c6d971","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("ddc5d7bd4b9ea3e8a8ccf82cb443e950be311d61","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("1785bca5137fad1f26e4d3c347cbb68408a28fa9","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("252d3da8a6c715ccafcf77d83b826f6fb899cfe5","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("2bd4b5c6db1468235f730bce403bf657123ecc57","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("63c77214c1d38789652b465694b254205d1886e0","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("2b4c911581099e247a68b3a8adc782d778f5190b","b4be4758361bf1b03410a523e8672b1c1fa7d385")
+-Mapping("036983201d4e9aeb5c5e56e47c305971972b2569","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("94e884b6307a59f1e6e64aa7ebc1996b651a7629","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("128aa262e8fe445f5c4d5c1f15dd28a2007c0234","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("afa1240e57330d85a372db4e28cd8bc8fa528ccb","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("06fb4d25642a3f223db1441972dd5962085cfba1","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("777ee20796e80a31d4b7c985dd68eda2941460d6","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("6a5fc9eecec235312755e737fb5b984abe537f2e","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("2d4ed8e0cbe2c5f3763273a5d8f6b15119473ba7","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("59f1a2f948a5e17d6675957813376ad8cc1d95ec","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("f4209651ec4d4455dab4fc3f3a3456a897d9da7f","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("f1140a33176a5fb2e91e26ea3ae42a834dd9bfdf","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("d3abc80b3e601473e763b129acb636757ed96fc7","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("978d2cfee1ee9da704c960c8047e978a7003b582","5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11")
+-Mapping("e40beb3af162e676e40704854dd6547ee8d4cf60","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("e17a1227ac779a181b2839998e26a7e4e434c2a0","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("826d8f3850b37a23481dfcf4a899b5dfc82d22e3","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("386b0b9d39274701f30d31ee6ce31c363c6036ea","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("75b05681239cb309a23fcb4f8864f177e5aa62da","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("0ed1ec9f9eb8174273867343d01177b5ac13ff4c","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("5dfcd85fd4bae49445383baadf472fbdb414a0e6","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("01951a61a49dca35747dc9ba03e5536f337de239","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("14f30da6132c25543da1f06c32a8c5699d3e5747","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("81734e0e06d24cf580dd5352c64d10110e4d3b7b","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("5b13bff5203c1bdc6ac6dc87f69b5359a9503078","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("5f39668642e445fedcf477493f206905dc51c2c8","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("557967766be6139bd747ab2c3dc56ff0c9b8852a","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("28fd1e519a3807c632d58d01e73b4948000639ba","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("d47cf08d57d881f34f9724edfb0b3b93209af202","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("5de00925bd3eb59711dee4982eb96f82d5a5e71a","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("f89d8d184490ecb3cf91f7b6bb7296d649f931ba","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("e0cc22b4bae8007c59fbe58f2c104ecd743d746a","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("4ed2edaafe82fb8d44e81e00ca3e4f7659855ba2","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("107bd67ef7fb3e8027d7234d687cdd27c3efaa0d","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("6684d176c78647c467870c75e276f5d37ffd3e3c","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("0418fa9d382a47d782cc1e195c14573be9c32095","4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab")
+-Mapping("d015610db7b7d30f3c92d3272ce166397a81349e","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("76242aebb9d47558124c991a6faf0eb706d35703","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("f062832b208e94f2f0f26ed7fb5c48c172069fbe","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("148e9171481da43738d7d7a79c5e6f7bc2c2ccde","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("3d5b8c6266fd58cefa0d7af8c6115fe22532d069","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("4bf5c99afc75f411a4e064150781eefc749c10df","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("e2eaef8497bd212694840515a568d592b17d0e07","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("cfb5debbcb610eae16e8c5602416930f20fefa39","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("03abb1bd70ac56e4aba0684bab819892a0157843","4bda94d0d820bf7baf2e97ec3552fe290b826391")
+-Mapping("554c685b0b3b25b7aa752717edf50b8d6bcab7a0","4bda94d0d820bf7baf2e97ec3552fe290b826391")

+ 1551 - 0
patches/4ab3bcb9ca137ad6e6ee4ae4a70a234d92b6d4ab.patch

@@ -0,0 +1,1551 @@
+diff --git a/buffered.rs b/buffered.rs
+index 3b82412..0566d0f 100644
+--- a/buffered.rs
++++ b/buffered.rs
+@@ -10,13 +10,13 @@
+ 
+ //! Buffering wrappers for I/O traits
+ 
++use core::prelude::v1::*;
+ use io::prelude::*;
+ 
+-use cmp;
+-use error;
+-use fmt;
++use core::cmp;
++use core::fmt;
+ use io::{self, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom};
+-use memchr;
++use io::memchr;
+ 
+ /// The `BufReader` struct adds buffering to any reader.
+ ///
+@@ -46,7 +46,6 @@ use memchr;
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct BufReader<R> {
+     inner: R,
+     buf: Box<[u8]>,
+@@ -69,7 +68,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: R) -> BufReader<R> {
+         BufReader::with_capacity(DEFAULT_BUF_SIZE, inner)
+     }
+@@ -90,7 +88,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: R) -> BufReader<R> {
+         BufReader {
+             inner: inner,
+@@ -118,7 +115,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &R { &self.inner }
+ 
+     /// Gets a mutable reference to the underlying reader.
+@@ -139,7 +135,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut R { &mut self.inner }
+ 
+     /// Unwraps this `BufReader`, returning the underlying reader.
+@@ -160,11 +155,9 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> R { self.inner }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> Read for BufReader<R> {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         // If we don't have any buffered data and we're doing a massive read
+@@ -182,7 +175,6 @@ impl<R: Read> Read for BufReader<R> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> BufRead for BufReader<R> {
+     fn fill_buf(&mut self) -> io::Result<&[u8]> {
+         // If we've reached the end of our internal buffer then we need to fetch
+@@ -202,7 +194,6 @@ impl<R: Read> BufRead for BufReader<R> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("BufReader")
+@@ -212,7 +203,6 @@ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Seek> Seek for BufReader<R> {
+     /// Seek to an offset, in bytes, in the underlying reader.
+     ///
+@@ -306,7 +296,6 @@ impl<R: Seek> Seek for BufReader<R> {
+ /// [`Write`]: ../../std/io/trait.Write.html
+ /// [`Tcpstream::write`]: ../../std/net/struct.TcpStream.html#method.write
+ /// [`TcpStream`]: ../../std/net/struct.TcpStream.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct BufWriter<W: Write> {
+     inner: Option<W>,
+     buf: Vec<u8>,
+@@ -341,7 +330,6 @@ pub struct BufWriter<W: Write> {
+ /// };
+ /// ```
+ #[derive(Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct IntoInnerError<W>(W, Error);
+ 
+ impl<W: Write> BufWriter<W> {
+@@ -355,7 +343,6 @@ impl<W: Write> BufWriter<W> {
+     ///
+     /// let mut buffer = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap());
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: W) -> BufWriter<W> {
+         BufWriter::with_capacity(DEFAULT_BUF_SIZE, inner)
+     }
+@@ -373,7 +360,6 @@ impl<W: Write> BufWriter<W> {
+     /// let stream = TcpStream::connect("127.0.0.1:34254").unwrap();
+     /// let mut buffer = BufWriter::with_capacity(100, stream);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: W) -> BufWriter<W> {
+         BufWriter {
+             inner: Some(inner),
+@@ -422,7 +408,6 @@ impl<W: Write> BufWriter<W> {
+     /// // we can use reference just like buffer
+     /// let reference = buffer.get_ref();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &W { self.inner.as_ref().unwrap() }
+ 
+     /// Gets a mutable reference to the underlying writer.
+@@ -440,7 +425,6 @@ impl<W: Write> BufWriter<W> {
+     /// // we can use reference just like buffer
+     /// let reference = buffer.get_mut();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut W { self.inner.as_mut().unwrap() }
+ 
+     /// Unwraps this `BufWriter`, returning the underlying writer.
+@@ -458,7 +442,6 @@ impl<W: Write> BufWriter<W> {
+     /// // unwrap the TcpStream and flush the buffer
+     /// let stream = buffer.into_inner().unwrap();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(mut self) -> Result<W, IntoInnerError<BufWriter<W>>> {
+         match self.flush_buf() {
+             Err(e) => Err(IntoInnerError(self, e)),
+@@ -467,7 +450,6 @@ impl<W: Write> BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Write for BufWriter<W> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         if self.buf.len() + buf.len() > self.buf.capacity() {
+@@ -487,7 +469,6 @@ impl<W: Write> Write for BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("BufWriter")
+@@ -497,7 +478,6 @@ impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write + Seek> Seek for BufWriter<W> {
+     /// Seek to the offset, in bytes, in the underlying writer.
+     ///
+@@ -507,7 +487,6 @@ impl<W: Write + Seek> Seek for BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Drop for BufWriter<W> {
+     fn drop(&mut self) {
+         if self.inner.is_some() && !self.panicked {
+@@ -546,7 +525,6 @@ impl<W> IntoInnerError<W> {
+     ///     }
+     /// };
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn error(&self) -> &Error { &self.1 }
+ 
+     /// Returns the buffered writer instance which generated the error.
+@@ -579,23 +557,13 @@ impl<W> IntoInnerError<W> {
+     ///     }
+     /// };
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> W { self.0 }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W> From<IntoInnerError<W>> for Error {
+     fn from(iie: IntoInnerError<W>) -> Error { iie.1 }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
+-    fn description(&self) -> &str {
+-        error::Error::description(self.error())
+-    }
+-}
+-
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W> fmt::Display for IntoInnerError<W> {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         self.error().fmt(f)
+@@ -650,7 +618,6 @@ impl<W> fmt::Display for IntoInnerError<W> {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct LineWriter<W: Write> {
+     inner: BufWriter<W>,
+     need_flush: bool,
+@@ -671,7 +638,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: W) -> LineWriter<W> {
+         // Lines typically aren't that long, don't use a giant buffer
+         LineWriter::with_capacity(1024, inner)
+@@ -692,7 +658,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: W) -> LineWriter<W> {
+         LineWriter {
+             inner: BufWriter::with_capacity(cap, inner),
+@@ -716,7 +681,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &W { self.inner.get_ref() }
+ 
+     /// Gets a mutable reference to the underlying writer.
+@@ -739,7 +703,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut W { self.inner.get_mut() }
+ 
+     /// Unwraps this `LineWriter`, returning the underlying writer.
+@@ -761,7 +724,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>> {
+         self.inner.into_inner().map_err(|IntoInnerError(buf, e)| {
+             IntoInnerError(LineWriter {
+@@ -772,7 +734,6 @@ impl<W: Write> LineWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Write for LineWriter<W> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         if self.need_flush {
+@@ -817,7 +778,6 @@ impl<W: Write> Write for LineWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("LineWriter")
+diff --git a/cursor.rs b/cursor.rs
+index 53347eb..637f4e0 100644
+--- a/cursor.rs
++++ b/cursor.rs
+@@ -8,10 +8,11 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
++use core::prelude::v1::*;
+ use io::prelude::*;
+ 
+-use core::convert::TryInto;
+-use cmp;
++#[cfg(feature = "collections")] use core::convert::TryInto;
++use core::cmp;
+ use io::{self, SeekFrom, Error, ErrorKind};
+ 
+ /// A `Cursor` wraps another type and provides it with a
+@@ -79,7 +80,6 @@ use io::{self, SeekFrom, Error, ErrorKind};
+ ///     assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
+ /// }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Clone, Debug)]
+ pub struct Cursor<T> {
+     inner: T,
+@@ -102,7 +102,6 @@ impl<T> Cursor<T> {
+     /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
+     /// # force_inference(&buff);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: T) -> Cursor<T> {
+         Cursor { pos: 0, inner: inner }
+     }
+@@ -120,7 +119,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let vec = buff.into_inner();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> T { self.inner }
+ 
+     /// Gets a reference to the underlying value in this cursor.
+@@ -136,7 +134,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let reference = buff.get_ref();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &T { &self.inner }
+ 
+     /// Gets a mutable reference to the underlying value in this cursor.
+@@ -155,7 +152,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let reference = buff.get_mut();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
+ 
+     /// Returns the current position of this cursor.
+@@ -177,7 +173,6 @@ impl<T> Cursor<T> {
+     /// buff.seek(SeekFrom::Current(-1)).unwrap();
+     /// assert_eq!(buff.position(), 1);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn position(&self) -> u64 { self.pos }
+ 
+     /// Sets the position of this cursor.
+@@ -197,11 +192,9 @@ impl<T> Cursor<T> {
+     /// buff.set_position(4);
+     /// assert_eq!(buff.position(), 4);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn set_position(&mut self, pos: u64) { self.pos = pos; }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
+     fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
+         let (base_pos, offset) = match style {
+@@ -222,25 +215,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+-        let n = Read::read(&mut self.fill_buf()?, buf)?;
++        let n = Read::read(&mut self.get_buf()?, buf)?;
+         self.pos += n as u64;
+         Ok(n)
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
+-    fn fill_buf(&mut self) -> io::Result<&[u8]> {
++impl<T> Cursor<T> where T: AsRef<[u8]> {
++    fn get_buf(&mut self) -> io::Result<&[u8]> {
+         let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
+         Ok(&self.inner.as_ref()[(amt as usize)..])
+     }
++}
++
++#[cfg(feature = "collections")]
++impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
++    fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
+     fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Write for Cursor<&'a mut [u8]> {
+     #[inline]
+     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+@@ -252,7 +247,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature = "collections")]
+ impl Write for Cursor<Vec<u8>> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         let pos: usize = self.position().try_into().map_err(|_| {
+@@ -282,8 +277,8 @@ impl Write for Cursor<Vec<u8>> {
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
+-impl Write for Cursor<Box<[u8]>> {
++#[cfg(feature = "alloc")]
++impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         let pos = cmp::min(self.pos, self.inner.len() as u64);
+diff --git a/error.rs b/error.rs
+index fb67eaf..1c9f15e 100644
+--- a/error.rs
++++ b/error.rs
+@@ -8,11 +8,16 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
+-use error;
+-use fmt;
+-use result;
+-use sys;
+-use convert::From;
++#[cfg(feature="alloc")] use alloc::boxed::Box;
++#[cfg(not(feature="alloc"))] use ::FakeBox as Box;
++use core::convert::Into;
++use core::fmt;
++use core::marker::{Send, Sync};
++use core::option::Option::{self, Some, None};
++use core::result;
++#[cfg(feature="collections")] use collections::string::String;
++#[cfg(not(feature="collections"))] use ::ErrorString as String;
++use core::convert::From;
+ 
+ /// A specialized [`Result`](../result/enum.Result.html) type for I/O
+ /// operations.
+@@ -44,7 +49,6 @@ use convert::From;
+ ///     Ok(buffer)
+ /// }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub type Result<T> = result::Result<T, Error>;
+ 
+ /// The error type for I/O operations of the `Read`, `Write`, `Seek`, and
+@@ -56,7 +60,6 @@ pub type Result<T> = result::Result<T, Error>;
+ ///
+ /// [`ErrorKind`]: enum.ErrorKind.html
+ #[derive(Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Error {
+     repr: Repr,
+ }
+@@ -64,13 +67,16 @@ pub struct Error {
+ enum Repr {
+     Os(i32),
+     Simple(ErrorKind),
++    #[cfg(feature="alloc")]
+     Custom(Box<Custom>),
++    #[cfg(not(feature="alloc"))]
++    Custom(Custom),
+ }
+ 
+ #[derive(Debug)]
+ struct Custom {
+     kind: ErrorKind,
+-    error: Box<error::Error+Send+Sync>,
++    error: String,
+ }
+ 
+ /// A list specifying general categories of I/O error.
+@@ -82,47 +88,34 @@ struct Custom {
+ ///
+ /// [`io::Error`]: struct.Error.html
+ #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[allow(deprecated)]
+ pub enum ErrorKind {
+     /// An entity was not found, often a file.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     NotFound,
+     /// The operation lacked the necessary privileges to complete.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     PermissionDenied,
+     /// The connection was refused by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionRefused,
+     /// The connection was reset by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionReset,
+     /// The connection was aborted (terminated) by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionAborted,
+     /// The network operation failed because it was not connected yet.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     NotConnected,
+     /// A socket address could not be bound because the address is already in
+     /// use elsewhere.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AddrInUse,
+     /// A nonexistent interface was requested or the requested address was not
+     /// local.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AddrNotAvailable,
+     /// The operation failed because a pipe was closed.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     BrokenPipe,
+     /// An entity already exists, often a file.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AlreadyExists,
+     /// The operation needs to block to complete, but the blocking operation was
+     /// requested to not occur.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     WouldBlock,
+     /// A parameter was incorrect.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     InvalidInput,
+     /// Data not valid for the operation were encountered.
+     ///
+@@ -134,10 +127,8 @@ pub enum ErrorKind {
+     /// `InvalidData` if the file's contents are not valid UTF-8.
+     ///
+     /// [`InvalidInput`]: #variant.InvalidInput
+-    #[stable(feature = "io_invalid_data", since = "1.2.0")]
+     InvalidData,
+     /// The I/O operation's timeout expired, causing it to be canceled.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     TimedOut,
+     /// An error returned when an operation could not be completed because a
+     /// call to [`write`] returned [`Ok(0)`].
+@@ -148,15 +139,12 @@ pub enum ErrorKind {
+     ///
+     /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
+     /// [`Ok(0)`]: ../../std/io/type.Result.html
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     WriteZero,
+     /// This operation was interrupted.
+     ///
+     /// Interrupted operations can typically be retried.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     Interrupted,
+     /// Any I/O error not part of this list.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     Other,
+ 
+     /// An error returned when an operation could not be completed because an
+@@ -165,15 +153,10 @@ pub enum ErrorKind {
+     /// This typically means that an operation could only succeed if it read a
+     /// particular number of bytes but only a smaller number of bytes could be
+     /// read.
+-    #[stable(feature = "read_exact", since = "1.6.0")]
+     UnexpectedEof,
+ 
+     /// A marker variant that tells the compiler that users of this enum cannot
+     /// match it exhaustively.
+-    #[unstable(feature = "io_error_internals",
+-               reason = "better expressed through extensible enums that this \
+-                         enum cannot be exhaustively matched against",
+-               issue = "0")]
+     #[doc(hidden)]
+     __Nonexhaustive,
+ }
+@@ -206,7 +189,6 @@ impl ErrorKind {
+ 
+ /// Intended for use for errors not exposed to the user, where allocating onto
+ /// the heap (for normal construction via Error::new) is too costly.
+-#[stable(feature = "io_error_from_errorkind", since = "1.14.0")]
+ impl From<ErrorKind> for Error {
+     fn from(kind: ErrorKind) -> Error {
+         Error {
+@@ -234,14 +216,13 @@ impl Error {
+     /// // errors can also be created from other errors
+     /// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new<E>(kind: ErrorKind, error: E) -> Error
+-        where E: Into<Box<error::Error+Send+Sync>>
++        where E: Into<String>
+     {
+         Self::_new(kind, error.into())
+     }
+ 
+-    fn _new(kind: ErrorKind, error: Box<error::Error+Send+Sync>) -> Error {
++    fn _new(kind: ErrorKind, error: String) -> Error {
+         Error {
+             repr: Repr::Custom(Box::new(Custom {
+                 kind: kind,
+@@ -250,24 +231,6 @@ impl Error {
+         }
+     }
+ 
+-    /// Returns an error representing the last OS error which occurred.
+-    ///
+-    /// This function reads the value of `errno` for the target platform (e.g.
+-    /// `GetLastError` on Windows) and will return a corresponding instance of
+-    /// `Error` for the error code.
+-    ///
+-    /// # Examples
+-    ///
+-    /// ```
+-    /// use std::io::Error;
+-    ///
+-    /// println!("last OS error: {:?}", Error::last_os_error());
+-    /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    pub fn last_os_error() -> Error {
+-        Error::from_raw_os_error(sys::os::errno() as i32)
+-    }
+-
+     /// Creates a new instance of an `Error` from a particular OS error code.
+     ///
+     /// # Examples
+@@ -293,7 +256,6 @@ impl Error {
+     /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn from_raw_os_error(code: i32) -> Error {
+         Error { repr: Repr::Os(code) }
+     }
+@@ -324,7 +286,6 @@ impl Error {
+     ///     print_os_error(&Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn raw_os_error(&self) -> Option<i32> {
+         match self.repr {
+             Repr::Os(i) => Some(i),
+@@ -358,12 +319,11 @@ impl Error {
+     ///     print_error(&Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn get_ref(&self) -> Option<&(error::Error+Send+Sync+'static)> {
++    pub fn get_ref(&self) -> Option<&String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+-            Repr::Custom(ref c) => Some(&*c.error),
++            Repr::Custom(ref c) => Some(&c.error),
+         }
+     }
+ 
+@@ -429,12 +389,11 @@ impl Error {
+     ///     print_error(&change_error(Error::new(ErrorKind::Other, MyError::new())));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn get_mut(&mut self) -> Option<&mut (error::Error+Send+Sync+'static)> {
++    pub fn get_mut(&mut self) -> Option<&mut String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+-            Repr::Custom(ref mut c) => Some(&mut *c.error),
++            Repr::Custom(ref mut c) => Some(&mut c.error),
+         }
+     }
+ 
+@@ -463,8 +422,7 @@ impl Error {
+     ///     print_error(Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn into_inner(self) -> Option<Box<error::Error+Send+Sync>> {
++    pub fn into_inner(self) -> Option<String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+@@ -490,10 +448,9 @@ impl Error {
+     ///     print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn kind(&self) -> ErrorKind {
+         match self.repr {
+-            Repr::Os(code) => sys::decode_error_kind(code),
++            Repr::Os(_code) => ErrorKind::Other,
+             Repr::Custom(ref c) => c.kind,
+             Repr::Simple(kind) => kind,
+         }
+@@ -504,21 +461,18 @@ impl fmt::Debug for Repr {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         match *self {
+             Repr::Os(ref code) =>
+-                fmt.debug_struct("Os").field("code", code)
+-                   .field("message", &sys::os::error_string(*code)).finish(),
++                fmt.debug_struct("Os").field("code", code).finish(),
+             Repr::Custom(ref c) => fmt.debug_tuple("Custom").field(c).finish(),
+             Repr::Simple(kind) => fmt.debug_tuple("Kind").field(&kind).finish(),
+         }
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl fmt::Display for Error {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         match self.repr {
+             Repr::Os(code) => {
+-                let detail = sys::os::error_string(code);
+-                write!(fmt, "{} (os error {})", detail, code)
++                write!(fmt, "os error {}", code)
+             }
+             Repr::Custom(ref c) => c.error.fmt(fmt),
+             Repr::Simple(kind) => write!(fmt, "{}", kind.as_str()),
+@@ -526,24 +480,6 @@ impl fmt::Display for Error {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl error::Error for Error {
+-    fn description(&self) -> &str {
+-        match self.repr {
+-            Repr::Os(..) | Repr::Simple(..) => self.kind().as_str(),
+-            Repr::Custom(ref c) => c.error.description(),
+-        }
+-    }
+-
+-    fn cause(&self) -> Option<&error::Error> {
+-        match self.repr {
+-            Repr::Os(..) => None,
+-            Repr::Simple(..) => None,
+-            Repr::Custom(ref c) => c.error.cause(),
+-        }
+-    }
+-}
+-
+ fn _assert_error_is_sync_send() {
+     fn _is_sync_send<T: Sync+Send>() {}
+     _is_sync_send::<Error>();
+diff --git a/impls.rs b/impls.rs
+index f691289..c4374d3 100644
+--- a/impls.rs
++++ b/impls.rs
+@@ -8,26 +8,31 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
+-use cmp;
+-use io::{self, SeekFrom, Read, Write, Seek, BufRead, Error, ErrorKind};
+-use fmt;
+-use mem;
++#[cfg(feature="alloc")] use alloc::boxed::Box;
++use core::cmp;
++use io::{self, SeekFrom, Read, Write, Seek, Error, ErrorKind};
++#[cfg(feature="collections")] use io::BufRead;
++use core::fmt;
++use core::mem;
++#[cfg(feature="collections")] use collections::string::String;
++#[cfg(feature="collections")] use collections::vec::Vec;
+ 
+ // =============================================================================
+ // Forwarding implementations
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, R: Read + ?Sized> Read for &'a mut R {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         (**self).read(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+         (**self).read_to_end(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+         (**self).read_to_string(buf)
+@@ -38,7 +43,6 @@ impl<'a, R: Read + ?Sized> Read for &'a mut R {
+         (**self).read_exact(buf)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, W: Write + ?Sized> Write for &'a mut W {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
+@@ -56,12 +60,11 @@ impl<'a, W: Write + ?Sized> Write for &'a mut W {
+         (**self).write_fmt(fmt)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, S: Seek + ?Sized> Seek for &'a mut S {
+     #[inline]
+     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
+@@ -80,18 +83,20 @@ impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<R: Read + ?Sized> Read for Box<R> {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         (**self).read(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+         (**self).read_to_end(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+         (**self).read_to_string(buf)
+@@ -102,7 +107,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
+         (**self).read_exact(buf)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<W: Write + ?Sized> Write for Box<W> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
+@@ -120,12 +125,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+         (**self).write_fmt(fmt)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<S: Seek + ?Sized> Seek for Box<S> {
+     #[inline]
+     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead + ?Sized> BufRead for Box<B> {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
+@@ -151,7 +156,6 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
+ ///
+ /// Note that reading updates the slice to point to the yet unread part.
+ /// The slice will be empty when EOF is reached.
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Read for &'a [u8] {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+@@ -193,7 +197,7 @@ impl<'a> Read for &'a [u8] {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<'a> BufRead for &'a [u8] {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
+@@ -207,7 +211,6 @@ impl<'a> BufRead for &'a [u8] {
+ ///
+ /// Note that writing updates the slice to point to the yet unwritten part.
+ /// The slice will be empty when it has been completely overwritten.
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Write for &'a mut [u8] {
+     #[inline]
+     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+@@ -233,7 +236,7 @@ impl<'a> Write for &'a mut [u8] {
+ 
+ /// Write is implemented for `Vec<u8>` by appending to the vector.
+ /// The vector will grow as needed.
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl Write for Vec<u8> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+diff --git a/memchr.rs b/memchr.rs
+index 3824a5f..312cf47 100644
+--- a/memchr.rs
++++ b/memchr.rs
+@@ -11,10 +11,12 @@
+ // Original implementation taken from rust-memchr
+ // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
+ 
++pub use self::fallback::{memchr,memrchr};
++
+ #[allow(dead_code)]
+ pub mod fallback {
+-    use cmp;
+-    use mem;
++    use core::cmp;
++    use core::mem;
+ 
+     const LO_U64: u64 = 0x0101010101010101;
+     const HI_U64: u64 = 0x8080808080808080;
+diff --git a/mod.rs b/mod.rs
+index c872a8e..7319e65 100644
+--- a/mod.rs
++++ b/mod.rs
+@@ -266,46 +266,34 @@
+ //! [`?` operator]: ../../book/syntax-index.html
+ //! [`Read::read`]: trait.Read.html#tymethod.read
+ 
+-#![stable(feature = "rust1", since = "1.0.0")]
+-
+-use cmp;
++use core::cmp;
+ use core::str as core_str;
+-use error as std_error;
+-use fmt;
+-use result;
+-use str;
+-use memchr;
+-
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::buffered::{BufReader, BufWriter, LineWriter};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::buffered::IntoInnerError;
+-#[stable(feature = "rust1", since = "1.0.0")]
++use core::fmt;
++use core::iter::{Iterator};
++use core::marker::Sized;
++#[cfg(feature="collections")] use core::ops::{Drop, FnOnce};
++use core::option::Option::{self, Some, None};
++use core::result::Result::{Ok, Err};
++use core::result;
++#[cfg(feature="collections")] use collections::string::String;
++use core::str;
++#[cfg(feature="collections")] use collections::vec::Vec;
++mod memchr;
++
++#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
++#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
+ pub use self::cursor::Cursor;
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub use self::error::{Result, Error, ErrorKind};
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::stdio::{stdin, stdout, stderr, Stdin, Stdout, Stderr};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::stdio::{StdoutLock, StderrLock, StdinLock};
+-#[unstable(feature = "print_internals", issue = "0")]
+-pub use self::stdio::{_print, _eprint};
+-#[unstable(feature = "libstd_io_internals", issue = "0")]
+-#[doc(no_inline, hidden)]
+-pub use self::stdio::{set_panic, set_print};
+ 
+ pub mod prelude;
+-mod buffered;
++#[cfg(feature="collections")] mod buffered;
+ mod cursor;
+ mod error;
+ mod impls;
+-mod lazy;
+ mod util;
+-mod stdio;
+ 
+-const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
++const DEFAULT_BUF_SIZE: usize = 8 * 1024;
+ 
+ // A few methods below (read_to_string, read_line) will append data into a
+ // `String` buffer, but we need to be pretty careful when doing this. The
+@@ -325,6 +313,7 @@ const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
+ // 2. We're passing a raw buffer to the function `f`, and it is expected that
+ //    the function only *appends* bytes to the buffer. We'll get undefined
+ //    behavior if existing bytes are overwritten to have non-UTF-8 data.
++#[cfg(feature="collections")]
+ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
+     where F: FnOnce(&mut Vec<u8>) -> Result<usize>
+ {
+@@ -356,6 +345,7 @@ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
+ // of data to return. Simply tacking on an extra DEFAULT_BUF_SIZE space every
+ // time is 4,500 times (!) slower than this if the reader has a very small
+ // amount of data to return.
++#[cfg(feature="collections")]
+ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> {
+     let start_len = buf.len();
+     let mut len = start_len;
+@@ -438,7 +428,6 @@ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize>
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Read {
+     /// Pull some bytes from this source into the specified buffer, returning
+     /// how many bytes were read.
+@@ -491,7 +480,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
+ 
+     /// Read all bytes until EOF in this source, placing them into `buf`.
+@@ -533,7 +521,7 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
++    #[cfg(feature="collections")]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
+         read_to_end(self, buf)
+     }
+@@ -571,7 +559,7 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
++    #[cfg(feature="collections")]
+     fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
+         // Note that we do *not* call `.read_to_end()` here. We are passing
+         // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
+@@ -632,7 +620,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "read_exact", since = "1.6.0")]
+     fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
+         while !buf.is_empty() {
+             match self.read(buf) {
+@@ -684,7 +671,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
+ 
+     /// Transforms this `Read` instance to an `Iterator` over its bytes.
+@@ -714,7 +700,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn bytes(self) -> Bytes<Self> where Self: Sized {
+         Bytes { inner: self }
+     }
+@@ -751,10 +736,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "io", reason = "the semantics of a partial read/write \
+-                                         of where errors happen is currently \
+-                                         unclear and may change",
+-               issue = "27802")]
+     fn chars(self) -> Chars<Self> where Self: Sized {
+         Chars { inner: self }
+     }
+@@ -789,7 +770,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
+         Chain { first: self, second: next, done_first: false }
+     }
+@@ -823,7 +803,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn take(self, limit: u64) -> Take<Self> where Self: Sized {
+         Take { inner: self, limit: limit }
+     }
+@@ -863,7 +842,6 @@ pub trait Read {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Write {
+     /// Write a buffer into this object, returning how many bytes were written.
+     ///
+@@ -907,7 +885,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write(&mut self, buf: &[u8]) -> Result<usize>;
+ 
+     /// Flush this output stream, ensuring that all intermediately buffered
+@@ -933,7 +910,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn flush(&mut self) -> Result<()>;
+ 
+     /// Attempts to write an entire buffer into this write.
+@@ -963,7 +939,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
+         while !buf.is_empty() {
+             match self.write(buf) {
+@@ -1015,7 +990,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
+         // Create a shim which translates a Write to a fmt::Write and saves
+         // off I/O errors. instead of discarding them
+@@ -1071,7 +1045,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
+ }
+ 
+@@ -1101,7 +1074,6 @@ pub trait Write {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Seek {
+     /// Seek to an offset, in bytes, in a stream.
+     ///
+@@ -1117,7 +1089,6 @@ pub trait Seek {
+     /// Seeking to a negative offset is considered an error.
+     ///
+     /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
+ }
+ 
+@@ -1127,29 +1098,26 @@ pub trait Seek {
+ ///
+ /// [`Seek`]: trait.Seek.html
+ #[derive(Copy, PartialEq, Eq, Clone, Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub enum SeekFrom {
+     /// Set the offset to the provided number of bytes.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    Start(#[stable(feature = "rust1", since = "1.0.0")] u64),
++    Start(u64),
+ 
+     /// Set the offset to the size of this object plus the specified number of
+     /// bytes.
+     ///
+     /// It is possible to seek beyond the end of an object, but it's an error to
+     /// seek before byte 0.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    End(#[stable(feature = "rust1", since = "1.0.0")] i64),
++    End(i64),
+ 
+     /// Set the offset to the current position plus the specified number of
+     /// bytes.
+     ///
+     /// It is possible to seek beyond the end of an object, but it's an error to
+     /// seek before byte 0.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    Current(#[stable(feature = "rust1", since = "1.0.0")] i64),
++    Current(i64),
+ }
+ 
++#[cfg(feature="collections")]
+ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
+                                    -> Result<usize> {
+     let mut read = 0;
+@@ -1229,7 +1197,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
+ /// # }
+ /// ```
+ ///
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ pub trait BufRead: Read {
+     /// Fills the internal buffer of this object, returning the buffer contents.
+     ///
+@@ -1274,7 +1242,6 @@ pub trait BufRead: Read {
+     /// // ensure the bytes we worked with aren't returned again later
+     /// stdin.consume(length);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn fill_buf(&mut self) -> Result<&[u8]>;
+ 
+     /// Tells this buffer that `amt` bytes have been consumed from the buffer,
+@@ -1296,7 +1263,6 @@ pub trait BufRead: Read {
+     /// that method's example includes an example of `consume()`.
+     ///
+     /// [`fill_buf`]: #tymethod.fill_buf
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn consume(&mut self, amt: usize);
+ 
+     /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
+@@ -1352,7 +1318,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(num_bytes, 0);
+     /// assert_eq!(buf, b"");
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
+         read_until(self, byte, buf)
+     }
+@@ -1407,7 +1372,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(num_bytes, 0);
+     /// assert_eq!(buf, "");
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read_line(&mut self, buf: &mut String) -> Result<usize> {
+         // Note that we are not calling the `.read_until` method here, but
+         // rather our hardcoded implementation. For more details as to why, see
+@@ -1448,7 +1412,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
+     /// assert_eq!(split_iter.next(), None);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn split(self, byte: u8) -> Split<Self> where Self: Sized {
+         Split { buf: self, delim: byte }
+     }
+@@ -1487,7 +1450,6 @@ pub trait BufRead: Read {
+     /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
+     ///
+     /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn lines(self) -> Lines<Self> where Self: Sized {
+         Lines { buf: self }
+     }
+@@ -1499,7 +1461,6 @@ pub trait BufRead: Read {
+ /// Please see the documentation of [`chain`] for more details.
+ ///
+ /// [`chain`]: trait.Read.html#method.chain
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Chain<T, U> {
+     first: T,
+     second: U,
+@@ -1527,7 +1488,6 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn into_inner(self) -> (T, U) {
+         (self.first, self.second)
+     }
+@@ -1552,7 +1512,6 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_ref(&self) -> (&T, &U) {
+         (&self.first, &self.second)
+     }
+@@ -1581,13 +1540,11 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_mut(&mut self) -> (&mut T, &mut U) {
+         (&mut self.first, &mut self.second)
+     }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.debug_struct("Chain")
+@@ -1597,7 +1554,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T: Read, U: Read> Read for Chain<T, U> {
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
+         if !self.done_first {
+@@ -1610,7 +1566,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
+     }
+ }
+ 
+-#[stable(feature = "chain_bufread", since = "1.9.0")]
++#[cfg(feature="collections")]
+ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
+     fn fill_buf(&mut self) -> Result<&[u8]> {
+         if !self.done_first {
+@@ -1637,7 +1593,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
+ /// Please see the documentation of [`take`] for more details.
+ ///
+ /// [`take`]: trait.Read.html#method.take
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Debug)]
+ pub struct Take<T> {
+     inner: T,
+@@ -1672,7 +1627,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn limit(&self) -> u64 { self.limit }
+ 
+     /// Consumes the `Take`, returning the wrapped reader.
+@@ -1695,7 +1649,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "io_take_into_inner", since = "1.15.0")]
+     pub fn into_inner(self) -> T {
+         self.inner
+     }
+@@ -1722,7 +1675,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_ref(&self) -> &T {
+         &self.inner
+     }
+@@ -1753,13 +1705,11 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_mut(&mut self) -> &mut T {
+         &mut self.inner
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T: Read> Read for Take<T> {
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
+         // Don't call into inner reader at all at EOF because it may still block
+@@ -1774,7 +1724,7 @@ impl<T: Read> Read for Take<T> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<T: BufRead> BufRead for Take<T> {
+     fn fill_buf(&mut self) -> Result<&[u8]> {
+         // Don't call into inner reader at all at EOF because it may still block
+@@ -1813,13 +1763,11 @@ fn read_one_byte(reader: &mut Read) -> Option<Result<u8>> {
+ /// Please see the documentation of [`bytes`] for more details.
+ ///
+ /// [`bytes`]: trait.Read.html#method.bytes
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Debug)]
+ pub struct Bytes<R> {
+     inner: R,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> Iterator for Bytes<R> {
+     type Item = Result<u8>;
+ 
+@@ -1834,8 +1782,6 @@ impl<R: Read> Iterator for Bytes<R> {
+ /// Please see the documentation of `chars()` for more details.
+ ///
+ /// [chars]: trait.Read.html#method.chars
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ #[derive(Debug)]
+ pub struct Chars<R> {
+     inner: R,
+@@ -1844,8 +1790,6 @@ pub struct Chars<R> {
+ /// An enumeration of possible errors that can be generated from the `Chars`
+ /// adapter.
+ #[derive(Debug)]
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ pub enum CharsError {
+     /// Variant representing that the underlying stream was read successfully
+     /// but it did not contain valid utf8 data.
+@@ -1855,8 +1799,6 @@ pub enum CharsError {
+     Other(Error),
+ }
+ 
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ impl<R: Read> Iterator for Chars<R> {
+     type Item = result::Result<char, CharsError>;
+ 
+@@ -1888,25 +1830,6 @@ impl<R: Read> Iterator for Chars<R> {
+     }
+ }
+ 
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+-impl std_error::Error for CharsError {
+-    fn description(&self) -> &str {
+-        match *self {
+-            CharsError::NotUtf8 => "invalid utf8 encoding",
+-            CharsError::Other(ref e) => std_error::Error::description(e),
+-        }
+-    }
+-    fn cause(&self) -> Option<&std_error::Error> {
+-        match *self {
+-            CharsError::NotUtf8 => None,
+-            CharsError::Other(ref e) => e.cause(),
+-        }
+-    }
+-}
+-
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ impl fmt::Display for CharsError {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         match *self {
+@@ -1925,14 +1848,14 @@ impl fmt::Display for CharsError {
+ /// `BufRead`. Please see the documentation of `split()` for more details.
+ ///
+ /// [split]: trait.BufRead.html#method.split
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ #[derive(Debug)]
+ pub struct Split<B> {
+     buf: B,
+     delim: u8,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead> Iterator for Split<B> {
+     type Item = Result<Vec<u8>>;
+ 
+@@ -1957,13 +1880,13 @@ impl<B: BufRead> Iterator for Split<B> {
+ /// `BufRead`. Please see the documentation of `lines()` for more details.
+ ///
+ /// [lines]: trait.BufRead.html#method.lines
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ #[derive(Debug)]
+ pub struct Lines<B> {
+     buf: B,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead> Iterator for Lines<B> {
+     type Item = Result<String>;
+ 
+diff --git a/prelude.rs b/prelude.rs
+index 8772d0f..49d66c9 100644
+--- a/prelude.rs
++++ b/prelude.rs
+@@ -18,7 +18,8 @@
+ //! use std::io::prelude::*;
+ //! ```
+ 
+-#![stable(feature = "rust1", since = "1.0.0")]
++pub use super::{Read, Write, Seek};
++#[cfg(feature="collections")] pub use super::BufRead;
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use super::{Read, Write, BufRead, Seek};
++#[cfg(feature="collections")] pub use alloc::boxed::Box;
++#[cfg(feature="collections")] pub use collections::vec::Vec;
+diff --git a/util.rs b/util.rs
+index 078f1ad..fd13c98 100644
+--- a/util.rs
++++ b/util.rs
+@@ -10,8 +10,9 @@
+ 
+ #![allow(missing_copy_implementations)]
+ 
+-use fmt;
+-use io::{self, Read, Write, ErrorKind, BufRead};
++use core::fmt;
++use io::{self, Read, Write, ErrorKind};
++#[cfg(feature="collections")] use io::BufRead;
+ 
+ /// Copies the entire contents of a reader into a writer.
+ ///
+@@ -43,7 +44,6 @@ use io::{self, Read, Write, ErrorKind, BufRead};
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<u64>
+     where R: Read, W: Write
+ {
+@@ -67,7 +67,6 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
+ /// the documentation of `empty()` for more details.
+ ///
+ /// [empty]: fn.empty.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Empty { _priv: () }
+ 
+ /// Constructs a new handle to an empty reader.
+@@ -85,20 +84,18 @@ pub struct Empty { _priv: () }
+ /// io::empty().read_to_string(&mut buffer).unwrap();
+ /// assert!(buffer.is_empty());
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn empty() -> Empty { Empty { _priv: () } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Read for Empty {
+     fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> { Ok(0) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++
++#[cfg(feature="collections")]
+ impl BufRead for Empty {
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(&[]) }
+     fn consume(&mut self, _n: usize) {}
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Empty {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Empty { .. }")
+@@ -111,7 +108,6 @@ impl fmt::Debug for Empty {
+ /// see the documentation of `repeat()` for more details.
+ ///
+ /// [repeat]: fn.repeat.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Repeat { byte: u8 }
+ 
+ /// Creates an instance of a reader that infinitely repeats one byte.
+@@ -128,10 +124,8 @@ pub struct Repeat { byte: u8 }
+ /// io::repeat(0b101).read_exact(&mut buffer).unwrap();
+ /// assert_eq!(buffer, [0b101, 0b101, 0b101]);
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Read for Repeat {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         for slot in &mut *buf {
+@@ -141,7 +135,6 @@ impl Read for Repeat {
+     }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Repeat {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Repeat { .. }")
+@@ -154,7 +147,6 @@ impl fmt::Debug for Repeat {
+ /// see the documentation of `sink()` for more details.
+ ///
+ /// [sink]: fn.sink.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Sink { _priv: () }
+ 
+ /// Creates an instance of a writer which will successfully consume all data.
+@@ -171,16 +163,13 @@ pub struct Sink { _priv: () }
+ /// let num_bytes = io::sink().write(&buffer).unwrap();
+ /// assert_eq!(num_bytes, 5);
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn sink() -> Sink { Sink { _priv: () } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Write for Sink {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Sink {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Sink { .. }")

+ 1551 - 0
patches/4bda94d0d820bf7baf2e97ec3552fe290b826391.patch

@@ -0,0 +1,1551 @@
+diff --git a/buffered.rs b/buffered.rs
+index 3b82412..0566d0f 100644
+--- a/buffered.rs
++++ b/buffered.rs
+@@ -10,13 +10,13 @@
+ 
+ //! Buffering wrappers for I/O traits
+ 
++use core::prelude::v1::*;
+ use io::prelude::*;
+ 
+-use cmp;
+-use error;
+-use fmt;
++use core::cmp;
++use core::fmt;
+ use io::{self, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom};
+-use memchr;
++use io::memchr;
+ 
+ /// The `BufReader` struct adds buffering to any reader.
+ ///
+@@ -46,7 +46,6 @@ use memchr;
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct BufReader<R> {
+     inner: R,
+     buf: Box<[u8]>,
+@@ -69,7 +68,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: R) -> BufReader<R> {
+         BufReader::with_capacity(DEFAULT_BUF_SIZE, inner)
+     }
+@@ -90,7 +88,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: R) -> BufReader<R> {
+         BufReader {
+             inner: inner,
+@@ -118,7 +115,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &R { &self.inner }
+ 
+     /// Gets a mutable reference to the underlying reader.
+@@ -139,7 +135,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut R { &mut self.inner }
+ 
+     /// Unwraps this `BufReader`, returning the underlying reader.
+@@ -160,11 +155,9 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> R { self.inner }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> Read for BufReader<R> {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         // If we don't have any buffered data and we're doing a massive read
+@@ -182,7 +175,6 @@ impl<R: Read> Read for BufReader<R> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> BufRead for BufReader<R> {
+     fn fill_buf(&mut self) -> io::Result<&[u8]> {
+         // If we've reached the end of our internal buffer then we need to fetch
+@@ -202,7 +194,6 @@ impl<R: Read> BufRead for BufReader<R> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("BufReader")
+@@ -212,7 +203,6 @@ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Seek> Seek for BufReader<R> {
+     /// Seek to an offset, in bytes, in the underlying reader.
+     ///
+@@ -306,7 +296,6 @@ impl<R: Seek> Seek for BufReader<R> {
+ /// [`Write`]: ../../std/io/trait.Write.html
+ /// [`Tcpstream::write`]: ../../std/net/struct.TcpStream.html#method.write
+ /// [`TcpStream`]: ../../std/net/struct.TcpStream.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct BufWriter<W: Write> {
+     inner: Option<W>,
+     buf: Vec<u8>,
+@@ -341,7 +330,6 @@ pub struct BufWriter<W: Write> {
+ /// };
+ /// ```
+ #[derive(Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct IntoInnerError<W>(W, Error);
+ 
+ impl<W: Write> BufWriter<W> {
+@@ -355,7 +343,6 @@ impl<W: Write> BufWriter<W> {
+     ///
+     /// let mut buffer = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap());
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: W) -> BufWriter<W> {
+         BufWriter::with_capacity(DEFAULT_BUF_SIZE, inner)
+     }
+@@ -373,7 +360,6 @@ impl<W: Write> BufWriter<W> {
+     /// let stream = TcpStream::connect("127.0.0.1:34254").unwrap();
+     /// let mut buffer = BufWriter::with_capacity(100, stream);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: W) -> BufWriter<W> {
+         BufWriter {
+             inner: Some(inner),
+@@ -422,7 +408,6 @@ impl<W: Write> BufWriter<W> {
+     /// // we can use reference just like buffer
+     /// let reference = buffer.get_ref();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &W { self.inner.as_ref().unwrap() }
+ 
+     /// Gets a mutable reference to the underlying writer.
+@@ -440,7 +425,6 @@ impl<W: Write> BufWriter<W> {
+     /// // we can use reference just like buffer
+     /// let reference = buffer.get_mut();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut W { self.inner.as_mut().unwrap() }
+ 
+     /// Unwraps this `BufWriter`, returning the underlying writer.
+@@ -458,7 +442,6 @@ impl<W: Write> BufWriter<W> {
+     /// // unwrap the TcpStream and flush the buffer
+     /// let stream = buffer.into_inner().unwrap();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(mut self) -> Result<W, IntoInnerError<BufWriter<W>>> {
+         match self.flush_buf() {
+             Err(e) => Err(IntoInnerError(self, e)),
+@@ -467,7 +450,6 @@ impl<W: Write> BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Write for BufWriter<W> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         if self.buf.len() + buf.len() > self.buf.capacity() {
+@@ -487,7 +469,6 @@ impl<W: Write> Write for BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("BufWriter")
+@@ -497,7 +478,6 @@ impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write + Seek> Seek for BufWriter<W> {
+     /// Seek to the offset, in bytes, in the underlying writer.
+     ///
+@@ -507,7 +487,6 @@ impl<W: Write + Seek> Seek for BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Drop for BufWriter<W> {
+     fn drop(&mut self) {
+         if self.inner.is_some() && !self.panicked {
+@@ -546,7 +525,6 @@ impl<W> IntoInnerError<W> {
+     ///     }
+     /// };
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn error(&self) -> &Error { &self.1 }
+ 
+     /// Returns the buffered writer instance which generated the error.
+@@ -579,23 +557,13 @@ impl<W> IntoInnerError<W> {
+     ///     }
+     /// };
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> W { self.0 }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W> From<IntoInnerError<W>> for Error {
+     fn from(iie: IntoInnerError<W>) -> Error { iie.1 }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
+-    fn description(&self) -> &str {
+-        error::Error::description(self.error())
+-    }
+-}
+-
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W> fmt::Display for IntoInnerError<W> {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         self.error().fmt(f)
+@@ -650,7 +618,6 @@ impl<W> fmt::Display for IntoInnerError<W> {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct LineWriter<W: Write> {
+     inner: BufWriter<W>,
+     need_flush: bool,
+@@ -671,7 +638,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: W) -> LineWriter<W> {
+         // Lines typically aren't that long, don't use a giant buffer
+         LineWriter::with_capacity(1024, inner)
+@@ -692,7 +658,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: W) -> LineWriter<W> {
+         LineWriter {
+             inner: BufWriter::with_capacity(cap, inner),
+@@ -716,7 +681,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &W { self.inner.get_ref() }
+ 
+     /// Gets a mutable reference to the underlying writer.
+@@ -739,7 +703,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut W { self.inner.get_mut() }
+ 
+     /// Unwraps this `LineWriter`, returning the underlying writer.
+@@ -761,7 +724,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>> {
+         self.inner.into_inner().map_err(|IntoInnerError(buf, e)| {
+             IntoInnerError(LineWriter {
+@@ -772,7 +734,6 @@ impl<W: Write> LineWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Write for LineWriter<W> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         if self.need_flush {
+@@ -817,7 +778,6 @@ impl<W: Write> Write for LineWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("LineWriter")
+diff --git a/cursor.rs b/cursor.rs
+index 53347eb..637f4e0 100644
+--- a/cursor.rs
++++ b/cursor.rs
+@@ -8,10 +8,11 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
++use core::prelude::v1::*;
+ use io::prelude::*;
+ 
+-use core::convert::TryInto;
+-use cmp;
++#[cfg(feature = "collections")] use core::convert::TryInto;
++use core::cmp;
+ use io::{self, SeekFrom, Error, ErrorKind};
+ 
+ /// A `Cursor` wraps another type and provides it with a
+@@ -79,7 +80,6 @@ use io::{self, SeekFrom, Error, ErrorKind};
+ ///     assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
+ /// }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Clone, Debug)]
+ pub struct Cursor<T> {
+     inner: T,
+@@ -102,7 +102,6 @@ impl<T> Cursor<T> {
+     /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
+     /// # force_inference(&buff);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: T) -> Cursor<T> {
+         Cursor { pos: 0, inner: inner }
+     }
+@@ -120,7 +119,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let vec = buff.into_inner();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> T { self.inner }
+ 
+     /// Gets a reference to the underlying value in this cursor.
+@@ -136,7 +134,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let reference = buff.get_ref();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &T { &self.inner }
+ 
+     /// Gets a mutable reference to the underlying value in this cursor.
+@@ -155,7 +152,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let reference = buff.get_mut();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
+ 
+     /// Returns the current position of this cursor.
+@@ -177,7 +173,6 @@ impl<T> Cursor<T> {
+     /// buff.seek(SeekFrom::Current(-1)).unwrap();
+     /// assert_eq!(buff.position(), 1);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn position(&self) -> u64 { self.pos }
+ 
+     /// Sets the position of this cursor.
+@@ -197,11 +192,9 @@ impl<T> Cursor<T> {
+     /// buff.set_position(4);
+     /// assert_eq!(buff.position(), 4);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn set_position(&mut self, pos: u64) { self.pos = pos; }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
+     fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
+         let (base_pos, offset) = match style {
+@@ -222,25 +215,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+-        let n = Read::read(&mut self.fill_buf()?, buf)?;
++        let n = Read::read(&mut self.get_buf()?, buf)?;
+         self.pos += n as u64;
+         Ok(n)
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
+-    fn fill_buf(&mut self) -> io::Result<&[u8]> {
++impl<T> Cursor<T> where T: AsRef<[u8]> {
++    fn get_buf(&mut self) -> io::Result<&[u8]> {
+         let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
+         Ok(&self.inner.as_ref()[(amt as usize)..])
+     }
++}
++
++#[cfg(feature = "collections")]
++impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
++    fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
+     fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Write for Cursor<&'a mut [u8]> {
+     #[inline]
+     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+@@ -252,7 +247,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature = "collections")]
+ impl Write for Cursor<Vec<u8>> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         let pos: usize = self.position().try_into().map_err(|_| {
+@@ -282,8 +277,8 @@ impl Write for Cursor<Vec<u8>> {
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
+-impl Write for Cursor<Box<[u8]>> {
++#[cfg(feature = "alloc")]
++impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         let pos = cmp::min(self.pos, self.inner.len() as u64);
+diff --git a/error.rs b/error.rs
+index 0a5804a..4564ca7 100644
+--- a/error.rs
++++ b/error.rs
+@@ -8,11 +8,16 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
+-use error;
+-use fmt;
+-use result;
+-use sys;
+-use convert::From;
++#[cfg(feature="alloc")] use alloc::boxed::Box;
++#[cfg(not(feature="alloc"))] use ::FakeBox as Box;
++use core::convert::Into;
++use core::fmt;
++use core::marker::{Send, Sync};
++use core::option::Option::{self, Some, None};
++use core::result;
++#[cfg(feature="collections")] use collections::string::String;
++#[cfg(not(feature="collections"))] use ::ErrorString as String;
++use core::convert::From;
+ 
+ /// A specialized [`Result`](../result/enum.Result.html) type for I/O
+ /// operations.
+@@ -44,7 +49,6 @@ use convert::From;
+ ///     Ok(buffer)
+ /// }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub type Result<T> = result::Result<T, Error>;
+ 
+ /// The error type for I/O operations of the `Read`, `Write`, `Seek`, and
+@@ -56,7 +60,6 @@ pub type Result<T> = result::Result<T, Error>;
+ ///
+ /// [`ErrorKind`]: enum.ErrorKind.html
+ #[derive(Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Error {
+     repr: Repr,
+ }
+@@ -64,13 +67,16 @@ pub struct Error {
+ enum Repr {
+     Os(i32),
+     Simple(ErrorKind),
++    #[cfg(feature="alloc")]
+     Custom(Box<Custom>),
++    #[cfg(not(feature="alloc"))]
++    Custom(Custom),
+ }
+ 
+ #[derive(Debug)]
+ struct Custom {
+     kind: ErrorKind,
+-    error: Box<error::Error+Send+Sync>,
++    error: String,
+ }
+ 
+ /// A list specifying general categories of I/O error.
+@@ -82,47 +88,34 @@ struct Custom {
+ ///
+ /// [`io::Error`]: struct.Error.html
+ #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[allow(deprecated)]
+ pub enum ErrorKind {
+     /// An entity was not found, often a file.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     NotFound,
+     /// The operation lacked the necessary privileges to complete.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     PermissionDenied,
+     /// The connection was refused by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionRefused,
+     /// The connection was reset by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionReset,
+     /// The connection was aborted (terminated) by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionAborted,
+     /// The network operation failed because it was not connected yet.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     NotConnected,
+     /// A socket address could not be bound because the address is already in
+     /// use elsewhere.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AddrInUse,
+     /// A nonexistent interface was requested or the requested address was not
+     /// local.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AddrNotAvailable,
+     /// The operation failed because a pipe was closed.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     BrokenPipe,
+     /// An entity already exists, often a file.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AlreadyExists,
+     /// The operation needs to block to complete, but the blocking operation was
+     /// requested to not occur.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     WouldBlock,
+     /// A parameter was incorrect.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     InvalidInput,
+     /// Data not valid for the operation were encountered.
+     ///
+@@ -134,10 +127,8 @@ pub enum ErrorKind {
+     /// `InvalidData` if the file's contents are not valid UTF-8.
+     ///
+     /// [`InvalidInput`]: #variant.InvalidInput
+-    #[stable(feature = "io_invalid_data", since = "1.2.0")]
+     InvalidData,
+     /// The I/O operation's timeout expired, causing it to be canceled.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     TimedOut,
+     /// An error returned when an operation could not be completed because a
+     /// call to [`write`] returned [`Ok(0)`].
+@@ -148,15 +139,12 @@ pub enum ErrorKind {
+     ///
+     /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
+     /// [`Ok(0)`]: ../../std/io/type.Result.html
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     WriteZero,
+     /// This operation was interrupted.
+     ///
+     /// Interrupted operations can typically be retried.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     Interrupted,
+     /// Any I/O error not part of this list.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     Other,
+ 
+     /// An error returned when an operation could not be completed because an
+@@ -165,15 +153,10 @@ pub enum ErrorKind {
+     /// This typically means that an operation could only succeed if it read a
+     /// particular number of bytes but only a smaller number of bytes could be
+     /// read.
+-    #[stable(feature = "read_exact", since = "1.6.0")]
+     UnexpectedEof,
+ 
+     /// A marker variant that tells the compiler that users of this enum cannot
+     /// match it exhaustively.
+-    #[unstable(feature = "io_error_internals",
+-               reason = "better expressed through extensible enums that this \
+-                         enum cannot be exhaustively matched against",
+-               issue = "0")]
+     #[doc(hidden)]
+     __Nonexhaustive,
+ }
+@@ -206,7 +189,6 @@ impl ErrorKind {
+ 
+ /// Intended for use for errors not exposed to the user, where allocating onto
+ /// the heap (for normal construction via Error::new) is too costly.
+-#[stable(feature = "io_error_from_errorkind", since = "1.14.0")]
+ impl From<ErrorKind> for Error {
+     #[inline]
+     fn from(kind: ErrorKind) -> Error {
+@@ -235,14 +217,13 @@ impl Error {
+     /// // errors can also be created from other errors
+     /// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new<E>(kind: ErrorKind, error: E) -> Error
+-        where E: Into<Box<error::Error+Send+Sync>>
++        where E: Into<String>
+     {
+         Self::_new(kind, error.into())
+     }
+ 
+-    fn _new(kind: ErrorKind, error: Box<error::Error+Send+Sync>) -> Error {
++    fn _new(kind: ErrorKind, error: String) -> Error {
+         Error {
+             repr: Repr::Custom(Box::new(Custom {
+                 kind: kind,
+@@ -251,24 +232,6 @@ impl Error {
+         }
+     }
+ 
+-    /// Returns an error representing the last OS error which occurred.
+-    ///
+-    /// This function reads the value of `errno` for the target platform (e.g.
+-    /// `GetLastError` on Windows) and will return a corresponding instance of
+-    /// `Error` for the error code.
+-    ///
+-    /// # Examples
+-    ///
+-    /// ```
+-    /// use std::io::Error;
+-    ///
+-    /// println!("last OS error: {:?}", Error::last_os_error());
+-    /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    pub fn last_os_error() -> Error {
+-        Error::from_raw_os_error(sys::os::errno() as i32)
+-    }
+-
+     /// Creates a new instance of an `Error` from a particular OS error code.
+     ///
+     /// # Examples
+@@ -294,7 +257,6 @@ impl Error {
+     /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn from_raw_os_error(code: i32) -> Error {
+         Error { repr: Repr::Os(code) }
+     }
+@@ -325,7 +287,6 @@ impl Error {
+     ///     print_os_error(&Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn raw_os_error(&self) -> Option<i32> {
+         match self.repr {
+             Repr::Os(i) => Some(i),
+@@ -359,12 +320,11 @@ impl Error {
+     ///     print_error(&Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn get_ref(&self) -> Option<&(error::Error+Send+Sync+'static)> {
++    pub fn get_ref(&self) -> Option<&String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+-            Repr::Custom(ref c) => Some(&*c.error),
++            Repr::Custom(ref c) => Some(&c.error),
+         }
+     }
+ 
+@@ -430,12 +390,11 @@ impl Error {
+     ///     print_error(&change_error(Error::new(ErrorKind::Other, MyError::new())));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn get_mut(&mut self) -> Option<&mut (error::Error+Send+Sync+'static)> {
++    pub fn get_mut(&mut self) -> Option<&mut String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+-            Repr::Custom(ref mut c) => Some(&mut *c.error),
++            Repr::Custom(ref mut c) => Some(&mut c.error),
+         }
+     }
+ 
+@@ -464,8 +423,7 @@ impl Error {
+     ///     print_error(Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn into_inner(self) -> Option<Box<error::Error+Send+Sync>> {
++    pub fn into_inner(self) -> Option<String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+@@ -491,10 +449,9 @@ impl Error {
+     ///     print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn kind(&self) -> ErrorKind {
+         match self.repr {
+-            Repr::Os(code) => sys::decode_error_kind(code),
++            Repr::Os(_code) => ErrorKind::Other,
+             Repr::Custom(ref c) => c.kind,
+             Repr::Simple(kind) => kind,
+         }
+@@ -505,21 +462,18 @@ impl fmt::Debug for Repr {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         match *self {
+             Repr::Os(ref code) =>
+-                fmt.debug_struct("Os").field("code", code)
+-                   .field("message", &sys::os::error_string(*code)).finish(),
++                fmt.debug_struct("Os").field("code", code).finish(),
+             Repr::Custom(ref c) => fmt.debug_tuple("Custom").field(c).finish(),
+             Repr::Simple(kind) => fmt.debug_tuple("Kind").field(&kind).finish(),
+         }
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl fmt::Display for Error {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         match self.repr {
+             Repr::Os(code) => {
+-                let detail = sys::os::error_string(code);
+-                write!(fmt, "{} (os error {})", detail, code)
++                write!(fmt, "os error {}", code)
+             }
+             Repr::Custom(ref c) => c.error.fmt(fmt),
+             Repr::Simple(kind) => write!(fmt, "{}", kind.as_str()),
+@@ -527,24 +481,6 @@ impl fmt::Display for Error {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl error::Error for Error {
+-    fn description(&self) -> &str {
+-        match self.repr {
+-            Repr::Os(..) | Repr::Simple(..) => self.kind().as_str(),
+-            Repr::Custom(ref c) => c.error.description(),
+-        }
+-    }
+-
+-    fn cause(&self) -> Option<&error::Error> {
+-        match self.repr {
+-            Repr::Os(..) => None,
+-            Repr::Simple(..) => None,
+-            Repr::Custom(ref c) => c.error.cause(),
+-        }
+-    }
+-}
+-
+ fn _assert_error_is_sync_send() {
+     fn _is_sync_send<T: Sync+Send>() {}
+     _is_sync_send::<Error>();
+diff --git a/impls.rs b/impls.rs
+index f691289..c4374d3 100644
+--- a/impls.rs
++++ b/impls.rs
+@@ -8,26 +8,31 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
+-use cmp;
+-use io::{self, SeekFrom, Read, Write, Seek, BufRead, Error, ErrorKind};
+-use fmt;
+-use mem;
++#[cfg(feature="alloc")] use alloc::boxed::Box;
++use core::cmp;
++use io::{self, SeekFrom, Read, Write, Seek, Error, ErrorKind};
++#[cfg(feature="collections")] use io::BufRead;
++use core::fmt;
++use core::mem;
++#[cfg(feature="collections")] use collections::string::String;
++#[cfg(feature="collections")] use collections::vec::Vec;
+ 
+ // =============================================================================
+ // Forwarding implementations
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, R: Read + ?Sized> Read for &'a mut R {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         (**self).read(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+         (**self).read_to_end(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+         (**self).read_to_string(buf)
+@@ -38,7 +43,6 @@ impl<'a, R: Read + ?Sized> Read for &'a mut R {
+         (**self).read_exact(buf)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, W: Write + ?Sized> Write for &'a mut W {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
+@@ -56,12 +60,11 @@ impl<'a, W: Write + ?Sized> Write for &'a mut W {
+         (**self).write_fmt(fmt)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, S: Seek + ?Sized> Seek for &'a mut S {
+     #[inline]
+     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
+@@ -80,18 +83,20 @@ impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<R: Read + ?Sized> Read for Box<R> {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         (**self).read(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+         (**self).read_to_end(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+         (**self).read_to_string(buf)
+@@ -102,7 +107,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
+         (**self).read_exact(buf)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<W: Write + ?Sized> Write for Box<W> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
+@@ -120,12 +125,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+         (**self).write_fmt(fmt)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<S: Seek + ?Sized> Seek for Box<S> {
+     #[inline]
+     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead + ?Sized> BufRead for Box<B> {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
+@@ -151,7 +156,6 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
+ ///
+ /// Note that reading updates the slice to point to the yet unread part.
+ /// The slice will be empty when EOF is reached.
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Read for &'a [u8] {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+@@ -193,7 +197,7 @@ impl<'a> Read for &'a [u8] {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<'a> BufRead for &'a [u8] {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
+@@ -207,7 +211,6 @@ impl<'a> BufRead for &'a [u8] {
+ ///
+ /// Note that writing updates the slice to point to the yet unwritten part.
+ /// The slice will be empty when it has been completely overwritten.
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Write for &'a mut [u8] {
+     #[inline]
+     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+@@ -233,7 +236,7 @@ impl<'a> Write for &'a mut [u8] {
+ 
+ /// Write is implemented for `Vec<u8>` by appending to the vector.
+ /// The vector will grow as needed.
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl Write for Vec<u8> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+diff --git a/memchr.rs b/memchr.rs
+index 3824a5f..312cf47 100644
+--- a/memchr.rs
++++ b/memchr.rs
+@@ -11,10 +11,12 @@
+ // Original implementation taken from rust-memchr
+ // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
+ 
++pub use self::fallback::{memchr,memrchr};
++
+ #[allow(dead_code)]
+ pub mod fallback {
+-    use cmp;
+-    use mem;
++    use core::cmp;
++    use core::mem;
+ 
+     const LO_U64: u64 = 0x0101010101010101;
+     const HI_U64: u64 = 0x8080808080808080;
+diff --git a/mod.rs b/mod.rs
+index c872a8e..7319e65 100644
+--- a/mod.rs
++++ b/mod.rs
+@@ -266,46 +266,34 @@
+ //! [`?` operator]: ../../book/syntax-index.html
+ //! [`Read::read`]: trait.Read.html#tymethod.read
+ 
+-#![stable(feature = "rust1", since = "1.0.0")]
+-
+-use cmp;
++use core::cmp;
+ use core::str as core_str;
+-use error as std_error;
+-use fmt;
+-use result;
+-use str;
+-use memchr;
+-
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::buffered::{BufReader, BufWriter, LineWriter};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::buffered::IntoInnerError;
+-#[stable(feature = "rust1", since = "1.0.0")]
++use core::fmt;
++use core::iter::{Iterator};
++use core::marker::Sized;
++#[cfg(feature="collections")] use core::ops::{Drop, FnOnce};
++use core::option::Option::{self, Some, None};
++use core::result::Result::{Ok, Err};
++use core::result;
++#[cfg(feature="collections")] use collections::string::String;
++use core::str;
++#[cfg(feature="collections")] use collections::vec::Vec;
++mod memchr;
++
++#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
++#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
+ pub use self::cursor::Cursor;
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub use self::error::{Result, Error, ErrorKind};
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::stdio::{stdin, stdout, stderr, Stdin, Stdout, Stderr};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::stdio::{StdoutLock, StderrLock, StdinLock};
+-#[unstable(feature = "print_internals", issue = "0")]
+-pub use self::stdio::{_print, _eprint};
+-#[unstable(feature = "libstd_io_internals", issue = "0")]
+-#[doc(no_inline, hidden)]
+-pub use self::stdio::{set_panic, set_print};
+ 
+ pub mod prelude;
+-mod buffered;
++#[cfg(feature="collections")] mod buffered;
+ mod cursor;
+ mod error;
+ mod impls;
+-mod lazy;
+ mod util;
+-mod stdio;
+ 
+-const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
++const DEFAULT_BUF_SIZE: usize = 8 * 1024;
+ 
+ // A few methods below (read_to_string, read_line) will append data into a
+ // `String` buffer, but we need to be pretty careful when doing this. The
+@@ -325,6 +313,7 @@ const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
+ // 2. We're passing a raw buffer to the function `f`, and it is expected that
+ //    the function only *appends* bytes to the buffer. We'll get undefined
+ //    behavior if existing bytes are overwritten to have non-UTF-8 data.
++#[cfg(feature="collections")]
+ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
+     where F: FnOnce(&mut Vec<u8>) -> Result<usize>
+ {
+@@ -356,6 +345,7 @@ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
+ // of data to return. Simply tacking on an extra DEFAULT_BUF_SIZE space every
+ // time is 4,500 times (!) slower than this if the reader has a very small
+ // amount of data to return.
++#[cfg(feature="collections")]
+ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> {
+     let start_len = buf.len();
+     let mut len = start_len;
+@@ -438,7 +428,6 @@ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize>
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Read {
+     /// Pull some bytes from this source into the specified buffer, returning
+     /// how many bytes were read.
+@@ -491,7 +480,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
+ 
+     /// Read all bytes until EOF in this source, placing them into `buf`.
+@@ -533,7 +521,7 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
++    #[cfg(feature="collections")]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
+         read_to_end(self, buf)
+     }
+@@ -571,7 +559,7 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
++    #[cfg(feature="collections")]
+     fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
+         // Note that we do *not* call `.read_to_end()` here. We are passing
+         // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
+@@ -632,7 +620,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "read_exact", since = "1.6.0")]
+     fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
+         while !buf.is_empty() {
+             match self.read(buf) {
+@@ -684,7 +671,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
+ 
+     /// Transforms this `Read` instance to an `Iterator` over its bytes.
+@@ -714,7 +700,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn bytes(self) -> Bytes<Self> where Self: Sized {
+         Bytes { inner: self }
+     }
+@@ -751,10 +736,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "io", reason = "the semantics of a partial read/write \
+-                                         of where errors happen is currently \
+-                                         unclear and may change",
+-               issue = "27802")]
+     fn chars(self) -> Chars<Self> where Self: Sized {
+         Chars { inner: self }
+     }
+@@ -789,7 +770,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
+         Chain { first: self, second: next, done_first: false }
+     }
+@@ -823,7 +803,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn take(self, limit: u64) -> Take<Self> where Self: Sized {
+         Take { inner: self, limit: limit }
+     }
+@@ -863,7 +842,6 @@ pub trait Read {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Write {
+     /// Write a buffer into this object, returning how many bytes were written.
+     ///
+@@ -907,7 +885,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write(&mut self, buf: &[u8]) -> Result<usize>;
+ 
+     /// Flush this output stream, ensuring that all intermediately buffered
+@@ -933,7 +910,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn flush(&mut self) -> Result<()>;
+ 
+     /// Attempts to write an entire buffer into this write.
+@@ -963,7 +939,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
+         while !buf.is_empty() {
+             match self.write(buf) {
+@@ -1015,7 +990,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
+         // Create a shim which translates a Write to a fmt::Write and saves
+         // off I/O errors. instead of discarding them
+@@ -1071,7 +1045,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
+ }
+ 
+@@ -1101,7 +1074,6 @@ pub trait Write {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Seek {
+     /// Seek to an offset, in bytes, in a stream.
+     ///
+@@ -1117,7 +1089,6 @@ pub trait Seek {
+     /// Seeking to a negative offset is considered an error.
+     ///
+     /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
+ }
+ 
+@@ -1127,29 +1098,26 @@ pub trait Seek {
+ ///
+ /// [`Seek`]: trait.Seek.html
+ #[derive(Copy, PartialEq, Eq, Clone, Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub enum SeekFrom {
+     /// Set the offset to the provided number of bytes.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    Start(#[stable(feature = "rust1", since = "1.0.0")] u64),
++    Start(u64),
+ 
+     /// Set the offset to the size of this object plus the specified number of
+     /// bytes.
+     ///
+     /// It is possible to seek beyond the end of an object, but it's an error to
+     /// seek before byte 0.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    End(#[stable(feature = "rust1", since = "1.0.0")] i64),
++    End(i64),
+ 
+     /// Set the offset to the current position plus the specified number of
+     /// bytes.
+     ///
+     /// It is possible to seek beyond the end of an object, but it's an error to
+     /// seek before byte 0.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    Current(#[stable(feature = "rust1", since = "1.0.0")] i64),
++    Current(i64),
+ }
+ 
++#[cfg(feature="collections")]
+ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
+                                    -> Result<usize> {
+     let mut read = 0;
+@@ -1229,7 +1197,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
+ /// # }
+ /// ```
+ ///
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ pub trait BufRead: Read {
+     /// Fills the internal buffer of this object, returning the buffer contents.
+     ///
+@@ -1274,7 +1242,6 @@ pub trait BufRead: Read {
+     /// // ensure the bytes we worked with aren't returned again later
+     /// stdin.consume(length);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn fill_buf(&mut self) -> Result<&[u8]>;
+ 
+     /// Tells this buffer that `amt` bytes have been consumed from the buffer,
+@@ -1296,7 +1263,6 @@ pub trait BufRead: Read {
+     /// that method's example includes an example of `consume()`.
+     ///
+     /// [`fill_buf`]: #tymethod.fill_buf
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn consume(&mut self, amt: usize);
+ 
+     /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
+@@ -1352,7 +1318,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(num_bytes, 0);
+     /// assert_eq!(buf, b"");
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
+         read_until(self, byte, buf)
+     }
+@@ -1407,7 +1372,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(num_bytes, 0);
+     /// assert_eq!(buf, "");
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read_line(&mut self, buf: &mut String) -> Result<usize> {
+         // Note that we are not calling the `.read_until` method here, but
+         // rather our hardcoded implementation. For more details as to why, see
+@@ -1448,7 +1412,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
+     /// assert_eq!(split_iter.next(), None);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn split(self, byte: u8) -> Split<Self> where Self: Sized {
+         Split { buf: self, delim: byte }
+     }
+@@ -1487,7 +1450,6 @@ pub trait BufRead: Read {
+     /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
+     ///
+     /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn lines(self) -> Lines<Self> where Self: Sized {
+         Lines { buf: self }
+     }
+@@ -1499,7 +1461,6 @@ pub trait BufRead: Read {
+ /// Please see the documentation of [`chain`] for more details.
+ ///
+ /// [`chain`]: trait.Read.html#method.chain
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Chain<T, U> {
+     first: T,
+     second: U,
+@@ -1527,7 +1488,6 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn into_inner(self) -> (T, U) {
+         (self.first, self.second)
+     }
+@@ -1552,7 +1512,6 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_ref(&self) -> (&T, &U) {
+         (&self.first, &self.second)
+     }
+@@ -1581,13 +1540,11 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_mut(&mut self) -> (&mut T, &mut U) {
+         (&mut self.first, &mut self.second)
+     }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.debug_struct("Chain")
+@@ -1597,7 +1554,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T: Read, U: Read> Read for Chain<T, U> {
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
+         if !self.done_first {
+@@ -1610,7 +1566,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
+     }
+ }
+ 
+-#[stable(feature = "chain_bufread", since = "1.9.0")]
++#[cfg(feature="collections")]
+ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
+     fn fill_buf(&mut self) -> Result<&[u8]> {
+         if !self.done_first {
+@@ -1637,7 +1593,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
+ /// Please see the documentation of [`take`] for more details.
+ ///
+ /// [`take`]: trait.Read.html#method.take
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Debug)]
+ pub struct Take<T> {
+     inner: T,
+@@ -1672,7 +1627,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn limit(&self) -> u64 { self.limit }
+ 
+     /// Consumes the `Take`, returning the wrapped reader.
+@@ -1695,7 +1649,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "io_take_into_inner", since = "1.15.0")]
+     pub fn into_inner(self) -> T {
+         self.inner
+     }
+@@ -1722,7 +1675,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_ref(&self) -> &T {
+         &self.inner
+     }
+@@ -1753,13 +1705,11 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_mut(&mut self) -> &mut T {
+         &mut self.inner
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T: Read> Read for Take<T> {
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
+         // Don't call into inner reader at all at EOF because it may still block
+@@ -1774,7 +1724,7 @@ impl<T: Read> Read for Take<T> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<T: BufRead> BufRead for Take<T> {
+     fn fill_buf(&mut self) -> Result<&[u8]> {
+         // Don't call into inner reader at all at EOF because it may still block
+@@ -1813,13 +1763,11 @@ fn read_one_byte(reader: &mut Read) -> Option<Result<u8>> {
+ /// Please see the documentation of [`bytes`] for more details.
+ ///
+ /// [`bytes`]: trait.Read.html#method.bytes
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Debug)]
+ pub struct Bytes<R> {
+     inner: R,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> Iterator for Bytes<R> {
+     type Item = Result<u8>;
+ 
+@@ -1834,8 +1782,6 @@ impl<R: Read> Iterator for Bytes<R> {
+ /// Please see the documentation of `chars()` for more details.
+ ///
+ /// [chars]: trait.Read.html#method.chars
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ #[derive(Debug)]
+ pub struct Chars<R> {
+     inner: R,
+@@ -1844,8 +1790,6 @@ pub struct Chars<R> {
+ /// An enumeration of possible errors that can be generated from the `Chars`
+ /// adapter.
+ #[derive(Debug)]
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ pub enum CharsError {
+     /// Variant representing that the underlying stream was read successfully
+     /// but it did not contain valid utf8 data.
+@@ -1855,8 +1799,6 @@ pub enum CharsError {
+     Other(Error),
+ }
+ 
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ impl<R: Read> Iterator for Chars<R> {
+     type Item = result::Result<char, CharsError>;
+ 
+@@ -1888,25 +1830,6 @@ impl<R: Read> Iterator for Chars<R> {
+     }
+ }
+ 
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+-impl std_error::Error for CharsError {
+-    fn description(&self) -> &str {
+-        match *self {
+-            CharsError::NotUtf8 => "invalid utf8 encoding",
+-            CharsError::Other(ref e) => std_error::Error::description(e),
+-        }
+-    }
+-    fn cause(&self) -> Option<&std_error::Error> {
+-        match *self {
+-            CharsError::NotUtf8 => None,
+-            CharsError::Other(ref e) => e.cause(),
+-        }
+-    }
+-}
+-
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ impl fmt::Display for CharsError {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         match *self {
+@@ -1925,14 +1848,14 @@ impl fmt::Display for CharsError {
+ /// `BufRead`. Please see the documentation of `split()` for more details.
+ ///
+ /// [split]: trait.BufRead.html#method.split
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ #[derive(Debug)]
+ pub struct Split<B> {
+     buf: B,
+     delim: u8,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead> Iterator for Split<B> {
+     type Item = Result<Vec<u8>>;
+ 
+@@ -1957,13 +1880,13 @@ impl<B: BufRead> Iterator for Split<B> {
+ /// `BufRead`. Please see the documentation of `lines()` for more details.
+ ///
+ /// [lines]: trait.BufRead.html#method.lines
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ #[derive(Debug)]
+ pub struct Lines<B> {
+     buf: B,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead> Iterator for Lines<B> {
+     type Item = Result<String>;
+ 
+diff --git a/prelude.rs b/prelude.rs
+index 8772d0f..49d66c9 100644
+--- a/prelude.rs
++++ b/prelude.rs
+@@ -18,7 +18,8 @@
+ //! use std::io::prelude::*;
+ //! ```
+ 
+-#![stable(feature = "rust1", since = "1.0.0")]
++pub use super::{Read, Write, Seek};
++#[cfg(feature="collections")] pub use super::BufRead;
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use super::{Read, Write, BufRead, Seek};
++#[cfg(feature="collections")] pub use alloc::boxed::Box;
++#[cfg(feature="collections")] pub use collections::vec::Vec;
+diff --git a/util.rs b/util.rs
+index 078f1ad..fd13c98 100644
+--- a/util.rs
++++ b/util.rs
+@@ -10,8 +10,9 @@
+ 
+ #![allow(missing_copy_implementations)]
+ 
+-use fmt;
+-use io::{self, Read, Write, ErrorKind, BufRead};
++use core::fmt;
++use io::{self, Read, Write, ErrorKind};
++#[cfg(feature="collections")] use io::BufRead;
+ 
+ /// Copies the entire contents of a reader into a writer.
+ ///
+@@ -43,7 +44,6 @@ use io::{self, Read, Write, ErrorKind, BufRead};
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<u64>
+     where R: Read, W: Write
+ {
+@@ -67,7 +67,6 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
+ /// the documentation of `empty()` for more details.
+ ///
+ /// [empty]: fn.empty.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Empty { _priv: () }
+ 
+ /// Constructs a new handle to an empty reader.
+@@ -85,20 +84,18 @@ pub struct Empty { _priv: () }
+ /// io::empty().read_to_string(&mut buffer).unwrap();
+ /// assert!(buffer.is_empty());
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn empty() -> Empty { Empty { _priv: () } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Read for Empty {
+     fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> { Ok(0) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++
++#[cfg(feature="collections")]
+ impl BufRead for Empty {
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(&[]) }
+     fn consume(&mut self, _n: usize) {}
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Empty {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Empty { .. }")
+@@ -111,7 +108,6 @@ impl fmt::Debug for Empty {
+ /// see the documentation of `repeat()` for more details.
+ ///
+ /// [repeat]: fn.repeat.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Repeat { byte: u8 }
+ 
+ /// Creates an instance of a reader that infinitely repeats one byte.
+@@ -128,10 +124,8 @@ pub struct Repeat { byte: u8 }
+ /// io::repeat(0b101).read_exact(&mut buffer).unwrap();
+ /// assert_eq!(buffer, [0b101, 0b101, 0b101]);
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Read for Repeat {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         for slot in &mut *buf {
+@@ -141,7 +135,6 @@ impl Read for Repeat {
+     }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Repeat {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Repeat { .. }")
+@@ -154,7 +147,6 @@ impl fmt::Debug for Repeat {
+ /// see the documentation of `sink()` for more details.
+ ///
+ /// [sink]: fn.sink.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Sink { _priv: () }
+ 
+ /// Creates an instance of a writer which will successfully consume all data.
+@@ -171,16 +163,13 @@ pub struct Sink { _priv: () }
+ /// let num_bytes = io::sink().write(&buffer).unwrap();
+ /// assert_eq!(num_bytes, 5);
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn sink() -> Sink { Sink { _priv: () } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Write for Sink {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Sink {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Sink { .. }")

+ 1549 - 0
patches/5f62b2716fb3f11bcbe00bd32ca2ca2b9de94a11.patch

@@ -0,0 +1,1549 @@
+diff --git a/buffered.rs b/buffered.rs
+index 3b82412..0566d0f 100644
+--- a/buffered.rs
++++ b/buffered.rs
+@@ -10,13 +10,13 @@
+ 
+ //! Buffering wrappers for I/O traits
+ 
++use core::prelude::v1::*;
+ use io::prelude::*;
+ 
+-use cmp;
+-use error;
+-use fmt;
++use core::cmp;
++use core::fmt;
+ use io::{self, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom};
+-use memchr;
++use io::memchr;
+ 
+ /// The `BufReader` struct adds buffering to any reader.
+ ///
+@@ -46,7 +46,6 @@ use memchr;
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct BufReader<R> {
+     inner: R,
+     buf: Box<[u8]>,
+@@ -69,7 +68,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: R) -> BufReader<R> {
+         BufReader::with_capacity(DEFAULT_BUF_SIZE, inner)
+     }
+@@ -90,7 +88,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: R) -> BufReader<R> {
+         BufReader {
+             inner: inner,
+@@ -118,7 +115,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &R { &self.inner }
+ 
+     /// Gets a mutable reference to the underlying reader.
+@@ -139,7 +135,6 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut R { &mut self.inner }
+ 
+     /// Unwraps this `BufReader`, returning the underlying reader.
+@@ -160,11 +155,9 @@ impl<R: Read> BufReader<R> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> R { self.inner }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> Read for BufReader<R> {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         // If we don't have any buffered data and we're doing a massive read
+@@ -182,7 +175,6 @@ impl<R: Read> Read for BufReader<R> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> BufRead for BufReader<R> {
+     fn fill_buf(&mut self) -> io::Result<&[u8]> {
+         // If we've reached the end of our internal buffer then we need to fetch
+@@ -202,7 +194,6 @@ impl<R: Read> BufRead for BufReader<R> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("BufReader")
+@@ -212,7 +203,6 @@ impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Seek> Seek for BufReader<R> {
+     /// Seek to an offset, in bytes, in the underlying reader.
+     ///
+@@ -306,7 +296,6 @@ impl<R: Seek> Seek for BufReader<R> {
+ /// [`Write`]: ../../std/io/trait.Write.html
+ /// [`Tcpstream::write`]: ../../std/net/struct.TcpStream.html#method.write
+ /// [`TcpStream`]: ../../std/net/struct.TcpStream.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct BufWriter<W: Write> {
+     inner: Option<W>,
+     buf: Vec<u8>,
+@@ -341,7 +330,6 @@ pub struct BufWriter<W: Write> {
+ /// };
+ /// ```
+ #[derive(Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct IntoInnerError<W>(W, Error);
+ 
+ impl<W: Write> BufWriter<W> {
+@@ -355,7 +343,6 @@ impl<W: Write> BufWriter<W> {
+     ///
+     /// let mut buffer = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap());
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: W) -> BufWriter<W> {
+         BufWriter::with_capacity(DEFAULT_BUF_SIZE, inner)
+     }
+@@ -373,7 +360,6 @@ impl<W: Write> BufWriter<W> {
+     /// let stream = TcpStream::connect("127.0.0.1:34254").unwrap();
+     /// let mut buffer = BufWriter::with_capacity(100, stream);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: W) -> BufWriter<W> {
+         BufWriter {
+             inner: Some(inner),
+@@ -422,7 +408,6 @@ impl<W: Write> BufWriter<W> {
+     /// // we can use reference just like buffer
+     /// let reference = buffer.get_ref();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &W { self.inner.as_ref().unwrap() }
+ 
+     /// Gets a mutable reference to the underlying writer.
+@@ -440,7 +425,6 @@ impl<W: Write> BufWriter<W> {
+     /// // we can use reference just like buffer
+     /// let reference = buffer.get_mut();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut W { self.inner.as_mut().unwrap() }
+ 
+     /// Unwraps this `BufWriter`, returning the underlying writer.
+@@ -458,7 +442,6 @@ impl<W: Write> BufWriter<W> {
+     /// // unwrap the TcpStream and flush the buffer
+     /// let stream = buffer.into_inner().unwrap();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(mut self) -> Result<W, IntoInnerError<BufWriter<W>>> {
+         match self.flush_buf() {
+             Err(e) => Err(IntoInnerError(self, e)),
+@@ -467,7 +450,6 @@ impl<W: Write> BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Write for BufWriter<W> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         if self.buf.len() + buf.len() > self.buf.capacity() {
+@@ -487,7 +469,6 @@ impl<W: Write> Write for BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("BufWriter")
+@@ -497,7 +478,6 @@ impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write + Seek> Seek for BufWriter<W> {
+     /// Seek to the offset, in bytes, in the underlying writer.
+     ///
+@@ -507,7 +487,6 @@ impl<W: Write + Seek> Seek for BufWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Drop for BufWriter<W> {
+     fn drop(&mut self) {
+         if self.inner.is_some() && !self.panicked {
+@@ -546,7 +525,6 @@ impl<W> IntoInnerError<W> {
+     ///     }
+     /// };
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn error(&self) -> &Error { &self.1 }
+ 
+     /// Returns the buffered writer instance which generated the error.
+@@ -579,23 +557,13 @@ impl<W> IntoInnerError<W> {
+     ///     }
+     /// };
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> W { self.0 }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W> From<IntoInnerError<W>> for Error {
+     fn from(iie: IntoInnerError<W>) -> Error { iie.1 }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
+-    fn description(&self) -> &str {
+-        error::Error::description(self.error())
+-    }
+-}
+-
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W> fmt::Display for IntoInnerError<W> {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         self.error().fmt(f)
+@@ -650,7 +618,6 @@ impl<W> fmt::Display for IntoInnerError<W> {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct LineWriter<W: Write> {
+     inner: BufWriter<W>,
+     need_flush: bool,
+@@ -671,7 +638,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: W) -> LineWriter<W> {
+         // Lines typically aren't that long, don't use a giant buffer
+         LineWriter::with_capacity(1024, inner)
+@@ -692,7 +658,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn with_capacity(cap: usize, inner: W) -> LineWriter<W> {
+         LineWriter {
+             inner: BufWriter::with_capacity(cap, inner),
+@@ -716,7 +681,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &W { self.inner.get_ref() }
+ 
+     /// Gets a mutable reference to the underlying writer.
+@@ -739,7 +703,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut W { self.inner.get_mut() }
+ 
+     /// Unwraps this `LineWriter`, returning the underlying writer.
+@@ -761,7 +724,6 @@ impl<W: Write> LineWriter<W> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>> {
+         self.inner.into_inner().map_err(|IntoInnerError(buf, e)| {
+             IntoInnerError(LineWriter {
+@@ -772,7 +734,6 @@ impl<W: Write> LineWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> Write for LineWriter<W> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         if self.need_flush {
+@@ -817,7 +778,6 @@ impl<W: Write> Write for LineWriter<W> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         fmt.debug_struct("LineWriter")
+diff --git a/cursor.rs b/cursor.rs
+index 53347eb..637f4e0 100644
+--- a/cursor.rs
++++ b/cursor.rs
+@@ -8,10 +8,11 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
++use core::prelude::v1::*;
+ use io::prelude::*;
+ 
+-use core::convert::TryInto;
+-use cmp;
++#[cfg(feature = "collections")] use core::convert::TryInto;
++use core::cmp;
+ use io::{self, SeekFrom, Error, ErrorKind};
+ 
+ /// A `Cursor` wraps another type and provides it with a
+@@ -79,7 +80,6 @@ use io::{self, SeekFrom, Error, ErrorKind};
+ ///     assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
+ /// }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Clone, Debug)]
+ pub struct Cursor<T> {
+     inner: T,
+@@ -102,7 +102,6 @@ impl<T> Cursor<T> {
+     /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
+     /// # force_inference(&buff);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new(inner: T) -> Cursor<T> {
+         Cursor { pos: 0, inner: inner }
+     }
+@@ -120,7 +119,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let vec = buff.into_inner();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn into_inner(self) -> T { self.inner }
+ 
+     /// Gets a reference to the underlying value in this cursor.
+@@ -136,7 +134,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let reference = buff.get_ref();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_ref(&self) -> &T { &self.inner }
+ 
+     /// Gets a mutable reference to the underlying value in this cursor.
+@@ -155,7 +152,6 @@ impl<T> Cursor<T> {
+     ///
+     /// let reference = buff.get_mut();
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
+ 
+     /// Returns the current position of this cursor.
+@@ -177,7 +173,6 @@ impl<T> Cursor<T> {
+     /// buff.seek(SeekFrom::Current(-1)).unwrap();
+     /// assert_eq!(buff.position(), 1);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn position(&self) -> u64 { self.pos }
+ 
+     /// Sets the position of this cursor.
+@@ -197,11 +192,9 @@ impl<T> Cursor<T> {
+     /// buff.set_position(4);
+     /// assert_eq!(buff.position(), 4);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn set_position(&mut self, pos: u64) { self.pos = pos; }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
+     fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
+         let (base_pos, offset) = match style {
+@@ -222,25 +215,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+-        let n = Read::read(&mut self.fill_buf()?, buf)?;
++        let n = Read::read(&mut self.get_buf()?, buf)?;
+         self.pos += n as u64;
+         Ok(n)
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
+-    fn fill_buf(&mut self) -> io::Result<&[u8]> {
++impl<T> Cursor<T> where T: AsRef<[u8]> {
++    fn get_buf(&mut self) -> io::Result<&[u8]> {
+         let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
+         Ok(&self.inner.as_ref()[(amt as usize)..])
+     }
++}
++
++#[cfg(feature = "collections")]
++impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
++    fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
+     fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Write for Cursor<&'a mut [u8]> {
+     #[inline]
+     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+@@ -252,7 +247,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature = "collections")]
+ impl Write for Cursor<Vec<u8>> {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         let pos: usize = self.position().try_into().map_err(|_| {
+@@ -282,8 +277,8 @@ impl Write for Cursor<Vec<u8>> {
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
+-impl Write for Cursor<Box<[u8]>> {
++#[cfg(feature = "alloc")]
++impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+         let pos = cmp::min(self.pos, self.inner.len() as u64);
+diff --git a/error.rs b/error.rs
+index fb67eaf..1c9f15e 100644
+--- a/error.rs
++++ b/error.rs
+@@ -8,11 +8,16 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
+-use error;
+-use fmt;
+-use result;
+-use sys;
+-use convert::From;
++#[cfg(feature="alloc")] use alloc::boxed::Box;
++#[cfg(not(feature="alloc"))] use ::FakeBox as Box;
++use core::convert::Into;
++use core::fmt;
++use core::marker::{Send, Sync};
++use core::option::Option::{self, Some, None};
++use core::result;
++#[cfg(feature="collections")] use collections::string::String;
++#[cfg(not(feature="collections"))] use ::ErrorString as String;
++use core::convert::From;
+ 
+ /// A specialized [`Result`](../result/enum.Result.html) type for I/O
+ /// operations.
+@@ -44,7 +49,6 @@ use convert::From;
+ ///     Ok(buffer)
+ /// }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub type Result<T> = result::Result<T, Error>;
+ 
+ /// The error type for I/O operations of the `Read`, `Write`, `Seek`, and
+@@ -56,7 +60,6 @@ pub type Result<T> = result::Result<T, Error>;
+ ///
+ /// [`ErrorKind`]: enum.ErrorKind.html
+ #[derive(Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Error {
+     repr: Repr,
+ }
+@@ -64,13 +67,16 @@ pub struct Error {
+ enum Repr {
+     Os(i32),
+     Simple(ErrorKind),
++    #[cfg(feature="alloc")]
+     Custom(Box<Custom>),
++    #[cfg(not(feature="alloc"))]
++    Custom(Custom),
+ }
+ 
+ #[derive(Debug)]
+ struct Custom {
+     kind: ErrorKind,
+-    error: Box<error::Error+Send+Sync>,
++    error: String,
+ }
+ 
+ /// A list specifying general categories of I/O error.
+@@ -82,47 +88,34 @@ struct Custom {
+ ///
+ /// [`io::Error`]: struct.Error.html
+ #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[allow(deprecated)]
+ pub enum ErrorKind {
+     /// An entity was not found, often a file.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     NotFound,
+     /// The operation lacked the necessary privileges to complete.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     PermissionDenied,
+     /// The connection was refused by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionRefused,
+     /// The connection was reset by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionReset,
+     /// The connection was aborted (terminated) by the remote server.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     ConnectionAborted,
+     /// The network operation failed because it was not connected yet.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     NotConnected,
+     /// A socket address could not be bound because the address is already in
+     /// use elsewhere.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AddrInUse,
+     /// A nonexistent interface was requested or the requested address was not
+     /// local.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AddrNotAvailable,
+     /// The operation failed because a pipe was closed.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     BrokenPipe,
+     /// An entity already exists, often a file.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     AlreadyExists,
+     /// The operation needs to block to complete, but the blocking operation was
+     /// requested to not occur.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     WouldBlock,
+     /// A parameter was incorrect.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     InvalidInput,
+     /// Data not valid for the operation were encountered.
+     ///
+@@ -134,10 +127,8 @@ pub enum ErrorKind {
+     /// `InvalidData` if the file's contents are not valid UTF-8.
+     ///
+     /// [`InvalidInput`]: #variant.InvalidInput
+-    #[stable(feature = "io_invalid_data", since = "1.2.0")]
+     InvalidData,
+     /// The I/O operation's timeout expired, causing it to be canceled.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     TimedOut,
+     /// An error returned when an operation could not be completed because a
+     /// call to [`write`] returned [`Ok(0)`].
+@@ -148,15 +139,12 @@ pub enum ErrorKind {
+     ///
+     /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
+     /// [`Ok(0)`]: ../../std/io/type.Result.html
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     WriteZero,
+     /// This operation was interrupted.
+     ///
+     /// Interrupted operations can typically be retried.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     Interrupted,
+     /// Any I/O error not part of this list.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     Other,
+ 
+     /// An error returned when an operation could not be completed because an
+@@ -165,15 +153,10 @@ pub enum ErrorKind {
+     /// This typically means that an operation could only succeed if it read a
+     /// particular number of bytes but only a smaller number of bytes could be
+     /// read.
+-    #[stable(feature = "read_exact", since = "1.6.0")]
+     UnexpectedEof,
+ 
+     /// A marker variant that tells the compiler that users of this enum cannot
+     /// match it exhaustively.
+-    #[unstable(feature = "io_error_internals",
+-               reason = "better expressed through extensible enums that this \
+-                         enum cannot be exhaustively matched against",
+-               issue = "0")]
+     #[doc(hidden)]
+     __Nonexhaustive,
+ }
+@@ -206,7 +189,6 @@ impl ErrorKind {
+ 
+ /// Intended for use for errors not exposed to the user, where allocating onto
+ /// the heap (for normal construction via Error::new) is too costly.
+-#[stable(feature = "io_error_from_errorkind", since = "1.14.0")]
+ impl From<ErrorKind> for Error {
+     fn from(kind: ErrorKind) -> Error {
+         Error {
+@@ -234,14 +216,13 @@ impl Error {
+     /// // errors can also be created from other errors
+     /// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn new<E>(kind: ErrorKind, error: E) -> Error
+-        where E: Into<Box<error::Error+Send+Sync>>
++        where E: Into<String>
+     {
+         Self::_new(kind, error.into())
+     }
+ 
+-    fn _new(kind: ErrorKind, error: Box<error::Error+Send+Sync>) -> Error {
++    fn _new(kind: ErrorKind, error: String) -> Error {
+         Error {
+             repr: Repr::Custom(Box::new(Custom {
+                 kind: kind,
+@@ -250,24 +231,6 @@ impl Error {
+         }
+     }
+ 
+-    /// Returns an error representing the last OS error which occurred.
+-    ///
+-    /// This function reads the value of `errno` for the target platform (e.g.
+-    /// `GetLastError` on Windows) and will return a corresponding instance of
+-    /// `Error` for the error code.
+-    ///
+-    /// # Examples
+-    ///
+-    /// ```
+-    /// use std::io::Error;
+-    ///
+-    /// println!("last OS error: {:?}", Error::last_os_error());
+-    /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    pub fn last_os_error() -> Error {
+-        Error::from_raw_os_error(sys::os::errno() as i32)
+-    }
+-
+     /// Creates a new instance of an `Error` from a particular OS error code.
+     ///
+     /// # Examples
+@@ -293,7 +256,6 @@ impl Error {
+     /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn from_raw_os_error(code: i32) -> Error {
+         Error { repr: Repr::Os(code) }
+     }
+@@ -324,7 +286,6 @@ impl Error {
+     ///     print_os_error(&Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn raw_os_error(&self) -> Option<i32> {
+         match self.repr {
+             Repr::Os(i) => Some(i),
+@@ -358,12 +319,11 @@ impl Error {
+     ///     print_error(&Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn get_ref(&self) -> Option<&(error::Error+Send+Sync+'static)> {
++    pub fn get_ref(&self) -> Option<&String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+-            Repr::Custom(ref c) => Some(&*c.error),
++            Repr::Custom(ref c) => Some(&c.error),
+         }
+     }
+ 
+@@ -429,12 +389,11 @@ impl Error {
+     ///     print_error(&change_error(Error::new(ErrorKind::Other, MyError::new())));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn get_mut(&mut self) -> Option<&mut (error::Error+Send+Sync+'static)> {
++    pub fn get_mut(&mut self) -> Option<&mut String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+-            Repr::Custom(ref mut c) => Some(&mut *c.error),
++            Repr::Custom(ref mut c) => Some(&mut c.error),
+         }
+     }
+ 
+@@ -463,8 +422,7 @@ impl Error {
+     ///     print_error(Error::new(ErrorKind::Other, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "io_error_inner", since = "1.3.0")]
+-    pub fn into_inner(self) -> Option<Box<error::Error+Send+Sync>> {
++    pub fn into_inner(self) -> Option<String> {
+         match self.repr {
+             Repr::Os(..) => None,
+             Repr::Simple(..) => None,
+@@ -490,10 +448,9 @@ impl Error {
+     ///     print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
+     /// }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn kind(&self) -> ErrorKind {
+         match self.repr {
+-            Repr::Os(code) => sys::decode_error_kind(code),
++            Repr::Os(_code) => ErrorKind::Other,
+             Repr::Custom(ref c) => c.kind,
+             Repr::Simple(kind) => kind,
+         }
+@@ -504,21 +461,18 @@ impl fmt::Debug for Repr {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         match *self {
+             Repr::Os(ref code) =>
+-                fmt.debug_struct("Os").field("code", code)
+-                   .field("message", &sys::os::error_string(*code)).finish(),
++                fmt.debug_struct("Os").field("code", code).finish(),
+             Repr::Custom(ref c) => fmt.debug_tuple("Custom").field(c).finish(),
+             Repr::Simple(kind) => fmt.debug_tuple("Kind").field(&kind).finish(),
+         }
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl fmt::Display for Error {
+     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+         match self.repr {
+             Repr::Os(code) => {
+-                let detail = sys::os::error_string(code);
+-                write!(fmt, "{} (os error {})", detail, code)
++                write!(fmt, "os error {}", code)
+             }
+             Repr::Custom(ref c) => c.error.fmt(fmt),
+             Repr::Simple(kind) => write!(fmt, "{}", kind.as_str()),
+@@ -526,24 +480,6 @@ impl fmt::Display for Error {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-impl error::Error for Error {
+-    fn description(&self) -> &str {
+-        match self.repr {
+-            Repr::Os(..) | Repr::Simple(..) => self.kind().as_str(),
+-            Repr::Custom(ref c) => c.error.description(),
+-        }
+-    }
+-
+-    fn cause(&self) -> Option<&error::Error> {
+-        match self.repr {
+-            Repr::Os(..) => None,
+-            Repr::Simple(..) => None,
+-            Repr::Custom(ref c) => c.error.cause(),
+-        }
+-    }
+-}
+-
+ fn _assert_error_is_sync_send() {
+     fn _is_sync_send<T: Sync+Send>() {}
+     _is_sync_send::<Error>();
+diff --git a/impls.rs b/impls.rs
+index f691289..c4374d3 100644
+--- a/impls.rs
++++ b/impls.rs
+@@ -8,26 +8,31 @@
+ // option. This file may not be copied, modified, or distributed
+ // except according to those terms.
+ 
+-use cmp;
+-use io::{self, SeekFrom, Read, Write, Seek, BufRead, Error, ErrorKind};
+-use fmt;
+-use mem;
++#[cfg(feature="alloc")] use alloc::boxed::Box;
++use core::cmp;
++use io::{self, SeekFrom, Read, Write, Seek, Error, ErrorKind};
++#[cfg(feature="collections")] use io::BufRead;
++use core::fmt;
++use core::mem;
++#[cfg(feature="collections")] use collections::string::String;
++#[cfg(feature="collections")] use collections::vec::Vec;
+ 
+ // =============================================================================
+ // Forwarding implementations
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, R: Read + ?Sized> Read for &'a mut R {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         (**self).read(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+         (**self).read_to_end(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+         (**self).read_to_string(buf)
+@@ -38,7 +43,6 @@ impl<'a, R: Read + ?Sized> Read for &'a mut R {
+         (**self).read_exact(buf)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, W: Write + ?Sized> Write for &'a mut W {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
+@@ -56,12 +60,11 @@ impl<'a, W: Write + ?Sized> Write for &'a mut W {
+         (**self).write_fmt(fmt)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a, S: Seek + ?Sized> Seek for &'a mut S {
+     #[inline]
+     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
+@@ -80,18 +83,20 @@ impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<R: Read + ?Sized> Read for Box<R> {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         (**self).read(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+         (**self).read_to_end(buf)
+     }
+ 
++    #[cfg(feature="collections")]
+     #[inline]
+     fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+         (**self).read_to_string(buf)
+@@ -102,7 +107,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
+         (**self).read_exact(buf)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<W: Write + ?Sized> Write for Box<W> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
+@@ -120,12 +125,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+         (**self).write_fmt(fmt)
+     }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="alloc")]
+ impl<S: Seek + ?Sized> Seek for Box<S> {
+     #[inline]
+     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead + ?Sized> BufRead for Box<B> {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
+@@ -151,7 +156,6 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
+ ///
+ /// Note that reading updates the slice to point to the yet unread part.
+ /// The slice will be empty when EOF is reached.
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Read for &'a [u8] {
+     #[inline]
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+@@ -193,7 +197,7 @@ impl<'a> Read for &'a [u8] {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<'a> BufRead for &'a [u8] {
+     #[inline]
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
+@@ -207,7 +211,6 @@ impl<'a> BufRead for &'a [u8] {
+ ///
+ /// Note that writing updates the slice to point to the yet unwritten part.
+ /// The slice will be empty when it has been completely overwritten.
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<'a> Write for &'a mut [u8] {
+     #[inline]
+     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+@@ -233,7 +236,7 @@ impl<'a> Write for &'a mut [u8] {
+ 
+ /// Write is implemented for `Vec<u8>` by appending to the vector.
+ /// The vector will grow as needed.
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl Write for Vec<u8> {
+     #[inline]
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+diff --git a/memchr.rs b/memchr.rs
+index 3824a5f..312cf47 100644
+--- a/memchr.rs
++++ b/memchr.rs
+@@ -11,10 +11,12 @@
+ // Original implementation taken from rust-memchr
+ // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
+ 
++pub use self::fallback::{memchr,memrchr};
++
+ #[allow(dead_code)]
+ pub mod fallback {
+-    use cmp;
+-    use mem;
++    use core::cmp;
++    use core::mem;
+ 
+     const LO_U64: u64 = 0x0101010101010101;
+     const HI_U64: u64 = 0x8080808080808080;
+diff --git a/mod.rs b/mod.rs
+index e283287..7319e65 100644
+--- a/mod.rs
++++ b/mod.rs
+@@ -266,44 +266,34 @@
+ //! [`?` operator]: ../../book/syntax-index.html
+ //! [`Read::read`]: trait.Read.html#tymethod.read
+ 
+-#![stable(feature = "rust1", since = "1.0.0")]
+-
+-use cmp;
++use core::cmp;
+ use core::str as core_str;
+-use error as std_error;
+-use fmt;
+-use result;
+-use str;
+-use memchr;
+-
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::buffered::{BufReader, BufWriter, LineWriter};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::buffered::IntoInnerError;
+-#[stable(feature = "rust1", since = "1.0.0")]
++use core::fmt;
++use core::iter::{Iterator};
++use core::marker::Sized;
++#[cfg(feature="collections")] use core::ops::{Drop, FnOnce};
++use core::option::Option::{self, Some, None};
++use core::result::Result::{Ok, Err};
++use core::result;
++#[cfg(feature="collections")] use collections::string::String;
++use core::str;
++#[cfg(feature="collections")] use collections::vec::Vec;
++mod memchr;
++
++#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
++#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
+ pub use self::cursor::Cursor;
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub use self::error::{Result, Error, ErrorKind};
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::stdio::{stdin, stdout, stderr, _print, Stdin, Stdout, Stderr};
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use self::stdio::{StdoutLock, StderrLock, StdinLock};
+-#[unstable(feature = "libstd_io_internals", issue = "0")]
+-#[doc(no_inline, hidden)]
+-pub use self::stdio::{set_panic, set_print};
+ 
+ pub mod prelude;
+-mod buffered;
++#[cfg(feature="collections")] mod buffered;
+ mod cursor;
+ mod error;
+ mod impls;
+-mod lazy;
+ mod util;
+-mod stdio;
+ 
+-const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
++const DEFAULT_BUF_SIZE: usize = 8 * 1024;
+ 
+ // A few methods below (read_to_string, read_line) will append data into a
+ // `String` buffer, but we need to be pretty careful when doing this. The
+@@ -323,6 +313,7 @@ const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
+ // 2. We're passing a raw buffer to the function `f`, and it is expected that
+ //    the function only *appends* bytes to the buffer. We'll get undefined
+ //    behavior if existing bytes are overwritten to have non-UTF-8 data.
++#[cfg(feature="collections")]
+ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
+     where F: FnOnce(&mut Vec<u8>) -> Result<usize>
+ {
+@@ -354,6 +345,7 @@ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
+ // of data to return. Simply tacking on an extra DEFAULT_BUF_SIZE space every
+ // time is 4,500 times (!) slower than this if the reader has a very small
+ // amount of data to return.
++#[cfg(feature="collections")]
+ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> {
+     let start_len = buf.len();
+     let mut len = start_len;
+@@ -436,7 +428,6 @@ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize>
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Read {
+     /// Pull some bytes from this source into the specified buffer, returning
+     /// how many bytes were read.
+@@ -489,7 +480,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
+ 
+     /// Read all bytes until EOF in this source, placing them into `buf`.
+@@ -531,7 +521,7 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
++    #[cfg(feature="collections")]
+     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
+         read_to_end(self, buf)
+     }
+@@ -569,7 +559,7 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
++    #[cfg(feature="collections")]
+     fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
+         // Note that we do *not* call `.read_to_end()` here. We are passing
+         // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
+@@ -630,7 +620,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "read_exact", since = "1.6.0")]
+     fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
+         while !buf.is_empty() {
+             match self.read(buf) {
+@@ -682,7 +671,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
+ 
+     /// Transforms this `Read` instance to an `Iterator` over its bytes.
+@@ -712,7 +700,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn bytes(self) -> Bytes<Self> where Self: Sized {
+         Bytes { inner: self }
+     }
+@@ -749,10 +736,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "io", reason = "the semantics of a partial read/write \
+-                                         of where errors happen is currently \
+-                                         unclear and may change",
+-               issue = "27802")]
+     fn chars(self) -> Chars<Self> where Self: Sized {
+         Chars { inner: self }
+     }
+@@ -787,7 +770,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
+         Chain { first: self, second: next, done_first: false }
+     }
+@@ -821,7 +803,6 @@ pub trait Read {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn take(self, limit: u64) -> Take<Self> where Self: Sized {
+         Take { inner: self, limit: limit }
+     }
+@@ -861,7 +842,6 @@ pub trait Read {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Write {
+     /// Write a buffer into this object, returning how many bytes were written.
+     ///
+@@ -905,7 +885,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write(&mut self, buf: &[u8]) -> Result<usize>;
+ 
+     /// Flush this output stream, ensuring that all intermediately buffered
+@@ -931,7 +910,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn flush(&mut self) -> Result<()>;
+ 
+     /// Attempts to write an entire buffer into this write.
+@@ -961,7 +939,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
+         while !buf.is_empty() {
+             match self.write(buf) {
+@@ -1013,7 +990,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
+         // Create a shim which translates a Write to a fmt::Write and saves
+         // off I/O errors. instead of discarding them
+@@ -1069,7 +1045,6 @@ pub trait Write {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
+ }
+ 
+@@ -1099,7 +1074,6 @@ pub trait Write {
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub trait Seek {
+     /// Seek to an offset, in bytes, in a stream.
+     ///
+@@ -1115,7 +1089,6 @@ pub trait Seek {
+     /// Seeking to a negative offset is considered an error.
+     ///
+     /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
+ }
+ 
+@@ -1125,29 +1098,26 @@ pub trait Seek {
+ ///
+ /// [`Seek`]: trait.Seek.html
+ #[derive(Copy, PartialEq, Eq, Clone, Debug)]
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub enum SeekFrom {
+     /// Set the offset to the provided number of bytes.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    Start(#[stable(feature = "rust1", since = "1.0.0")] u64),
++    Start(u64),
+ 
+     /// Set the offset to the size of this object plus the specified number of
+     /// bytes.
+     ///
+     /// It is possible to seek beyond the end of an object, but it's an error to
+     /// seek before byte 0.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    End(#[stable(feature = "rust1", since = "1.0.0")] i64),
++    End(i64),
+ 
+     /// Set the offset to the current position plus the specified number of
+     /// bytes.
+     ///
+     /// It is possible to seek beyond the end of an object, but it's an error to
+     /// seek before byte 0.
+-    #[stable(feature = "rust1", since = "1.0.0")]
+-    Current(#[stable(feature = "rust1", since = "1.0.0")] i64),
++    Current(i64),
+ }
+ 
++#[cfg(feature="collections")]
+ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
+                                    -> Result<usize> {
+     let mut read = 0;
+@@ -1227,7 +1197,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
+ /// # }
+ /// ```
+ ///
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ pub trait BufRead: Read {
+     /// Fills the internal buffer of this object, returning the buffer contents.
+     ///
+@@ -1272,7 +1242,6 @@ pub trait BufRead: Read {
+     /// // ensure the bytes we worked with aren't returned again later
+     /// stdin.consume(length);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn fill_buf(&mut self) -> Result<&[u8]>;
+ 
+     /// Tells this buffer that `amt` bytes have been consumed from the buffer,
+@@ -1294,7 +1263,6 @@ pub trait BufRead: Read {
+     /// that method's example includes an example of `consume()`.
+     ///
+     /// [`fill_buf`]: #tymethod.fill_buf
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn consume(&mut self, amt: usize);
+ 
+     /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
+@@ -1350,7 +1318,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(num_bytes, 0);
+     /// assert_eq!(buf, b"");
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
+         read_until(self, byte, buf)
+     }
+@@ -1405,7 +1372,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(num_bytes, 0);
+     /// assert_eq!(buf, "");
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn read_line(&mut self, buf: &mut String) -> Result<usize> {
+         // Note that we are not calling the `.read_until` method here, but
+         // rather our hardcoded implementation. For more details as to why, see
+@@ -1446,7 +1412,6 @@ pub trait BufRead: Read {
+     /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
+     /// assert_eq!(split_iter.next(), None);
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn split(self, byte: u8) -> Split<Self> where Self: Sized {
+         Split { buf: self, delim: byte }
+     }
+@@ -1485,7 +1450,6 @@ pub trait BufRead: Read {
+     /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
+     ///
+     /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     fn lines(self) -> Lines<Self> where Self: Sized {
+         Lines { buf: self }
+     }
+@@ -1497,7 +1461,6 @@ pub trait BufRead: Read {
+ /// Please see the documentation of [`chain`] for more details.
+ ///
+ /// [`chain`]: trait.Read.html#method.chain
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Chain<T, U> {
+     first: T,
+     second: U,
+@@ -1525,7 +1488,6 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn into_inner(self) -> (T, U) {
+         (self.first, self.second)
+     }
+@@ -1550,7 +1512,6 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_ref(&self) -> (&T, &U) {
+         (&self.first, &self.second)
+     }
+@@ -1579,13 +1540,11 @@ impl<T, U> Chain<T, U> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_mut(&mut self) -> (&mut T, &mut U) {
+         (&mut self.first, &mut self.second)
+     }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.debug_struct("Chain")
+@@ -1595,7 +1554,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T: Read, U: Read> Read for Chain<T, U> {
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
+         if !self.done_first {
+@@ -1608,7 +1566,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
+     }
+ }
+ 
+-#[stable(feature = "chain_bufread", since = "1.9.0")]
++#[cfg(feature="collections")]
+ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
+     fn fill_buf(&mut self) -> Result<&[u8]> {
+         if !self.done_first {
+@@ -1635,7 +1593,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
+ /// Please see the documentation of [`take`] for more details.
+ ///
+ /// [`take`]: trait.Read.html#method.take
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Debug)]
+ pub struct Take<T> {
+     inner: T,
+@@ -1670,7 +1627,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "rust1", since = "1.0.0")]
+     pub fn limit(&self) -> u64 { self.limit }
+ 
+     /// Consumes the `Take`, returning the wrapped reader.
+@@ -1693,7 +1649,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[stable(feature = "io_take_into_inner", since = "1.15.0")]
+     pub fn into_inner(self) -> T {
+         self.inner
+     }
+@@ -1720,7 +1675,6 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_ref(&self) -> &T {
+         &self.inner
+     }
+@@ -1751,13 +1705,11 @@ impl<T> Take<T> {
+     /// # Ok(())
+     /// # }
+     /// ```
+-    #[unstable(feature = "more_io_inner_methods", issue="41519")]
+     pub fn get_mut(&mut self) -> &mut T {
+         &mut self.inner
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<T: Read> Read for Take<T> {
+     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
+         // Don't call into inner reader at all at EOF because it may still block
+@@ -1772,7 +1724,7 @@ impl<T: Read> Read for Take<T> {
+     }
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<T: BufRead> BufRead for Take<T> {
+     fn fill_buf(&mut self) -> Result<&[u8]> {
+         // Don't call into inner reader at all at EOF because it may still block
+@@ -1811,13 +1763,11 @@ fn read_one_byte(reader: &mut Read) -> Option<Result<u8>> {
+ /// Please see the documentation of [`bytes`] for more details.
+ ///
+ /// [`bytes`]: trait.Read.html#method.bytes
+-#[stable(feature = "rust1", since = "1.0.0")]
+ #[derive(Debug)]
+ pub struct Bytes<R> {
+     inner: R,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl<R: Read> Iterator for Bytes<R> {
+     type Item = Result<u8>;
+ 
+@@ -1832,8 +1782,6 @@ impl<R: Read> Iterator for Bytes<R> {
+ /// Please see the documentation of `chars()` for more details.
+ ///
+ /// [chars]: trait.Read.html#method.chars
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ #[derive(Debug)]
+ pub struct Chars<R> {
+     inner: R,
+@@ -1842,8 +1790,6 @@ pub struct Chars<R> {
+ /// An enumeration of possible errors that can be generated from the `Chars`
+ /// adapter.
+ #[derive(Debug)]
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ pub enum CharsError {
+     /// Variant representing that the underlying stream was read successfully
+     /// but it did not contain valid utf8 data.
+@@ -1853,8 +1799,6 @@ pub enum CharsError {
+     Other(Error),
+ }
+ 
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ impl<R: Read> Iterator for Chars<R> {
+     type Item = result::Result<char, CharsError>;
+ 
+@@ -1886,25 +1830,6 @@ impl<R: Read> Iterator for Chars<R> {
+     }
+ }
+ 
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+-impl std_error::Error for CharsError {
+-    fn description(&self) -> &str {
+-        match *self {
+-            CharsError::NotUtf8 => "invalid utf8 encoding",
+-            CharsError::Other(ref e) => std_error::Error::description(e),
+-        }
+-    }
+-    fn cause(&self) -> Option<&std_error::Error> {
+-        match *self {
+-            CharsError::NotUtf8 => None,
+-            CharsError::Other(ref e) => e.cause(),
+-        }
+-    }
+-}
+-
+-#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
+-           issue = "27802")]
+ impl fmt::Display for CharsError {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         match *self {
+@@ -1923,14 +1848,14 @@ impl fmt::Display for CharsError {
+ /// `BufRead`. Please see the documentation of `split()` for more details.
+ ///
+ /// [split]: trait.BufRead.html#method.split
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ #[derive(Debug)]
+ pub struct Split<B> {
+     buf: B,
+     delim: u8,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead> Iterator for Split<B> {
+     type Item = Result<Vec<u8>>;
+ 
+@@ -1955,13 +1880,13 @@ impl<B: BufRead> Iterator for Split<B> {
+ /// `BufRead`. Please see the documentation of `lines()` for more details.
+ ///
+ /// [lines]: trait.BufRead.html#method.lines
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ #[derive(Debug)]
+ pub struct Lines<B> {
+     buf: B,
+ }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
++#[cfg(feature="collections")]
+ impl<B: BufRead> Iterator for Lines<B> {
+     type Item = Result<String>;
+ 
+diff --git a/prelude.rs b/prelude.rs
+index 8772d0f..49d66c9 100644
+--- a/prelude.rs
++++ b/prelude.rs
+@@ -18,7 +18,8 @@
+ //! use std::io::prelude::*;
+ //! ```
+ 
+-#![stable(feature = "rust1", since = "1.0.0")]
++pub use super::{Read, Write, Seek};
++#[cfg(feature="collections")] pub use super::BufRead;
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+-pub use super::{Read, Write, BufRead, Seek};
++#[cfg(feature="collections")] pub use alloc::boxed::Box;
++#[cfg(feature="collections")] pub use collections::vec::Vec;
+diff --git a/util.rs b/util.rs
+index 078f1ad..fd13c98 100644
+--- a/util.rs
++++ b/util.rs
+@@ -10,8 +10,9 @@
+ 
+ #![allow(missing_copy_implementations)]
+ 
+-use fmt;
+-use io::{self, Read, Write, ErrorKind, BufRead};
++use core::fmt;
++use io::{self, Read, Write, ErrorKind};
++#[cfg(feature="collections")] use io::BufRead;
+ 
+ /// Copies the entire contents of a reader into a writer.
+ ///
+@@ -43,7 +44,6 @@ use io::{self, Read, Write, ErrorKind, BufRead};
+ /// # Ok(())
+ /// # }
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<u64>
+     where R: Read, W: Write
+ {
+@@ -67,7 +67,6 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
+ /// the documentation of `empty()` for more details.
+ ///
+ /// [empty]: fn.empty.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Empty { _priv: () }
+ 
+ /// Constructs a new handle to an empty reader.
+@@ -85,20 +84,18 @@ pub struct Empty { _priv: () }
+ /// io::empty().read_to_string(&mut buffer).unwrap();
+ /// assert!(buffer.is_empty());
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn empty() -> Empty { Empty { _priv: () } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Read for Empty {
+     fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> { Ok(0) }
+ }
+-#[stable(feature = "rust1", since = "1.0.0")]
++
++#[cfg(feature="collections")]
+ impl BufRead for Empty {
+     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(&[]) }
+     fn consume(&mut self, _n: usize) {}
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Empty {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Empty { .. }")
+@@ -111,7 +108,6 @@ impl fmt::Debug for Empty {
+ /// see the documentation of `repeat()` for more details.
+ ///
+ /// [repeat]: fn.repeat.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Repeat { byte: u8 }
+ 
+ /// Creates an instance of a reader that infinitely repeats one byte.
+@@ -128,10 +124,8 @@ pub struct Repeat { byte: u8 }
+ /// io::repeat(0b101).read_exact(&mut buffer).unwrap();
+ /// assert_eq!(buffer, [0b101, 0b101, 0b101]);
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Read for Repeat {
+     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+         for slot in &mut *buf {
+@@ -141,7 +135,6 @@ impl Read for Repeat {
+     }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Repeat {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Repeat { .. }")
+@@ -154,7 +147,6 @@ impl fmt::Debug for Repeat {
+ /// see the documentation of `sink()` for more details.
+ ///
+ /// [sink]: fn.sink.html
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub struct Sink { _priv: () }
+ 
+ /// Creates an instance of a writer which will successfully consume all data.
+@@ -171,16 +163,13 @@ pub struct Sink { _priv: () }
+ /// let num_bytes = io::sink().write(&buffer).unwrap();
+ /// assert_eq!(num_bytes, 5);
+ /// ```
+-#[stable(feature = "rust1", since = "1.0.0")]
+ pub fn sink() -> Sink { Sink { _priv: () } }
+ 
+-#[stable(feature = "rust1", since = "1.0.0")]
+ impl Write for Sink {
+     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
+     fn flush(&mut self) -> io::Result<()> { Ok(()) }
+ }
+ 
+-#[stable(feature = "std_debug", since = "1.16.0")]
+ impl fmt::Debug for Sink {
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         f.pad("Sink { .. }")

+ 2 - 0
src/lib.rs

@@ -29,12 +29,14 @@ impl<T> FakeBox<T> {
 
 // Needed for older compilers, to ignore vec!/format! macros in tests
 #[cfg(not(feature="collections"))]
+#[allow(unused)]
 macro_rules! vec (
 	( $ elem : expr ; $ n : expr ) => { () };
 	( $ ( $ x : expr ) , * ) => { () };
 	( $ ( $ x : expr , ) * ) => { () };
 );
 #[cfg(not(feature="collections"))]
+#[allow(unused)]
 macro_rules! format {
 	( $ ( $ arg : tt ) * ) => { () };
 }