Hands-on Rust: flappy does not compile due to outdates bytemuck

Hands on Rust: Effective Learning through 2D Game Development and Play

Page 48

Cargo.toml file in book:

[package]
name = "hello_bterm"
version = "0.1.0"
authors = ["Herbert Wolverson <herberticus@gmail.com>"]
edition = "2018"
[dependencies]
bracket-lib = "~0.8.1"

When calling cargo run, get the following error:

error: failed to download `bytemuck v1.12.1`

Caused by:
  unable to get packages from source

Caused by:
  failed to parse manifest at `C:\Users\Mike Chambers\.cargo\registry\src\github.com-1ecc6299db9ec823\bytemuck-1.12.1\Cargo.toml`

Caused by:
  feature `resolver` is required

  this Cargo does not support nightly features, but if you
  switch to nightly channel you can add
  `cargo-features = ["resolver"]` to enable this feature

rustup version 1.25.1 and rustc 1.50.0

Is there a specific version of rust we need to use to get this to work?

Hi!

That’s a new one, haven’t run into that before! I’ll revisit this tomorrow when I have more time, but in the mean-time here’s two things to try:

Option 1: Lock the revision
Change the bracket-lib dependency to =0.8.1, and then run cargo update. That will force the package to the version that was live when the book released.

Option 2: Update Rust
At your command-line, issue rustup self update and then rustup update. I’m running rustup version 1.6.3 here, which definitely includes the new resolver system.

Hope that helps!

Thanks for the quick reply. The second option didnt work, but I was able to fix it by manually specifying rustup to use the latest version with this command:

rustup override set 1.64.0

I have another project which requires 1.51.1 (and specifies an override in the override.toml file) which is why 1.51.1 was the default on my system.