Search code examples
rustrust-cargorust-crates

Can´t use Old version of Crates in Rust


due to my Uni project i need to fuzz some crates and recreate bugs. But for some reason when i choose the version bson="1.2.0" and do Cargo update i find this version in my Cargo.lock [[package]] name = "bson" version = "1.2.4"

Can some one help me with that please?

removing Cargo.lock and reinstall, but no help


Solution

  • cargo update means to choose the latest compatible version for all dependencies. You have two choices:

    • Make an exact version requirement:

      [dependencies]
      bson = "=1.2.0"
      
    • Ask to update the Cargo.lock selected version to a specific version:

      cargo update -p bson --precise 1.2.0

      This would be overwritten the next time you run cargo update, but it might be easier for quick experiments and, in general, if you want to reproduce an old build, then the best way to do that is to use the old Cargo.lock data.