diff --git a/tokio-tcp/src/stream.rs b/tokio-tcp/src/stream.rs index 10df6741b..d3766b5a2 100644 --- a/tokio-tcp/src/stream.rs +++ b/tokio-tcp/src/stream.rs @@ -781,9 +781,14 @@ impl TcpStream { /// # Ok(()) /// # } /// ``` + #[deprecated(since = "0.1.14", note = "use `split()` instead")] + #[doc(hidden)] pub fn try_clone(&self) -> io::Result { - let io = self.io.get_ref().try_clone()?; - Ok(TcpStream::new(io)) + // Rationale for deprecation: + // - https://github.com/tokio-rs/tokio/pull/824 + // - https://github.com/tokio-rs/tokio/issues/774#issuecomment-451059317 + let msg = "`TcpStream::split()` is deprecated because it doesn't work as intended"; + Err(io::Error::new(io::ErrorKind::Other, msg)) } }