about summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-09-05 03:31:07 +0000
committerbors <bors@rust-lang.org>2014-09-05 03:31:07 +0000
commit67b97ab6d2b7de9b69fd97dc171fcf8feec932ff (patch)
tree1e8558b3905b75f7b9d4f41cd222fa125035a961 /src/libstd/io
parent5248b1187d7b02d5007f7dc6563c04ac0763fb17 (diff)
parent3c182e422611801d9d723f99d328725a8794ca8d (diff)
downloadrust-67b97ab6d2b7de9b69fd97dc171fcf8feec932ff.tar.gz
rust-67b97ab6d2b7de9b69fd97dc171fcf8feec932ff.zip
auto merge of #16843 : bkoropoff/rust/reader-writer-box, r=alexcrichton
Cargo needs this to be able to instantiate `TerminfoTerminal<Box<Writer+'a>>` for 'a other than 'static.
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/mod.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index e2de8becb34..bd4ec797159 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -945,10 +945,16 @@ pub trait Reader {
     }
 }
 
+#[cfg(stage0)]
 impl Reader for Box<Reader+'static> {
     fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.read(buf) }
 }
 
+#[cfg(not(stage0))]
+impl<'a> Reader for Box<Reader+'a> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.read(buf) }
+}
+
 impl<'a> Reader for &'a mut Reader+'a {
     fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.read(buf) }
 }
@@ -1279,6 +1285,7 @@ pub trait Writer {
     }
 }
 
+#[cfg(stage0)]
 impl Writer for Box<Writer+'static> {
     #[inline]
     fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }
@@ -1287,6 +1294,15 @@ impl Writer for Box<Writer+'static> {
     fn flush(&mut self) -> IoResult<()> { self.flush() }
 }
 
+#[cfg(not(stage0))]
+impl<'a> Writer for Box<Writer+'a> {
+    #[inline]
+    fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }
+
+    #[inline]
+    fn flush(&mut self) -> IoResult<()> { self.flush() }
+}
+
 impl<'a> Writer for &'a mut Writer+'a {
     #[inline]
     fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }