From 0217565e247f9c1956313278d27c6bf0a7c44b0b Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Wed, 5 Jul 2023 19:59:28 -0700 Subject: [PATCH 1/2] style-guide: Document style editions, start 2024 style edition Link to a snapshot for the 2015/2018/2021 style edition. --- src/doc/style-guide/src/SUMMARY.md | 1 + src/doc/style-guide/src/editions.md | 44 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/doc/style-guide/src/editions.md diff --git a/src/doc/style-guide/src/SUMMARY.md b/src/doc/style-guide/src/SUMMARY.md index 606485bfb6c7e..64540c3997cda 100644 --- a/src/doc/style-guide/src/SUMMARY.md +++ b/src/doc/style-guide/src/SUMMARY.md @@ -9,4 +9,5 @@ - [Other style advice](advice.md) - [`Cargo.toml` conventions](cargo.md) - [Guiding principles and rationale](principles.md) +- [Rust style editions](editions.md) - [Nightly-only syntax](nightly.md) diff --git a/src/doc/style-guide/src/editions.md b/src/doc/style-guide/src/editions.md new file mode 100644 index 0000000000000..e9a91d0507a5f --- /dev/null +++ b/src/doc/style-guide/src/editions.md @@ -0,0 +1,44 @@ +# Rust style editions + +The default Rust style evolves over time, as Rust does. However, to avoid +breaking established code style, and CI jobs checking code style, changes to +the default Rust style only appear in *style editions*. + +Code written in a given Rust edition uses the corresponding Rust style edition +by default. To make it easier to migrate code style separately from the +semantic changes between Rust editions, formatting tools such as `rustfmt` +allow updating the style edition separately from the Rust edition. + +The current version of the style guide describes the latest Rust style edition. +Each distinct past style will have a corresponding archived version of the +style guide. + +Note that archived versions of the style guide do not document formatting for +newer Rust constructs that did not exist at the time that version of the style +guide was archived. However, each style edition will still format all +constructs valid in that Rust edition, with the style of newer constructs +coming from the first subsequent style edition providing formatting rules for +that construct (without any of the systematic/global changes from that style +edition). + +Not all Rust editions have corresponding changes to the Rust style. For +instance, Rust 2015, Rust 2018, and Rust 2021 all use the same style edition. + +## Rust 2024 style edition + +This style guide describes the Rust 2024 style edition. The Rust 2024 style +edition is currently nightly-only and may change before the release of Rust +2024. + +For a full history of changes in the Rust 2024 style edition, see the git +history of the style guide. Notable changes in the Rust 2024 style edition +include: + +- Miscellaneous `rustfmt` bugfixes. + +## Rust 2015/2018/2021 style edition + +The archived version of the style guide at + +describes the style edition corresponding to Rust 2015, Rust 2018, and Rust +2021. From 6a0886cdba7e6d35e1fa51d467b07ca83d888972 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 31 Jul 2023 16:07:48 -0700 Subject: [PATCH 2/2] Link to the Rust edition guide for more information about editions --- src/doc/style-guide/src/editions.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/doc/style-guide/src/editions.md b/src/doc/style-guide/src/editions.md index e9a91d0507a5f..5c67a185b8ffa 100644 --- a/src/doc/style-guide/src/editions.md +++ b/src/doc/style-guide/src/editions.md @@ -4,10 +4,12 @@ The default Rust style evolves over time, as Rust does. However, to avoid breaking established code style, and CI jobs checking code style, changes to the default Rust style only appear in *style editions*. -Code written in a given Rust edition uses the corresponding Rust style edition -by default. To make it easier to migrate code style separately from the -semantic changes between Rust editions, formatting tools such as `rustfmt` -allow updating the style edition separately from the Rust edition. +Code written in a given +[Rust edition](https://doc.rust-lang.org/edition-guide/) +uses the corresponding Rust style edition by default. To make it easier to +migrate code style separately from the semantic changes between Rust editions, +formatting tools such as `rustfmt` allow updating the style edition separately +from the Rust edition. The current version of the style guide describes the latest Rust style edition. Each distinct past style will have a corresponding archived version of the