I'm trying to use actix-web
and reqwest
crates in the same project, but they depend on different versions of tokio
.
Apparently, Cargo can't select a version of tokio
which would satisfy all direct dependencies, but I'm not even using those dependencies in the same context:
actix-web
is for server REST API implementationreqwest
is for system tests only
Cargo.toml:
[package]
name = "test-cargo"
version = "0.1.0"
edition = "2018"
[dependencies]
actix-rt = "1.0.0"
actix-web = "2.0.0-alpha.6"
[dev-dependencies]
reqwest = "0.10.0-alpha.2"
Output of cargo build
:
Updating crates.io index
error: failed to select a version for `tokio`.
... required by package `reqwest v0.10.0-alpha.2`
... which is depended on by `test-cargo v0.1.0 (/workspaces/test-cargo)`
versions that meet the requirements `= 0.2.0-alpha.6` are: 0.2.0-alpha.6
all possible versions conflict with previously selected packages.
previously selected package `tokio v0.2.4`
... which is depended on by `actix-rt v1.0.0`
... which is depended on by `actix-web v2.0.0-alpha.6`
... which is depended on by `test-cargo v0.1.0 (/workspaces/test-cargo)`
failed to select a version for `tokio` which could resolve this conflict
I've thought of some workarounds, but they are all unacceptable:
- downgrade one of the direct dependencies so that
tokio
versions would match — then my dependencies are not the versions I want. - replace
reqwest
with a similar crate which doesn't depend ontokio
— then my dependencies are not the crates I want. - move tests with
reqwest
to a separate package