Open NeuralModder opened 3 months ago
A note: in this case, the egui_wgpu_backend
's wgpu
version is different than the specified wgpu
version, so you wouldn't want to do this anyway, but the core problem still exists and happens in real-world situations. Good enough for a test case.
Consider the following
Cargo.toml
.cargo check
works fine here. But runningcargo patch
gives us this error:We also get this error if we remove the
[patch.crates-io]
section from theCargo.toml
. The patch applied towgpu
is critical in this case, in order for cargo to resolve dependencies, and in consequence, in order for it to do anything at all. I see that in theresolve_ws
function, on lines 171-180, you have:That last
false
is the problem. Of course, if you just change it totrue
, that'll make the program fail on every project where a giventarget/patch/{PACKAGE}
directory pointed to in the[patch.crates-io]
section doesn't exist. Which is the situation you're probably in if you've freshly cloned a repository, or you rancargo clean
in a repository, that uses this program.A direct solution would be to change the
false
totrue
, but (somehow) filter[patch.*]
entries with apath
pointing to a directory intarget/patch
out of theworkspace
being passed into this function. That would work in this case, but not if the patch itself is needed to resolve dependencies correctly (like for example, usingcargo patch
to apply the patches that make the wgpu fork work to wgpu). The only way to make that work would be to simply not resolve dependencies and just go grab the dependency fromCargo.toml
directly, in which case the only way to know for sure which package to pick from crates.io would be to require pinned exact versions (e.g.wgpu = "=0.18.0"
instead ofwgpu = "0.18"
), since you don't know if some transitive dependency actually requires a patch version that's lower than the highest one available. This, of course, doesn't apply to git repositories, which you can just clone (and switch to the branch or tag or commit if specified).