diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-03-07 15:42:29 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-03-12 12:31:13 -0800 |
| commit | b53764c73bd722ea22142bace6249d5950066253 (patch) | |
| tree | ecf0066dbdb65bf0cf4600c4560d06edcacff707 /src/libstd/io | |
| parent | 083db64d9050ae6f92628aa869171ac4affb016f (diff) | |
| download | rust-b53764c73bd722ea22142bace6249d5950066253.tar.gz rust-b53764c73bd722ea22142bace6249d5950066253.zip | |
std: Clean out deprecated APIs
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that are deprecated in the 1.8 release are sticking around for the rest of this cycle. Some notable changes are: * The `dynamic_lib` module was moved into `rustc_back` as the compiler still relies on a few bits and pieces. * The `DebugTuple` formatter now special-cases an empty struct name with only one field to append a trailing comma.
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/error.rs | 8 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 150 | ||||
| -rw-r--r-- | src/libstd/io/util.rs | 27 |
3 files changed, 0 insertions, 185 deletions
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index e3f17c839f1..9a605fc7bbf 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -150,12 +150,6 @@ pub enum ErrorKind { #[stable(feature = "rust1", since = "1.0.0")] Other, - #[allow(missing_docs)] - #[unstable(feature = "read_exact_old", reason = "recently added", - issue = "0")] - #[rustc_deprecated(since = "1.6.0", reason = "renamed to UnexpectedEof")] - UnexpectedEOF, - /// An error returned when an operation could not be completed because an /// "end of file" was reached prematurely. /// @@ -311,7 +305,6 @@ impl fmt::Display for Error { #[stable(feature = "rust1", since = "1.0.0")] impl error::Error for Error { - #[allow(deprecated)] // remove with UnexpectedEOF fn description(&self) -> &str { match self.repr { Repr::Os(..) => match self.kind() { @@ -332,7 +325,6 @@ impl error::Error for Error { ErrorKind::WriteZero => "write zero", ErrorKind::Interrupted => "operation interrupted", ErrorKind::Other => "other os error", - ErrorKind::UnexpectedEOF => "unexpected end of file", ErrorKind::UnexpectedEof => "unexpected end of file", ErrorKind::__Nonexhaustive => unreachable!() }, diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 61334f30924..60a720efb79 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -811,49 +811,6 @@ pub trait Read { fn take(self, limit: u64) -> Take<Self> where Self: Sized { Take { inner: self, limit: limit } } - - /// Creates a reader adaptor which will write all read data into the given - /// output stream. - /// - /// Whenever the returned `Read` instance is read it will write the read - /// data to `out`. The current semantics of this implementation imply that - /// a `write` error will not report how much data was initially read. - /// - /// # Examples - /// - /// [`File`][file]s implement `Read`: - /// - /// [file]: ../fs/struct.File.html - /// - /// ``` - /// #![feature(io)] - /// use std::io; - /// use std::io::prelude::*; - /// use std::fs::File; - /// - /// # fn foo() -> io::Result<()> { - /// let mut f = try!(File::open("foo.txt")); - /// let mut buffer1 = Vec::with_capacity(10); - /// let mut buffer2 = Vec::with_capacity(10); - /// - /// // write the output to buffer1 as we read - /// let mut handle = f.tee(&mut buffer1); - /// - /// try!(handle.read(&mut buffer2)); - /// # Ok(()) - /// # } - /// ``` - #[unstable(feature = "io", reason = "the semantics of a partial read/write \ - of where errors happen is currently \ - unclear and may change", - issue = "27802")] - #[rustc_deprecated(reason = "error handling semantics unclear and \ - don't seem to have an ergonomic resolution", - since = "1.6.0")] - #[allow(deprecated)] - fn tee<W: Write>(self, out: W) -> Tee<Self, W> where Self: Sized { - Tee { reader: self, writer: out } - } } /// A trait for objects which are byte-oriented sinks. @@ -1089,47 +1046,6 @@ pub trait Write { /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn by_ref(&mut self) -> &mut Self where Self: Sized { self } - - /// Creates a new writer which will write all data to both this writer and - /// another writer. - /// - /// All data written to the returned writer will both be written to `self` - /// as well as `other`. Note that the error semantics of the current - /// implementation do not precisely track where errors happen. For example - /// an error on the second call to `write` will not report that the first - /// call to `write` succeeded. - /// - /// # Examples - /// - /// ``` - /// #![feature(io)] - /// use std::io::prelude::*; - /// use std::fs::File; - /// - /// # fn foo() -> std::io::Result<()> { - /// let mut buffer1 = try!(File::create("foo.txt")); - /// let mut buffer2 = Vec::new(); - /// - /// // write the output to buffer1 as we read - /// let mut handle = buffer1.broadcast(&mut buffer2); - /// - /// try!(handle.write(b"some bytes")); - /// # Ok(()) - /// # } - /// ``` - #[unstable(feature = "io", reason = "the semantics of a partial read/write \ - of where errors happen is currently \ - unclear and may change", - issue = "27802")] - #[rustc_deprecated(reason = "error handling semantics unclear and \ - don't seem to have an ergonomic resolution", - since = "1.6.0")] - #[allow(deprecated)] - fn broadcast<W: Write>(self, other: W) -> Broadcast<Self, W> - where Self: Sized - { - Broadcast { first: self, second: other } - } } /// The `Seek` trait provides a cursor which can be moved within a stream of @@ -1500,41 +1416,6 @@ pub trait BufRead: Read { } } -/// A `Write` adaptor which will write data to multiple locations. -/// -/// This struct is generally created by calling [`broadcast()`][broadcast] on a -/// writer. Please see the documentation of `broadcast()` for more details. -/// -/// [broadcast]: trait.Write.html#method.broadcast -#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast", - issue = "27802")] -#[rustc_deprecated(reason = "error handling semantics unclear and \ - don't seem to have an ergonomic resolution", - since = "1.6.0")] -pub struct Broadcast<T, U> { - first: T, - second: U, -} - -#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast", - issue = "27802")] -#[rustc_deprecated(reason = "error handling semantics unclear and \ - don't seem to have an ergonomic resolution", - since = "1.6.0")] -#[allow(deprecated)] -impl<T: Write, U: Write> Write for Broadcast<T, U> { - fn write(&mut self, data: &[u8]) -> Result<usize> { - let n = try!(self.first.write(data)); - // FIXME: what if the write fails? (we wrote something) - try!(self.second.write_all(&data[..n])); - Ok(n) - } - - fn flush(&mut self) -> Result<()> { - self.first.flush().and(self.second.flush()) - } -} - /// Adaptor to chain together two readers. /// /// This struct is generally created by calling [`chain()`][chain] on a reader. @@ -1616,37 +1497,6 @@ impl<T: BufRead> BufRead for Take<T> { } } -/// An adaptor which will emit all read data to a specified writer as well. -/// -/// This struct is generally created by calling [`tee()`][tee] on a reader. -/// Please see the documentation of `tee()` for more details. -/// -/// [tee]: trait.Read.html#method.tee -#[unstable(feature = "io", reason = "awaiting stability of Read::tee", - issue = "27802")] -#[rustc_deprecated(reason = "error handling semantics unclear and \ - don't seem to have an ergonomic resolution", - since = "1.6.0")] -pub struct Tee<R, W> { - reader: R, - writer: W, -} - -#[unstable(feature = "io", reason = "awaiting stability of Read::tee", - issue = "27802")] -#[rustc_deprecated(reason = "error handling semantics unclear and \ - don't seem to have an ergonomic resolution", - since = "1.6.0")] -#[allow(deprecated)] -impl<R: Read, W: Write> Read for Tee<R, W> { - fn read(&mut self, buf: &mut [u8]) -> Result<usize> { - let n = try!(self.reader.read(buf)); - // FIXME: what if the write fails? (we read something) - try!(self.writer.write_all(&buf[..n])); - Ok(n) - } -} - /// An iterator over `u8` values of a reader. /// /// This struct is generally created by calling [`bytes()`][bytes] on a reader. diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index e05a0d577ff..fddb095f21e 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -197,31 +197,4 @@ mod tests { assert_eq!(repeat(4).take(100).bytes().next().unwrap().unwrap(), 4); assert_eq!(repeat(1).take(10).chain(repeat(2).take(10)).bytes().count(), 20); } - - #[test] - #[allow(deprecated)] - fn tee() { - let mut buf = [0; 10]; - { - let mut ptr: &mut [u8] = &mut buf; - assert_eq!(repeat(4).tee(&mut ptr).take(5).read(&mut [0; 10]).unwrap(), 5); - } - assert_eq!(buf, [4, 4, 4, 4, 4, 0, 0, 0, 0, 0]); - } - - #[test] - #[allow(deprecated)] - fn broadcast() { - let mut buf1 = [0; 10]; - let mut buf2 = [0; 10]; - { - let mut ptr1: &mut [u8] = &mut buf1; - let mut ptr2: &mut [u8] = &mut buf2; - - assert_eq!((&mut ptr1).broadcast(&mut ptr2) - .write(&[1, 2, 3]).unwrap(), 3); - } - assert_eq!(buf1, buf2); - assert_eq!(buf1, [1, 2, 3, 0, 0, 0, 0, 0, 0, 0]); - } } |
