From 6267339d6869a27b95f13c578a235204a1562697 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 5 Mar 2013 17:49:03 -0500 Subject: Fix bug in coherence that causes all cross-crate impls to be regarded as inherent impls, not just those of the `impl Type` variety. --- src/libstd/comm.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 14a37ecbf52..e3437fc57aa 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -25,6 +25,27 @@ pub struct DuplexStream { priv port: Port, } +// Allow these methods to be used without import: +#[cfg(stage1)] +#[cfg(stage2)] +pub impl DuplexStream { + fn send(x: T) { + self.chan.send(x) + } + fn try_send(x: T) -> bool { + self.chan.try_send(x) + } + fn recv() -> U { + self.port.recv() + } + fn try_recv() -> Option { + self.port.try_recv() + } + pure fn peek() -> bool { + self.port.peek() + } +} + impl GenericChan for DuplexStream { fn send(&self, x: T) { self.chan.send(x) -- cgit 1.4.1-3-g733a5