Rustc does not seem to recognize re-exported types as such


I am trying to compile a program that depends on rust-url. The program calls the parse Url::parse and then uses the output (that can be an error). But the compiler (rustc 1.10.0-nightly (e0fd34bba 2016-05-09)) complains with the following error message.

error: mismatched types [E0308]

help: run `rustc --explain E0308` to see a detailed explanation
note: expected type `url::ParseError`
note:    found type `url::parser::ParseError`

Looking at the rust-url code, it seems that url::ParseError is just the reexported url::parser::ParseError and I cannot just use url::parser::ParseError in my code because it is a private type of rust-url.

Any ideas?


I have seen this before when there was a version mismatch. So I depend on libraries A and B1, and A depends on B2 where B1 and B2 are different versions of the same library. Then if you have a variable of type T from B1 and a different variable of type T from B2, they look like the same type but one cannot be assigned to the other.

There may be something similar going on in your case. If you push the code you are trying to compile to a public repo, we can debug further.


Thanks! That was the problem.

The error message is a little bit confusing. I wonder if it is possible to print the library version also (at least when your run cargo build --verbose)