From cbafac5ba188f118d895bb075060081be3aa2800 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 8 Feb 2017 20:01:57 -0700 Subject: [PATCH] Fix compilation on Redox --- src/libstd/sys/redox/mod.rs | 2 +- src/libstd/sys/redox/net/tcp.rs | 4 ++++ src/libstd/sys/redox/net/udp.rs | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libstd/sys/redox/mod.rs b/src/libstd/sys/redox/mod.rs index 5982bdd6549ca..31c40ea58b1de 100644 --- a/src/libstd/sys/redox/mod.rs +++ b/src/libstd/sys/redox/mod.rs @@ -13,7 +13,7 @@ use io::{self, ErrorKind}; pub mod args; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod env; diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index a3f202ccd97cb..936097d7fb2a6 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -63,6 +63,10 @@ impl TcpStream { Ok(path_to_local_addr(path.to_str().unwrap_or(""))) } + pub fn peek(&self, _buf: &mut [u8]) -> Result { + Err(Error::new(ErrorKind::Other, "TcpStream::peek not implemented")) + } + pub fn shutdown(&self, _how: Shutdown) -> Result<()> { Err(Error::new(ErrorKind::Other, "TcpStream::shutdown not implemented")) } diff --git a/src/libstd/sys/redox/net/udp.rs b/src/libstd/sys/redox/net/udp.rs index 36f0819d30884..93ebcc95fd0f8 100644 --- a/src/libstd/sys/redox/net/udp.rs +++ b/src/libstd/sys/redox/net/udp.rs @@ -87,6 +87,14 @@ impl UdpSocket { Ok(path_to_local_addr(path.to_str().unwrap_or(""))) } + pub fn peek(&self, _buf: &mut [u8]) -> Result { + Err(Error::new(ErrorKind::Other, "UdpSocket::peek not implemented")) + } + + pub fn peek_from(&self, _buf: &mut [u8]) -> Result<(usize, SocketAddr)> { + Err(Error::new(ErrorKind::Other, "UdpSocket::peek_from not implemented")) + } + pub fn broadcast(&self) -> Result { Err(Error::new(ErrorKind::Other, "UdpSocket::broadcast not implemented")) }