Tip: Rebuilding cargo binaries with the latest compiler

I wrote a jq filter that can find installed crates that were built with an older (or unknown) compiler.
Here's the command line:

jq -r '.installs|to_entries|.[]|select(.value.rustc//""|startswith("'"$(rustc --version)"'")|not)|.key|split(" ")|.[0]' ~/.cargo/.crates2.json

You can pipe it into

|xargs cargo install --force --

to rebuild them with the current compiler.

2 Likes