Will a "*" Dependency Use The Version Selected By Other Crates

I've got a situation where I've got a very quickly developing crate bevy_retro that I use a git dependency for and that has a specifically needed version of the bevy crate to work. If a user of bevy_retro adds bevy_retro and bevy to their Cargo.toml it is easy to get an error if bevy_retro suddenly decides that it needs to use bevy from master instead of bevy from crates.io ( there's a high possibility of this happening ).

I'm trying to find a way that users can depend on whatever version of bevy that bevy_retro prefers. My thought was just having users do this:

bevy = { version = "*", default-features = false }
bevy_retro = { git = "https://github.com/katharostech/bevy_retro }

I just wanted to make sure that the version selected for the bevy crate will automatically unify with the version depended on by bevy_retro because of the "*". Is that correct?

OK, really wierd, it seems to have worked, but it doesn't work if I just do bevy = "*" instead of bevy = { version = "*", default-features = false }.

For some reason with bevy = "*" it chooses to resolve to bevy 0.0.1. Why would it do that :question:

It's better to specify an acceptable range of versions that you know are compatible, like:

version = ">= 1.4.7, <3.0.0"

"*" is a ticking time bomb, because eventually there will be a release your crate isn't compatible with.

Alternatively, you can lock version of bevy_retro using ref = "hash of the git commit to use".

2 Likes