One of the biggest reasons to use a workspace is to keep your ten internal crates on identical versions of tokio etc. However, in order to delegate the versions out like this, now you have either monorepo or an alternative registry.
Nix, which has solved this problem of remote version definitions forwards and backwards, has been instrumental in solving this problem for my non-Rust dependencies, which have all the benefits of one shared set of versions but independent local overrides and upgrade cycles. Detsys, who uses Rust, understands the issues quite well Introducing the Determinate Nix Installer
The solution likely doesn't need to support nesting since we don't telescope dependencies up through multiple layers like Nix would. The remote aspect is what's super useful.
How it would work:
- A remote definition would contain a bunch of dependency versions in a Cargo.toml and a lock file to resolve concrete versions
- Dependent crate or workspace would pull that definition and derive a local lock file.
- Dependent crates delegate their definitions
clap.workspace = true
style.
How upgrades would work:
- Whenever you want to change Tokio versions at your company, bomb dot com, you update that central version and update the lock file.
- One by one, as you work on your services, you pull the central definition and re-derive a new local lock file.
Boom. All your services can update independently, but they all get a predictable set of versions as if you are using a remote registry. It is the best of all worlds.
My early noise was filed as an issue here:
I'm really wanting this style of updates at Positron and will end up using a remote registry ASAP to obtain this capability. We should not need remote registries when we are so early that we're still getting crates off of crates.io.