Weird typing problem when using a crate

Hello,

I'm trying to use a crate as a github repository and i receive following error at compilation: (see this commit about repository usage https://github.com/buxx/rollgui/commit/b016461c8727bcf70afd9db1affddc0266b004c8)

error[E0308]: mismatched types
--> src/gui/mod.rs:205:38
|
205 | ui::update_doryen_input_data(api, &mut self.ctx);
| ^^^ expected trait doryen_rs::app::DoryenApi, found trait doryen_rs::DoryenApi
|
= note: expected type &mut dyn doryen_rs::app::DoryenApi
found type &mut dyn doryen_rs::DoryenApi
note: Perhaps two different versions of crate doryen_rs are being used?

What can i do with that ?
Thank's !

It's probably due to those types being from different versions of the doryen-rs library. You are depending on a git version of doryen-ui, but that git version depends on a git version of doryen-rs.

[dependencies]
doryen-rs={ version="*", optional=true, git="https://github.com/jice-nospam/doryen-rs.git" }

Cargo.toml in git doryen-ui

Try a cargo clean and check if doryen-rs shows up twice?

Hello @alice !

Thanks for your time. I understand what you mean. I updated my Cargo.toml, done an cargo clean before cargo build but error still here:

   Compiling rollgui v0.1.0 (/home/bastien/Projets/rollgui)
error[E0308]: mismatched types
   --> src/gui/mod.rs:292:38
    |
292 |         ui::update_doryen_input_data(api, &mut self.ctx);
    |                                      ^^^ expected trait `doryen_rs::app::DoryenApi`, found trait `doryen_rs::DoryenApi`
    |
    = note: expected type `&mut dyn doryen_rs::app::DoryenApi`
               found type `&mut dyn doryen_rs::DoryenApi`
note: Perhaps two different versions of crate `doryen_rs` are being used?
   --> src/gui/mod.rs:292:38
    |
292 |         ui::update_doryen_input_data(api, &mut self.ctx);
    |                                      ^^^

error[E0308]: mismatched types
   --> src/gui/mod.rs:299:27
    |
299 |         ui::render_doryen(api.con(), &mut self.ctx);
    |                           ^^^^^^^^^ expected struct `doryen_rs::console::Console`, found struct `doryen_rs::Console`
    |
    = note: expected type `&mut doryen_rs::console::Console`
               found type `&mut doryen_rs::Console`
note: Perhaps two different versions of crate `doryen_rs` are being used?
   --> src/gui/mod.rs:299:27
    |
299 |         ui::render_doryen(api.con(), &mut self.ctx);
    |                           ^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rollgui`.

Maybe doryen-ui/doryen-rs have not yet push all it's code ?

and check if doryen-rs shows up twice

How can i check that ?

Thanks again !

It's not that cargo clean may fix it. It's just that when it shows that long list of "Building foobar crate...", you should see doryen-rs twice, which proves you have the issue (but doesn't fix the issue).

You need to use the git version of doryen-rs too if you want to fix it.

Ok i undertsand. I'm using git version of doryen-rs dep :

doryen-rs = { git = "https://github.com/jice-nospam/doryen-rs.git", rev = "6589d4dcc730872c95bd087753be0443a9fd59c2" }
doryen-ui = { git = "https://github.com/jice-nospam/doryen-ui.git", rev = "101edb85669df791b484aa4d802b32665352734c" }

But don't fix it.

Does it still show up twice when recompiling after cargo clean? Remember, you need the exact same commit, and doryen-ui doesn't fix a commit.

When build, lines of doryen-*:

   Compiling doryen-rs v1.2.3 (https://github.com/jice-nospam/doryen-rs.git#6589d4dc)
   Compiling doryen-rs v1.2.3 (https://github.com/jice-nospam/doryen-rs.git?rev=6589d4dcc730872c95bd087753be0443a9fd59c2#6589d4dc)
   Compiling doryen-ui v0.1.0 (https://github.com/jice-nospam/doryen-ui.git?rev=101edb85669df791b484aa4d802b32665352734c#101edb85)

Maybe can i "try" some doryen-ui commits to "find" matches with current last doryen-rs commit.

I tried with (just for test ...):

[dependencies]
[...]
doryen-rs={ version="*", optional=true, git="https://github.com/jice-nospam/doryen-rs.git" }
doryen-ui={ version="*", optional=true, git="https://github.com/jice-nospam/doryen-ui.git" }
[...]

[dev-dependencies]
doryen-rs={ version="*", git="https://github.com/jice-nospam/doryen-rs.git" }
doryen-ui={ version="*", git="https://github.com/jice-nospam/doryen-ui.git" }

And i got:

error[E0463]: can't find crate for `doryen_rs`
 --> src/main.rs:1:1
  |
1 | extern crate doryen_rs;
  | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

I don't understand, using this in Cargo.toml:

doryen-rs={ version="*", git="https://github.com/jice-nospam/doryen-rs.git" }
doryen-ui = { git = "https://github.com/jice-nospam/doryen-ui.git", rev = "101edb85669df791b484aa4d802b32665352734c" }

It is working.

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