Any reason not to use a workspace dependency? Workspaces - The Cargo Book The patch table is for dependencies of your dependencies that you normally can't specify.
cargo build
Updating crates.io index
error: failed to select a version for `wasm-bindgen`.
... required by package `rend3-framework v0.3.0`
... which satisfies dependency `rend3-framework = "^0.3.0"` of package `sharpview v0.5.0 (/home/john/projects/sl/SL-test-viewer/sharpview)`
versions that meet the requirements `=0.2.78` are: 0.2.78
all possible versions conflict with previously selected packages.
previously selected package `wasm-bindgen v0.2.89`
... which satisfies dependency `wasm-bindgen = "^0.2.45"` (locked to 0.2.89) of package `winit v0.28.7`
... which satisfies dependency `winit = "^0.28"` (locked to 0.28.7) of package `sharpview v0.5.0 (/home/john/projects/sl/SL-test-viewer/sharpview)`
failed to select a version for `wasm-bindgen` which could resolve this conflict
OK. Using "workspace = true" in all subprojects fixed the second problem. Now I'm back to the first problem. I'm trying to force ui-mock to use the same version of Rend3 as everything else.
I get "note: perhaps two different versions of crate rend3 are being used?" The "patch" lines aren't overriding ui-mock's internal selection. Doesn't matter whether I include that section or not.
This patch will patch dependencies which have https://github.com/John-Nagle/ui-mock.gitas a source. Your https://github.com/John-Nagle/ui-mock/blob/main/Cargo.toml is taking deps from the default source, crates.io, so you need a [patch.crates-io] to patch it.
(I think you should get a warning like "patch not used in dependency graph", but I'm not sure)
Had to go over to ui-mock and make it explicitly use the desired version of Rend3, rather than trying to patch it.
The real problem is that I'm trying to use crates that have had major changes while keeping the same version number. Cargo can just barely handle that. Versioned crates work much better.
Unfortunately, Cargo has no unification of git dependencies. If they're specified differently, even if it's essentially the same thing written in a slightly different way, they're treated as completely unrelated packages. That's because Cargo makes a fake URL for your git parameters, and each URL is treated as a different one.
When you're applying a patch, the version must match. You can't replace a dependency with a "wrong" version". You can't use patch if you have multiple different versions to patch. Instead, you'll have to patch every parent crate requiring these dependencies and make them require the same version.