Locally cached crate build instead of required version

I have one dependency in my project, which, in turn, depends on err-dervie crate version 0.2. But when compling I'm getting error of building err-deriver version 0.1.6, which is somehow cached from git (and it's the only one in cache).

Where to look to fix it?

error[E0433]: failed to resolve: could not find __rt in quote
--> C:\Users\jony.cargo\registry\src\github.com-1ecc6299db9ec823\err-derive-0.1.6\src\lib.rs:145:63
|
145 | fn display_body(s: &synstructure::Structure) -> Optionquote::__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.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
PS C:\Users\jony\projects\vpo-agent> ls C:\Users\jony.cargo\registry\src\

Directory: C:\Users\jony\.cargo\registry\src

Mode LastWriteTime Length Name


d----- 6/10/2020 8:04 AM github.com-1ecc6299db9ec823

I think the bad crate has been yanked, so cargo update should be enough to get rid of it.

  1. Try deleting Cargo.lock
  2. If that doesn't help, try deleting target/
  3. If that doesn't help, try deleting .cargo/git/ and .cargo/registry/ in your home directory.

looks like something with crate I'm using - tried on another machine and getting same error...

Are you getting the same error after having run cargo update & deleting the things @kornel mentioned as before doing those things?

If it's a similar, but different, error, could you post that error here as well?

I see that Cargo.toml of used crate depends on err-derive = "0.2.0" but in Cargo.lock it's "0.1.6" for whatever reason and I can't figure out what's the source of it...

Could you possibly share the Cargo.toml and Cargo.lock? (Maybe in a gist?)

Looking closer to Cargo.lock content I see which crates depend on 0.1 version:

[[package]]
name = "err-derive"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41487fadaa500d02a819eefcde5f713599a01dd51626ef25d2d72d87115667b"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"rustc_version",
"syn",
"synstructure",
]

Those are "chained" dependencies so I guess it's the matter of their maintainers to update to "0.2" or clone locally everything and fix? =(

Looks like that these are the dependencies of err-derive itself and not the crates which depend on err-derive. Could you look through the Cargo.lock to check if someone lists err-derive in its dependencies block?

So it's referred by windows-service crate only like this:

[package]]
name = "windows-service"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "048b185a91d03beafe88c5db975c42c12b9462bc939f92ca863c88785a33a6ab"
dependencies = [
"bitflags",
"err-derive",
"widestring",
"winapi",
]

Still not clean why version = "0.1.6" instead of one defined in dependent toml.

Cargo.lock gist

windows-service 0.2.0 depends on a version off err-derive semver compatible with 0.1.5. This includes err-derive 0.1.6, but not err-derive 0.2.0.

says 0.2.4 in Cargo.toml... github

what am I missing?

There has been no new release since the err-derive dependency was updated.

linked git version and everything compiles now. Tag missing on git side of the repo? =)

It might be simply not published yet after change.

The "Source" tab on docs.rs is useful for viewing what has actually been published. crates.io does not use GitHub as the source, so GitHub may contain something completely different (this is especially important to keep in mind if you review code for security!)

https://docs.rs/crate/windows-service/0.2.0/source/Cargo.toml

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.