sebcrozet/kiss3d

attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid (on nightly)

Closed this issue · 2 comments

Hey, I got an error today.

thread 'main' panicked at 'attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid', /home/nivek/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:658:9

Here is the backtrace

0: rust_begin_unwind
             at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/panicking.rs:85
   2: core::panicking::panic
             at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/core/src/panicking.rs:50
   3: core::mem::uninitialized
             at /home/nivek/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:658
   4: winit::platform::platform::x11::util::input::<impl winit::platform::platform::x11::xdisplay::XConnection>::query_pointer
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.18.1/src/platform/linux/x11/util/input.rs:94
   5: winit::platform::platform::x11::window::UnownedWindow::new::{{closure}}
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.18.1/src/platform/linux/x11/window.rs:89
   6: core::option::Option<T>::unwrap_or_else
             at /home/nivek/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:424
   7: winit::platform::platform::x11::window::UnownedWindow::new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.18.1/src/platform/linux/x11/window.rs:88
   8: winit::platform::platform::x11::Window::new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.18.1/src/platform/linux/x11/mod.rs:1296
   9: winit::platform::platform::Window::new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.18.1/src/platform/linux/mod.rs:147
  10: winit::window::<impl winit::WindowBuilder>::build
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.18.1/src/window.rs:157
  11: glutin::platform::platform::x11::Context::new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.19.0/src/platform/linux/x11.rs:204
  12: glutin::platform::platform::Context::new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.19.0/src/platform/linux/mod.rs:97
  13: glutin::GlWindow::new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.19.0/src/lib.rs:371
  14: <kiss3d::window::gl_canvas::GLCanvas as kiss3d::window::canvas::AbstractCanvas>::open
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.25.0/src/window/gl_canvas.rs:49
  15: kiss3d::window::canvas::Canvas::open
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.25.0/src/window/canvas.rs:65
  16: kiss3d::window::window::Window::do_new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.25.0/src/window/window.rs:508
  17: kiss3d::window::window::Window::new
             at /home/nivek/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.25.0/src/window/window.rs:482
  18: quadruped_simulation::main
             at ./src/main.rs:121
  19: core::ops::function::FnOnce::call_once
             at /home/nivek/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227

let mut window = Window::new("Simulation"); starts it all.

This error happens on the nightly toolchain. On the stable it no issue.

Sorry if this is not the correct place to share this because it's caused by the toolchain and not by the library itself but I thought maybe it's important so we can adjust this library to work on nightly as well and when the nightly might become stable.

Seems related: rust-lang/rust#73573

More recent winit versions had definitely moved to MaybeUninit, so bumping winit would seem to be the obvious way. However, since winit moved to a new event loop architecture, I fear that kiss3d will need some API redesign in order to get it to work and it may be non-trivial.

I am getting this on stable (1.48). For example, this happens when running cargo run --example cube. I don't get this on 1.46.