How do I fix cargo's "failed to parse manifest at ..." "editions are unstable" error?

Viewed 3448

I tried to augment my rust project with a dependency on jni="0.12.3" and my next cargo build failed with the following error:

error: unable to get packages from source

Caused by:
  failed to parse manifest at `/home/thoth/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.32/Cargo.toml`

Caused by:
  editions are unstable

Caused by:
  feature `edition` is required

consider adding `cargo-features = ["edition"]` to the manifest

I'm running cargo built from gentoo's dev-util/cargo-0.30.0 ebuild.

1 Answers

Since rust is a quickly-evolving language, the latest crates seem to use new features that my older version of cargo did not support. And since rust/cargo did not have something like portage's EAPI marker, the old cargo did not have a way to figure that out, so the error message was a bit indirect.

I have a theory that the Cargo.lock could be tweaked to use an older version of the backtrace crate, but I was not able to figure out a procedure to do this.

Upgrading to the rust-1.34.2 ebuild, and (don't forget this step:) then using eselect rust set 1 activated the new version of cargo, and it was able to build the package without malfunctioning.

Related