Skip to content

Use different versions of lib crate to enforce stability guarantee #3841

Closed
@topecongiro

Description

@topecongiro

Once #1583 gets resolved, we will be able to use different versions of the lib crate to enforce the stability guarantee.

I am thinking of something like the following:

In Cargo.toml, we add two versions of rustfmt-lib as dependencies

[dependencies.rustfmt_stable]
package = "rustfmt-lib"
version = "2.0.0"

[dependencies.rustfmt_nightly]
package = "rustfmt-lib"
version = "2.1.0"

and in rustfmt-bin, we call one of them depending on the configuration

if (config.Version >= Version::Two) {
    rustfmt_nightly::format()
} else {
    rustfmt_stable::format()
}

In the above example, we use 2.0.x as the stable releases and 2.y.z. as the nightly releases.

Pros and cons I am aware of:

  • Pros
    • We get stronger stability guarantee.
    • We no longer need to add version gating to the develop branch
  • Cons
    • We need to backport changes to the stable branch.
      • Updating rustc-ap-* crates
      • Fixing critical bugs
    • Stable users won’t be able to profit from improvements we make against the nightly branch unless we backport them.
    • We need to build two rustfmt-lib crates, which will likely lead to longer build time and larger binary

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions