Skip to content

On managing the stability guarantee in 2.0 and later #4128

@topecongiro

Description

@topecongiro

I would like to discuss how we enforce the stability guarantee in 2.0 and later.

rustfmt must guarantee that the default formatting will not change between versions as long as their major versions remain the same.

During 1.x, we managed it by adding version-gates to code and checking the version at runtime. Unfortunately, this method was prone to bugs and code complexity. In 2.0 and later, we would like to use a different approach to guarantee stability.

Initially, I was thinking of using different versions of rustfmt-lib, depending on which version a user has specified. Unfortunately, it turns out that this method requires some serous rearchitecting of the code. Since we would like to release 2.0 as soon as possible, I am looking for another approach.

One way is to separate the development branch from the release branch. Currently, the development and release of rustfmt are done almost entirely on the master branch. I want to change this to the following way:

  • We will keep using the master branch as a development branch. Every PR will be based on and merged to the master branch.
  • We will create a new branch for release (I will call it release). PRs merged into the master branch that does not change the default formatting will be merged into the release branch; publishment to crates.io and submodule registration to the rust repository will be made only from the release branch.

This way, we can guarantee stability without adding extra code to our development codebase. The downside is that users will lose access to the latest format style unless they build rustfmt from the source. I am expecting that the branch management won't be that bad, though we may need to introduce bot for auto-merging PRs.

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