Conflicting dependency error when using platform-specific versions

I have a dependency for which the latest update works on Linux but has problems on Windows. So I tried using platform-specific versions, but it's erroring out, and IDK how to get around it. Here's the relevant portion of Cargo.toml:

[target.'cfg(windows)'.dependencies]
roead = "= 0.10.3"

[target.'cfg(not(windows))'.dependencies]
roead = "0.10.4"

The result:

error: failed to select a version for `roead`.
    ... required by package `bcml v3.9.10 (D:\a\BCML\BCML)`
versions that meet the requirements `=0.10.3` are: 0.10.3
all possible versions conflict with previously selected packages.
  previously selected package `roead v0.10.4`
    ... which satisfies dependency `roead = "^0.10.4"` of package `bcml v3.9.10 (D:\a\BCML\BCML)`
failed to select a version for `roead` which could resolve this conflict

But when I use other methods of specifying the version I either get 0.10.4 for both or (with <0.10.4) just the earliest (0.9.0).

So how can I actually end up with 0.10.3 on Windows and 0.10.4 on Linux?

It's not possible to depend (directly or indirectly) on two different (SemVer) compatible versions.

From the doc:

Versions are considered compatible if their left-most non-zero major/minor/patch component is the same.

Multiple versions within the same compatibility range are not allowed and will result in a resolver error if it is constrained to two different versions within a compatibility range.

This seems quite weird, but I s'pose I'll have to find a workaround.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.