tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.59k stars 2.45k forks source link

io: fix trait bounds on `impl Sink for StreamReader` #6647

Closed eric-seppanen closed 3 months ago

eric-seppanen commented 3 months ago

This impl had a bound on StreamReader<S, E>; this is incorrect because the second generic parameter to StreamReader is not an error type; it's a buffer type.

Motivation

This "passthrough" Sink impl is currently unusable because it requires the Sink error type be the same as the StreamReader buffer type. This seems like it must have been a typo, because that constraint is not useful.

See the example program in #6642 for more details.

Solution

Resolve this by removing the constraint on StreamReader's buffer type B. It's irrelevant to a Sink impl anyway.

Fixes #6642.