You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Note when trait bound may be satisfied for a different version of a crate #78552
A-diagnosticsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: 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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
use bytes::Bytes;use http::Response;use hyper::Body;pubfnbuild(data:Bytes) -> Response<Body>{Response::new(data.into())}fnmain(){}
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.
error[E0277]: a value of type `HashMap<std::string::String, cargo_metadata::Package>` cannot be built from an iterator over elements of type `(std::string::String, cargo_metadata::Package)`
--> src/utils/cargo_metadata.rs:46:18
|
46 | .collect(),
| ^^^^^^^ value of type `HashMap<std::string::String, cargo_metadata::Package>` cannot be built from `std::iter::Iterator<Item=(std::string::String, cargo_metadata::Package)>`
|
= help: the trait `FromIterator<(std::string::String, cargo_metadata::Package)>` is not implemented for `HashMap<std::string::String, cargo_metadata::Package>`
The first cargo_metadata is a module, the second is a crate.
This workspace has (deliberately) mismatched dependency versions and an impl for 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.
@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:
error[E0277]: `?` couldn't convert the error to `Status`
--> repro-runtime/src/main.rs:5:78
|
4 | fn main() -> Result<(), Status> {
| ------------------ expected `Status` because of this
5 | Err(ApplicationError::ImpossibleCondition("you tried to run it!".into()))?
| -------------------------------------------------------------------------^ the trait `From<ApplicationError>` is not implemented for `Status`
| |
| this can't be annotated with `?` because it has type `Result<_, ApplicationError>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
`Status` implements `From<h2::error::Error>`
`Status` implements `From<std::io::Error>`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `repro-runtime` (bin "repro-runtime") due to 1 previous error
#146874 is merged into 1.92.0 and should offer a hint, but it is not triggered in this case.
A-diagnosticsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: 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.T-compilerRelevant 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