-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E0308 mismatched types: perhaps two different versions of a crate are being used #8178
Comments
First off I am sorry for the pain this is causing you. I wish I had a ezy fix. We are working on a number of things to at least make this easier.
We recently included a new
This is an odd decision for
If we had RFC 1977 implemented then A common alternative if for
Cargo makes all decisions about what the dependency graph looks like deterministically and before building starts. It does look at the lockfile to try to minimize the number of existing crates that will need to be rebuilt do to changes to |
Yea, I'd echo what @Eh2406 said, and:
I would recommend not using
As @Eh2406 mentioned, I think (not sure) that public/private dependencies (RFC 1977) might help with this, but it is not fully implemented. |
@Eh2406 @ehuss brilliant! Thank you for the quick responses.
I'll open an issue with them and, for now, go the route of cloning it myself so I can set the version because, as you mentioned, I don't want to get to a point where Since this isn't an actual bug with |
My team has a small project that depends on
avro-rs
(0.7.0) andschema_registry_converter
(1.1.0)[which itself depends onavro-rs
]. Recently, a team member cloned the repo for the first time, tried to compile, and was met with theE0308
error pointing at the use ofavro_rs::types::Value
; saying it expected a reference of that type but found a reference of the same type with the note: "perhaps two different versions of crateavro-rs
are being used?"I had them install and run
cargo-tree
to see what version ofavro-rs
theirschema_registry_converter
was using as I couldn't reproduce the issue and mine was using 0.7.0. They noted that it was using 0.9.0, and that changing ouravro-rs
dependency to 0.9.0 fixed the build issue (which makes sense). Curious as to why our dependencies differed, I checked crates.io and it said thatschema_registry_converter
was last updated 10 months ago so there's no way my teammate could have moved to a new version. However, I noticed in their Cargo.toml file that theavro-rs
version is set to >= 0.6.0.Correct me if I'm wrong, but my assumption is that, when a dependency is set like so, and there's no cached version, cargo will pull the latest version for compilation. I then tried changing my own
avro-rs
dependency from 0.7.0 to 0.9.0 and the build failed with the same issue, but I was able to resolve it by clearing the cached dependencies and rebuilding.I guess my problem/issue/question is, what needs to be done so that we don't encounter this issue when
avro-rs
updates again? Obviously, we can just update our dependency, but it seems like a waste of time to either keep an eye on theavro-rs
crate for updates, or wait for a build to fail. I believe we could cloneschema_registry_converter
and set theavro-rs
version ourselves, but that seems like a hacky workaround?Also, is there a reason that cargo doesn't take other dependencies into consideration during the build step? What I mean is, in this instance
avro-rs
gets pulled and compiled beforeschema_registry_converter
; why does crate not see that instance ofavro-rs
while it's compilingschema_registry_converter
then check the version and see if it's usable before pulling it's own dependency?The text was updated successfully, but these errors were encountered: