From ed4ddf443d93c3e14ae23699a5a2f81902ad1e66 Mon Sep 17 00:00:00 2001 From: Eric Seppanen <109770420+eric-seppanen@users.noreply.github.com> Date: Fri, 21 Jun 2024 06:00:33 -0700 Subject: [PATCH] io: fix trait bounds on impl Sink for StreamReader (#6647) This impl had a bound on `StreamReader`; this is incorrect because: - The second generic parameter to `StreamReader` is not an error type; it's a buffer type. - The `Stream` error type in `StreamReader` should not need to be the same as the `Sink` error type. This "passthrough" `Sink` impl was effectively unusable because it required the `Sink` error type be the same as the `StreamReader` buffer type. Resolve this by allowing the `StreamReader` buffer to be anything in this impl. --- tokio-util/src/io/stream_reader.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio-util/src/io/stream_reader.rs b/tokio-util/src/io/stream_reader.rs index 096c96f30..7569a8b78 100644 --- a/tokio-util/src/io/stream_reader.rs +++ b/tokio-util/src/io/stream_reader.rs @@ -326,7 +326,7 @@ impl StreamReader { } } -impl, E, T> Sink for StreamReader { +impl, B, E, T> Sink for StreamReader { type Error = E; fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.project().inner.poll_ready(cx)