Dependency crash with latest rust version

Hello,

I write a gui game since last year. I just updated my rust version with rustup update and now, run result a crash:

➜  rollgui git:(master) ✗ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.19s
     Running `target/debug/rollgui`
Enable bug report (configurable in config.ini)
thread 'main' panicked at 'attempted to leave type `linked_hash_map::Node<u32, rusttype::gpu_cache::Row>` uninitialized, which is invalid', /home/bux/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:50:5
   3: core::mem::uninitialized
             at /home/bux/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
   4: linked_hash_map::LinkedHashMap<K,V,S>::ensure_guard_node
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/linked-hash-map-0.5.2/src/lib.rs:174:52
   5: linked_hash_map::LinkedHashMap<K,V,S>::insert
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/linked-hash-map-0.5.2/src/lib.rs:304:9
   6: rusttype::gpu_cache::Cache::cache_queued
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/rusttype-0.8.3/src/gpu_cache.rs:778:21
   7: glyph_brush::glyph_brush::GlyphBrush<V,H>::process_queued
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/glyph_brush-0.6.3/src/glyph_brush.rs:336:23
   8: gfx_glyph::GlyphBrush<R,F,H>::draw
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx_glyph-0.15.0/src/lib.rs:368:28
   9: gfx_glyph::draw_builder::DrawBuilder<R,F,H,()>::draw
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx_glyph-0.15.0/src/draw_builder.rs:209:9
  10: coffee::graphics::backend_gfx::font::Font::draw
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/graphics/backend_gfx/font.rs:47:9
  11: coffee::graphics::backend_gfx::Gpu::draw_font
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/graphics/backend_gfx/mod.rs:166:9
  12: coffee::graphics::target::Target::draw_font
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/graphics/target.rs:125:9
  13: coffee::graphics::font::Font::draw
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/graphics/font.rs:49:9
  14: <coffee::load::loading_screen::progress_bar::ProgressBar as coffee::load::loading_screen::LoadingScreen>::draw
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/load/loading_screen/progress_bar.rs:73:9
  15: coffee::load::loading_screen::LoadingScreen::run::{{closure}}
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/load/loading_screen.rs:78:13
  16: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/bux/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:269:13
  17: coffee::load::task::Worker::notify_progress
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/load/task.rs:327:17
  18: coffee::load::task::Task<T>::run_with_window
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/load/task.rs:287:9
  19: coffee::load::loading_screen::LoadingScreen::run
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/load/loading_screen.rs:77:9
  20: coffee::game::loop::Loop::run
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/game/loop.rs:49:13
  21: coffee::ui::UserInterface::run
             at /home/bux/.cargo/registry/src/github.com-1ecc6299db9ec823/coffee-0.4.1/src/ui.rs:274:9
  22: rollgui::main
             at ./src/main.rs:39:5
  23: core::ops::function::FnOnce::call_once
             at /home/bux/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I suppose error is come from coffee dependency (I guess right ?). Can I pin rust version to use in Cargo.toml ? Can I have a different version of rust on my computer ?

Thanks !

This happened because the code did not initialize a variable in a place where the variable has to be initialized. The compiler has been updated to panic in a few of such cases, and it is not considered a breaking change because the code has UB, so the compiler is allowed to do anything.

1 Like

This was a bug in the linked-hash-map crate that was fixed in version 0.5.3. Run this command to update to the latest version:

cargo update -p linked-hash-map

(You can also run cargo update with no arguments to update all your dependencies.)

1 Like

You save my day !

Updating linked-hash-map did not work for me.
I also did cargo update then, but I'm still having this problem.

Can someone help me, please?

Which version of linked-hash-map do you depend on? You can look at either the build logs when building with -v to see already compiled dependencies too or you can look at Cargo.lock.

linked-hash-map has version 0.5.4. I'm using arch linux.