1

Let a program need two crates: foo and bar, and bar have foo as a dependancy.

If you type:

foo = "*"
bar = "*"

in your Cargo.toml, you may have different versions of foo. The compiler sees Foo (version 1) as different from Foo (version 2). How to find the appropriate versions to make the build work?

My Cargo.toml:

piston_window = "*"
piston2d-opengl_graphics = "*"
pistoncore-sdl2_window = "*"
conrod = { version = "*", features = ["piston"] }

My program worked; then I wanted to do an update (because I need some newest things in the crates). I now have this error:

error[E0308]: mismatched types
  --> src/view/run_conrod.rs:80:21
   |
80 |                     context,
   |                     ^^^^^^^ expected struct `conrod::backend::piston::draw::Context`, found struct `piston_window::Context`
   |
   = note: expected type `conrod::backend::piston::draw::Context`
              found type `piston_window::Context`
note: Perhaps two different versions of crate `graphics` are being used?
Boiethios
  • 38,438
  • 19
  • 134
  • 183
  • People usually see this for traits instead of concrete structs, but the solution is the same — use `cargo tree` to find the conflicting versions, then restrict the shared crate to a common version. – Shepmaster Dec 11 '17 at 01:14

0 Answers0