• voxel@sopuli.xyz
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    rust doesn’t install dependencies globally, and packages or versions can’t be deleted from crates.io (they are instead yanked which prevents them from being used in new projects, while throwing a warning in existing ones)
    rust editions are fully compatible with each other so you can use 2015 crate in a 2021 project and vise versa.
    rust also allows having multiple versions of dependencies at the same time.
    if crate A depends on B 0.1 and crate C depends on B 0.2, rust will download and use both versions of B.
    you can run into issues if:

    • …you’re using c dependencies
    • …you have incompatible crate versions; cargo treats different versions as completely separate crates (please note that this is not a big issue, this shouldn’t scare you off; for example if there’s a crate A that depends on crate B 0.1 and provides fn A::dostuff(B::TypeFromB) and you have A and B 0.2 specified as dependencies, you won’t be able to use your B::TypeFromB as an argument in A::dostuff(...), and you’ll have to downgrade your version of B to 0.1 or ask the crate developer to update their library)
    • …you have a multi-crate cargo workspace or monorepo and forgot to specify resolver="2" (it uses resolver="1" by default for compatability, which is incompatible with a lot of crates)