I'm learning Rust from "Practical Rust Projects" by Shing Lyu. I'm now trying to build a game following the steps in Chapter 4. I'm working on Ubuntu 18.04 LTS.
After installing Rust and the Amethyst command line, I created a new project via amethyst new cat_volleyball
. The next step is to run the engine using cargo run --features=vulkan
. When I do so, I get the error prompt below. Do you have suggestions on how to fix this?
error[E0433]: failed to resolve: could not find `__rt` in `quote`
--> /home/alberto/.cargo/registry/src/github.com-1ecc6299db9ec823/err-derive-0.1.6/src/lib.rs:145:63
|
145 | fn display_body(s: &synstructure::Structure) -> Option<quote::__rt::TokenStream> {
| ^^^^ could not find `__rt` in `quote`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
error: could not compile `err-derive`.
warning: build failed, waiting for other jobs to finish...
TL;DR Edit the
Cargo.lock
manually, please check the title below for the proper steps : How to force cargo to use yanked version of sub-dependencyWhy this happens ?
Because
err-derive-0.1.6
is usingquote-1.0.2
as a dependency and quote is declared like below:It means Cargo will use the latest patch update, so if
quote-1.0.3
is out then cargo will use1.0.3
instead1.0.2
. Please check caret-requirement. The problem in here isquote-1.0.3
breaks the backward compatibility, the part that used byerr-derive-0.1.6
is no longer exists inquote-1.0.3
.How to force cargo to use specific version of sub-dependency
You can fix this issue by forcing the sub-dependency to use compatible version for your dependency. This command will do it :
How to force cargo to use yanked version of sub-dependency
Looks like
quote-1.0.2
was yanked from crates.io, so command up above will not work because cargo will not be able to find the yanked version on crates.io . Since cargo update modifies thecargo.lock
we can do it manually. To start clean :Cargo.lock
cargo update
( this will generate the latest version ofCargo.lock
)Cargo.lock
:Find the incompatible version of package in cargo.lock which is
quote-1.0.3
, It should look like this:then simply change version to the compatible version in our case it is
"1.0.2"
After doing that do not run cargo update again, it will overwrite your changes and you'll not able to compile your project. Please remember this is a workaround for being able to continue the development, there is a reason to yank crates, do not use it in production it is best to wait dependent crates to update itself.
Note : In some cases you may get an error after editing
cargo.lock
:@albus_c fixed this by doing :