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.
This commit is contained in:
bors 2014-09-05 03:31:07 +00:00
commit 67b97ab6d2
1 changed files with 16 additions and 0 deletions

View File

@ -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) }