Open
Description
On the playground, the following code:
use bytes::Bytes;
use http::Response;
use hyper::Body;
pub fn build(data: Bytes) -> Response<Body> {
Response::new(data.into())
}
fn main() {
}
currently produces the following error:
error[E0277]: the trait bound `hyper::Body: std::convert::From<bytes::Bytes>` is not satisfied
--> src/main.rs:6:19
|
6 | Response::new(data.into())
| ^^^^^^^^^^^ the trait `std::convert::From<bytes::Bytes>` is not implemented for `hyper::Body`
|
= help: the following implementations were found:
<hyper::Body as std::convert::From<&'static [u8]>>
<hyper::Body as std::convert::From<&'static str>>
<hyper::Body as std::convert::From<hyper::body::Bytes>>
<hyper::Body as std::convert::From<std::borrow::Cow<'static, [u8]>>>
and 4 others
= note: required because of the requirements on the impl of `std::convert::Into<hyper::Body>` for `bytes::Bytes`
Note that hyper::body::Bytes
is an alias for bytes::Bytes
. We should detect when an unment trait bound's substs match the fully-qualified names of our desired trait bound, and note that multiple versions of the same crate may be in use.