How to find out, why Cargo isn't using the current version of a crate?


For some reason, my project depends on tracing 0.1.21.

I checked Cargo.lock, and all crates depend on tracing ^0.1, except h2, which depends on tracing ^0.1.21 (which should be the same as tracing ^0.1, if I read the docs correctly).

So I'm wondering why cargo selects tracing 0.1.21, instead of tracing 0.1.25.

Does it select tracing 0.1.21 again if you delete your Cargo.lock file?

1 Like

No. Thank you!

What could have been the reason, why 0.1.21 was selected earlier?

I installed hyper/h2 before tracing, but shouldn't cargo update tracing to the current version, after it was installed explicitly?

No, if Cargo.lock file already has compatible version, Cargo won't update it implicitly. You have to either delete Cargo.lock and recreate it from scratch, or explicitly use cargo update.

1 Like

It may be that, at the time you initially created your project, that was the latest version.

1 Like

Ah, thank you. I wrongly assumed, cargo would install updates automatically, when it re-compiles... Until now, I never have used cargo update...

That most likely is the reason. My new crate is part of an older workspace, which might had tracing installed in the past. Thanks again!