Skip to content

Commit 67b97ab

Browse files
committed
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.
2 parents 5248b11 + 3c182e4 commit 67b97ab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/libstd/io/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,10 +945,16 @@ pub trait Reader {
945945
}
946946
}
947947

948+
#[cfg(stage0)]
948949
impl Reader for Box<Reader+'static> {
949950
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.read(buf) }
950951
}
951952

953+
#[cfg(not(stage0))]
954+
impl<'a> Reader for Box<Reader+'a> {
955+
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.read(buf) }
956+
}
957+
952958
impl<'a> Reader for &'a mut Reader+'a {
953959
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.read(buf) }
954960
}
@@ -1279,6 +1285,7 @@ pub trait Writer {
12791285
}
12801286
}
12811287

1288+
#[cfg(stage0)]
12821289
impl Writer for Box<Writer+'static> {
12831290
#[inline]
12841291
fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }
@@ -1287,6 +1294,15 @@ impl Writer for Box<Writer+'static> {
12871294
fn flush(&mut self) -> IoResult<()> { self.flush() }
12881295
}
12891296

1297+
#[cfg(not(stage0))]
1298+
impl<'a> Writer for Box<Writer+'a> {
1299+
#[inline]
1300+
fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }
1301+
1302+
#[inline]
1303+
fn flush(&mut self) -> IoResult<()> { self.flush() }
1304+
}
1305+
12901306
impl<'a> Writer for &'a mut Writer+'a {
12911307
#[inline]
12921308
fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }

0 commit comments

Comments
 (0)