How to Downgrade a Dependency in Cargo

Downgrade a Cargo dependency by setting a specific older version number in Cargo.toml and running cargo update.

Downgrade a dependency by specifying the exact older version in your Cargo.toml file. Open Cargo.toml, locate the dependency under [dependencies], and change the version number to the desired older release.

[dependencies]
serde = "1.0.150"

Run cargo update -p serde to update the lockfile with the new version.