Conrod: Building examples: compile error on converting `winit::Event`

Created on 7 Mar 2018  路  4Comments  路  Source: PistonDevelopers/conrod

I am just getting started with conrod. I am reading the doc and building the examples.
I get the following compile error on this test project implementing the all_winit_glium example here:
This test project is the all_winit_glium example copy-pasted as is in its own repo.

$ cargo --version
cargo 0.26.0-nightly (1d6dfea44 2018-01-26)
$ rustc --version
rustc 1.26.0-nightly (c9334404f 2018-03-05)
$ cargo run
   Compiling conrod-test v0.1.0 (file:///home/malik/workspace/veille/rust/conrod-test)
error[E0308]: mismatched types
  --> src/main.rs:89:76
   |
89 |                 if let Some(event) = conrod::backend::winit::convert_event(event.clone(), &display) {
   |                                                                            ^^^^^^^^^^^^^ expected enum `winit::events::Event`, found enum `conrod::<unnamed>::<unnamed>::Event`
   |
   = note: expected type `winit::events::Event`
              found type `conrod::<unnamed>::<unnamed>::Event`
note: Perhaps two different versions of crate `winit` are being used?
  --> src/main.rs:89:76
   |
89 |                 if let Some(event) = conrod::backend::winit::convert_event(event.clone(), &display) {
   |                                                                            ^^^^^^^^^^^^^

error: aborting due to previous error

If you want more information on this error, try using "rustc --explain E0308"
error: Could not compile `conrod-test`.

To learn more, run the command again with --verbose.

Very strangely, I have no problem to build and run the examples when I clone the conrod repo.
I don't understand what I am doing wrong. The compiler seems to be right in that this is an error:

May be related to #1130?
I tried downgrading winit to 0.8.3, but the same error occurs.

Most helpful comment

Thanks so much for the issue and sorry for the delay!

It looks like this is due to conrod's winit dependency being a different version to the winit used via glium (via glutin) so although the Event type is correct, they're technically not the same type as they're from different crate versions. I tested both your test and the examples... I find it very strange that the examples compile at all.

I'm going to do a conrod update very soon (once tomaka/winit#435 lands and is published) and I'll be sure to fix this at the same time.

All 4 comments

I'm also having this issue, after having copy-pasted the support/mod.rs code from the conrod/examples into a new repository and then calling it from main.rs in the same way as the examples do so.
Interestingly, the API reference suggests that convert_event does in fact take a glium::glutin::Event when you check the type of e: Event in docs.rs, although the source says the right thing.

Thanks so much for the issue and sorry for the delay!

It looks like this is due to conrod's winit dependency being a different version to the winit used via glium (via glutin) so although the Event type is correct, they're technically not the same type as they're from different crate versions. I tested both your test and the examples... I find it very strange that the examples compile at all.

I'm going to do a conrod update very soon (once tomaka/winit#435 lands and is published) and I'll be sure to fix this at the same time.

Whats happening with this? winit being bumped to 0.17 would be great

Closing outdated issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mitchmindtree picture mitchmindtree  路  22Comments

TimBednarzyk picture TimBednarzyk  路  3Comments

mitchmindtree picture mitchmindtree  路  3Comments

JulienPerrin picture JulienPerrin  路  10Comments

alanpoon picture alanpoon  路  4Comments