Repository navigation
Note when trait bound may be satisfied for a different version of a crate #78552
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.Diagnostics: Errors or lints caused be the use of two different crate versions.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.Diagnostics: Errors or lints caused be the use of two different crate versions.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
Aaron1011 commentedon Oct 30, 2020
This is similar to #73560, but it occurs in a different part of the compiler.
jyn514 commentedon Oct 30, 2020
A similar error:
The first
cargo_metadatais a module, the second is a crate.isosphere commentedon Dec 30, 2025
Reproduction
This workspace has (deliberately) mismatched dependency versions and an
implfor a struct that dependency provides; the "runtime" crate included will therefore not compile.The error does not help the user determine that the underlying issue is the mismatched versions.
https://github.com/isosphere/rust-issue-78552-repro
@Aaron1011, I think we're talking about the same thing here, but please correct me if I'm wrong.
Here's the error on 1.92.0:
#146874 is merged into 1.92.0 and should offer a hint, but it is not triggered in this case.
Rollup merge of rust-lang#150558 - estebank:multiple-dep-versions, r=…
Rollup merge of rust-lang#150558 - estebank:multiple-dep-versions, r=…
Unrolled build for #150558