You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo check works fine here. But running cargo patch gives us this error:
Error: failed to select a version for `web-sys`.
... required by package `wgpu v0.18.0`
... which satisfies dependency `wgpu = "^0.18"` of package `test-patch v0.1.0 (/home/youser/src/test-patch)`
versions that meet the requirements `^0.3.64` (locked to 0.3.69) are: 0.3.69
the package `wgpu` depends on `web-sys`, with features: `GpuComputePassTimestampWrite` but `web-sys` does not have these features.
failed to select a version for `web-sys` which could resolve this conflict
We also get this error if we remove the [patch.crates-io] section from the Cargo.toml. The patch applied to wgpu 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 the resolve_ws function, on lines 171-180, you have:
let resolve:Resolve = resolve_with_previous(&mut registry,
ws,&CliFeatures::new_all(true),HasDevUnits::No,
prev.as_ref(),None,&[],false,)?;
That last false is the problem. Of course, if you just change it to true, that'll make the program fail on every project where a given target/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 ran cargo clean in a repository, that uses this program.
A direct solution would be to change the false to true, but (somehow) filter [patch.*] entries with a path pointing to a directory in target/patch out of the workspace 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, using cargo 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 from Cargo.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 of wgpu = "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).
The text was updated successfully, but these errors were encountered:
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 the
resolve_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).The text was updated successfully, but these errors were encountered: