Dependency hell: Resolving conflicting version requirements?



  1. docopt 0.6.42 requires rustc-serialize 0.2.0, and is not going to upgrade to 0.3.x until the stdio RFC is landed;
  2. toml 0.1.18 requires rustc-serialize 0.3.0

Both docopt and toml require the user to interact directly with Decodable types, but currently cargo only allow us to use one version of rustc-serialize from (unless cargo #1311 is accepted). This means it is not possible to use the latest docopt and toml together, as the v0.2 Decodable and the v0.3 Decodable are two different traits.

Is there any good solution to this?

  • Let the user rename dependencies from (i.e. #1311), allow side-by-side usage of both versions of rustc-serialize.

  • toml 0.1.17 requires rustc-serialize 0.2.0, so the user can resolve the problem by using an older version. However, currently it is not easy to discover this dependency from

BTW, the rustc error message when this problem happens is confusing:

src/ 513:21 error: mismatched types:
 expected `rustc-serialize::json::Json`,
    found `rustc-serialize::json::Json`
(expected enum `rustc-serialize::json::Json`,
    found a different enum `rustc-serialize::json::Json`) [E0308]
src/         Json::I64(v) => (v + 0x20) as u8,

src/ 577:53 error: the trait `rustc-serialize::json::ToJson` is not implemented for the type `rustc-serialize::json::Json` [E0277]
src/     let result = template.render("keylayout", &data).unwrap();


src/ 542:47 error: the trait `rustc-serialize::serialize::Decodable` is not implemented for the type `Args` [E0277]
src/     let args = Args::docopt().decode::<Args>().unwrap_or_else(|e| e.exit());
# Note: here Args has #[derive(RustcDecodable)]

closed #2

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