|
| 1 | +# Rust style editions |
| 2 | + |
| 3 | +The default Rust style evolves over time, as Rust does. However, to avoid |
| 4 | +breaking established code style, and CI jobs checking code style, changes to |
| 5 | +the default Rust style only appear in *style editions*. |
| 6 | + |
| 7 | +Code written in a given Rust edition uses the corresponding Rust style edition |
| 8 | +by default. To make it easier to migrate code style separately from the |
| 9 | +semantic changes between Rust editions, formatting tools such as `rustfmt` |
| 10 | +allow updating the style edition separately from the Rust edition. |
| 11 | + |
| 12 | +The current version of the style guide describes the latest Rust style edition. |
| 13 | +Each distinct past style will have a corresponding archived version of the |
| 14 | +style guide. |
| 15 | + |
| 16 | +Note that archived versions of the style guide do not document formatting for |
| 17 | +newer Rust constructs that did not exist at the time that version of the style |
| 18 | +guide was archived. However, each style edition will still format all |
| 19 | +constructs valid in that Rust edition, with the style of newer constructs |
| 20 | +coming from the first subsequent style edition providing formatting rules for |
| 21 | +that construct (without any of the systematic/global changes from that style |
| 22 | +edition). |
| 23 | + |
| 24 | +Not all Rust editions have corresponding changes to the Rust style. For |
| 25 | +instance, Rust 2015, Rust 2018, and Rust 2021 all use the same style edition. |
| 26 | + |
| 27 | +## Rust 2024 style edition |
| 28 | + |
| 29 | +This style guide describes the Rust 2024 style edition. The Rust 2024 style |
| 30 | +edition is currently nightly-only and may change before the release of Rust |
| 31 | +2024. |
| 32 | + |
| 33 | +For a full history of changes in the Rust 2024 style edition, see the git |
| 34 | +history of the style guide. Notable changes in the Rust 2024 style edition |
| 35 | +include: |
| 36 | + |
| 37 | +- Miscellaneous `rustfmt` bugfixes. |
| 38 | + |
| 39 | +## Rust 2015/2018/2021 style edition |
| 40 | + |
| 41 | +The archived version of the style guide at |
| 42 | +<https://github.com/rust-lang/rust/tree/37343f4a4d4ed7ad0891cb79e8eb25acf43fb821/src/doc/style-guide/src> |
| 43 | +describes the style edition corresponding to Rust 2015, Rust 2018, and Rust |
| 44 | +2021. |
0 commit comments