about summary refs log tree commit diff
path: root/src/tools/rustfmt/Processes.md
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-15 14:55:56 +0000
committerbors <bors@rust-lang.org>2021-05-15 14:55:56 +0000
commiteac3c7c5bd38ec38062ebde475bd2ea6317d0c09 (patch)
treeb57dd71626453dfe3346ebae075e9882d88cc3e2 /src/tools/rustfmt/Processes.md
parent2a245f40a19c9a60b3be33c959eb5cfb0ad163c6 (diff)
parent34368ec2aaa4362a1f850cc1610d0a17e60d37b5 (diff)
downloadrust-eac3c7c5bd38ec38062ebde475bd2ea6317d0c09.tar.gz
rust-eac3c7c5bd38ec38062ebde475bd2ea6317d0c09.zip
Auto merge of #82208 - jyn514:rustfmt-subtree, r=Mark-Simulacrum
Convert rustfmt from a submodule to a subtree

r? `@calebcartwright` cc `@Manishearth` `@Mark-Simulacrum`

The motivation is that submodule updates cause rustfmt to not be available on nightly a lot; most recently it was unavailable for over 10 days, causing the beta release to be delayed. Additionally this is much less work on the part of the rustfmt maintainers to keep the rustfmt compiling, since now people making breaking changes will be responsible for fixing them.

I kept the rustfmt git history so it looks like there are thousands of commits. The important commits are https://github.com/rust-lang/rust/compare/851dee3af9404bf399c3c4ffefe5105edb3debad~..pull/82208/head. This adds about 10 MB of git history, which is not terribly much compared to the 702 MB that already exist.

- Add `src/tools/rustfmt` to `x.py check`
- Fix CRLF issues with rustfmt tests (see commit for details)
- Use `rustc_private` instead of crates.io dependencies

  This was already switched upstream and would have landed in the next submodule bump anyway. This just updates Cargo.lock for rust-lang/rust.

- Add `yansi-term` to the list of allowed dependencies.

  This is a false positive - rustc doesn't actually use it, only rustfmt, but because it's activated by the cargo feature of a dependency, tidy gets confused. It's fairly innocuous in any case, it's used for color printing.
  This would have happened in the next submodule bump.

- Remove rustfmt from the list of toolstate tools.
- Give a hard error if testing or building rustfmt fails.
-  Update log to 0.4.14

   This avoids a warning about semicolons in macros; see the commit for details.

- Don't add tools to the sysroot when they finish building.

  This is the only change that could be considered a regression - this avoids a "colliding StableCrateId" error due to a bug in resolve (https://github.com/rust-lang/rust/issues/56935). The regression is that this rebuilds dependencies more often than strictly necessary. See the commit for details.

Fixes https://github.com/rust-lang/rust/issues/85226 (permanently). Closes https://github.com/rust-lang/rust/issues/82385. Helps with https://github.com/rust-lang/rust/issues/70651. Helps with https://github.com/rust-lang/rust/issues/80639.
Diffstat (limited to 'src/tools/rustfmt/Processes.md')
-rw-r--r--src/tools/rustfmt/Processes.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/tools/rustfmt/Processes.md b/src/tools/rustfmt/Processes.md
new file mode 100644
index 00000000000..9d86d52b122
--- /dev/null
+++ b/src/tools/rustfmt/Processes.md
@@ -0,0 +1,57 @@
+This document outlines processes regarding management of rustfmt.
+
+# Stabilising an Option
+
+In this Section, we describe how to stabilise an option of the rustfmt's configration.
+
+## Conditions
+
+- Is the default value correct ?
+- The design and implementation of the option are sound and clean.
+- The option is well tested, both in unit tests and, optimally, in real usage.
+- There is no open bug about the option that prevents its use.
+
+## Steps
+
+Open a pull request that closes the tracking issue. The tracking issue is listed beside the option in `Configurations.md`.
+
+- Update the `Config` enum marking the option as stable.
+- Update the the `Configuration.md` file marking the option as stable.
+- Update `CHANGELOG.md` marking the option as stable.
+
+## After the stabilisation
+
+The option should remain backward-compatible with previous parameters of the option. For instance, if the option is an enum `enum Foo { Alice, Bob }` and the variant `Foo::Bob` is removed/renamed, existing use of the `Foo::Bob` variant should map to the new logic. Breaking changes can be applied under the condition they are version-gated.
+
+# Make a Release
+
+## 0. Update CHANGELOG.md
+
+## 1. Update Cargo.toml and Cargo.lock
+
+For example, 1.0.0 -> 1.0.1:
+
+```diff
+-version = "1.0.0"
++version = "1.0.1"
+```
+
+## 2. Push the commit to the master branch
+
+E.g., https://github.com/rust-lang/rustfmt/commit/5274b49caa1a7db6ac10c76bf1a3d5710ccef569
+
+## 3. Create a release tag
+
+```sh
+git tag -s v1.2.3 -m "Release 1.2.3"
+```
+
+## 4. Publish to crates.io
+
+`cargo publish`
+
+## 5. Create a PR to rust-lang/rust to update the rustfmt submodule
+
+Note that if you are updating `rustc-ap-*` crates, then you need to update **every** submodules in the rust-lang/rust repository that depend on the crates to use the same version of those.
+
+As of 2019/05, there are two such crates: `rls` and `racer` (`racer` depends on `rustc-ap-syntax` and `rls` depends on `racer`, and `rls` is one of submodules of the rust-lang/rust repository).