[patch.crates-io] at workspace level

I have a project with a workspace, about five internal libraries each with their own Cargo.toml file. and a main program. Also, some of the crates have example executables.

Can I have one [patch.crates-io] set of dependencies that applies to all parts of the workspace? I'm using some stuff that's under heavy development and I keep having to change the Github references in six places.

The Cargo documentation says that [patch.crates-io] can only be used at the "top level", but do they mean the final executable's Cargo.toml or the workspace's Cargo.toml? And will the patches apply to the library crate examples?

[patch.crates-io] works in a workspace's Cargo.toml and applies to everything you build as part of the workspace, including dependencies.

1 Like