diff options
| author | Jethro Beekman <jethro@fortanix.com> | 2019-02-14 18:06:01 +0530 |
|---|---|---|
| committer | Jethro Beekman <jethro@fortanix.com> | 2019-02-28 19:09:17 -0800 |
| commit | c0e8cf94103289c424c62ca48e1e3f56e352a84a (patch) | |
| tree | e85558f334a16ee69e3495099e13cdf38e6dc666 /src/libstd/io/impls.rs | |
| parent | 350674b7180a41c8e508d93c6ab8e203b69d3df7 (diff) | |
| download | rust-c0e8cf94103289c424c62ca48e1e3f56e352a84a.tar.gz rust-c0e8cf94103289c424c62ca48e1e3f56e352a84a.zip | |
Use the correct stderr when testing libstd
Diffstat (limited to 'src/libstd/io/impls.rs')
| -rw-r--r-- | src/libstd/io/impls.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index bd3d0a41638..b286e4016da 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -165,6 +165,20 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> { } } +// Used by panicking::default_hook +#[cfg(test)] +/// This impl is only used by printing logic, so any error returned is always +/// of kind `Other`, and should be ignored. +impl Write for Box<dyn (::realstd::io::Write) + Send> { + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + (**self).write(buf).map_err(|_| ErrorKind::Other.into()) + } + + fn flush(&mut self) -> io::Result<()> { + (**self).flush().map_err(|_| ErrorKind::Other.into()) + } +} + // ============================================================================= // In-memory buffer implementations |
