Skip to content
FutureBlitz

    Install

    Packages

    Versions and ranges

    Semantic versions, the ranges a dependency takes, and how fb picks one version of each package.

    Versions

    A package’s version is a semantic version: three numbers, major.minor.patch, without leading zeros, and maybe a pre-release after a -, like 2.0.0-beta.2.

    • The patch number goes up for fixes.
    • The minor number goes up for what’s added, which doesn’t break code that uses the package.
    • The major number goes up for what breaks it.

    Below 1.0, the minor number is the one that breaks: 0.4 and 0.5 aren’t compatible. Versions are ordered as semver orders them, so a pre-release comes before its version: 2.0.0-beta.2 is before 2.0.0.

    Ranges

    A dependency takes a range of versions, written as Cargo writes them. Spaces around , and after an operator are fine; || and hyphen ranges aren’t ranges.

    RangeMeans
    1.2.3, ^1.2.3>=1.2.3, <2.0.0: what’s compatible with 1.2.3
    1.2, ^1.2>=1.2.0, <2.0.0
    1>=1.0.0, <2.0.0
    0.4.1, 0.4>=0.4.1, <0.5.0, and >=0.4.0, <0.5.0
    0.0.3=0.0.3
    ~1.2.3, ~1.2>=1.2.3, <1.3.0, and >=1.2.0, <1.3.0: patches only
    =1.2.3That version only
    >=1.2, >1.2.3, <2, <=1.4.0As written, a missing number 0; but >1.2 is >=1.3.0, and <=1.2 is <1.3.0
    >=1.2, <1.5Every comparator, separated by commas, holds
    *, 1.*, 1.2.*Any version, any 1.x, any 1.2.x

    A range takes a pre-release only when one of its comparators names a pre-release of the same three numbers: >=2.0.0-beta.0 takes 2.0.0-beta.2, but >=1.9 and 2 don’t.

    fb add writes the newest version as a range, colors = "1.4.2", which takes 1.4.2 and every later 1.x.

    One version of each

    Every package in a program agrees on one version of each dependency, so a type from a package is one type everywhere in the program. fb picks, for each package, a version that every range on it allows: the program’s own, its local packages’, and those of each version picked.

    • It tries the newest version first, but a version fb.lock has goes first while every range still allows it, so adding a dependency changes nothing else.
    • It skips yanked versions, unless fb.lock has them, and versions whose fb range the fb running isn’t in.
    • When a choice leads to a conflict, it goes back and tries the next newest. When nothing works, it says which ranges conflict, and who asks for each:
    error: no version of palette fits everything that asks for it: shop asks for 0.4, and colors 1.4.2 asks for 0.3

    Two packages that need different major versions of one package can’t be in one program. Use versions of them that agree, or ask their authors to update.

    Report an issue with this page or with FutureBlitz on GitHub.