[solved] Cargo selects different version of a dep in two similar crates

I have a weird case here where the same dependency (actix-http-test) in two crates depends on two different versions of another dependency (awc).

awc v0.2.3 does not work because it yields an error:

Compiling awc v0.2.3
error[E0277]: the trait bound `serde_urlencoded::ser::Error: actix_http::error::ResponseError` is not satisfied
   --> /home/erlend/.cargo/registry/src/github.com-1ecc6299db9ec823/awc-0.2.3/src/request.rs:504:44
    |
504 |             Err(e) => return Either::A(err(Error::from(e).into())),
    |                                            ^^^^^^^^^^^ the trait `actix_http::error::ResponseError` is not implemented for `serde_urlencoded::ser::Error`
    |
    = note: required because of the requirements on the impl of `std::convert::From<serde_urlencoded::ser::Error>` for `actix_http::error::Error`
    = note: required by `std::convert::From::from`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.

In one crate I have

[dev-dependencies]
actix-http-test = "0.2.4"
actix-http = "0.2.9"

cargo tree shows:

$ cargo tree
...
[dev-dependencies]
├── actix-http v0.2.9 (*)
├── actix-http-test v0.2.4
│   ├── actix-codec v0.1.2 (*)
│   ├── actix-rt v0.2.4 (*)
│   ├── actix-server v0.6.0 (*)
│   ├── actix-service v0.4.1 (*)
│   ├── actix-utils v0.4.5 (*)
│   ├── awc v0.2.3 (*)
...

Then I create a new crate with the same [dev-dependencies], and cargo tree shows:

$ cargo tree
└── actix-http-test v0.2.4
    ...
    ├── awc v0.2.4

Here it compiles fine, whereas in the former crate (which actually matters) it errors, probably because awc is version 0.2.3.

So I wonder: how to fix this? And why it selects different versions of awc in these two similar cases.
For completeness, here is the full dependencies in the first case

[dependencies]
snafu = "0.4.4"
threadpool = "1.7.1"
actix-web = "1.0.5"
actix-cors = "0.1.0"
futures = "0.1.25"
reqwest = "0.9.19"
serde = { version = "1.0", features = ["derive"] }
walkdir = "2.2.9"
toml = "0.5.3"
log = "0.4.8"
slog = "2.5.2"
slog-term = "2.4.1"
slog-async = "2.3.0"
slog-stdlog = "4.0.0"
slog-scope = "4.1.2"
env_logger = "0.6.2"
derive_deref = "1.1.0"

[dev-dependencies]
lazy_static = "1.3.0"
tempdir = "0.3.7"
zip = "0.5.3"
actix-http-test = "0.2.4"
actix-http = "0.2.9"

Forgot about Cargo.lock. Solved.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.