@@ -112,7 +112,45 @@ pub const SEE_CHANNELS: &str =
112
112
"See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information \
113
113
about Rust release channels.";
114
114
115
- /// The edition of the compiler (RFC 2052)
115
+ /// The edition of the compiler ([RFC 2052])
116
+ ///
117
+ /// The following sections will guide you how to add and stabilize an edition.
118
+ ///
119
+ /// ## Adding a new edition
120
+ ///
121
+ /// - Add the next edition to the enum.
122
+ /// - Update every match expression that now fails to compile.
123
+ /// - Update the [`FromStr`] impl.
124
+ /// - Update [`CLI_VALUES`] to include the new edition.
125
+ /// - Set [`LATEST_UNSTABLE`] to Some with the new edition.
126
+ /// - Add an unstable feature to the `features!` macro invocation below for the new edition.
127
+ /// - Gate on that new feature in TomlManifest::to_real_manifest.
128
+ /// - Update the shell completion files.
129
+ /// - Update any failing tests (hopefully there are very few).
130
+ /// - Update unstable.md to add a new section for this new edition (see [this example]).
131
+ ///
132
+ /// ## Stabilization instructions
133
+ ///
134
+ /// - Set [`LATEST_UNSTABLE`] to None.
135
+ /// - Set [`LATEST_STABLE`] to the new version.
136
+ /// - Update [`is_stable`] to `true`.
137
+ /// - Set the editionNNNN feature to stable in the `features!` macro invocation below.
138
+ /// - Update any tests that are affected.
139
+ /// - Update the man page for the `--edition` flag.
140
+ /// - Update unstable.md to move the edition section to the bottom.
141
+ /// - Update the documentation:
142
+ /// - Update any features impacted by the edition.
143
+ /// - Update manifest.md#the-edition-field.
144
+ /// - Update the `--edition` flag (options-new.md).
145
+ /// - Rebuild man pages.
146
+ ///
147
+ /// [RFC 2052]: https://rust-lang.github.io/rfcs/2052-epochs.html
148
+ /// [`FromStr`]: Edition::from_str
149
+ /// [`CLI_VALUES`]: Edition::CLI_VALUES
150
+ /// [`LATEST_UNSTABLE`]: Edition::LATEST_UNSTABLE
151
+ /// [`LATEST_STABLE`]: Edition::LATEST_STABLE
152
+ /// [this example]: https://github.com/rust-lang/cargo/blob/3ebb5f15a940810f250b68821149387af583a79e/src/doc/src/reference/unstable.md?plain=1#L1238-L1264
153
+ /// [`is_stable`]: Edition::is_stable
116
154
#[ derive( Clone , Copy , Debug , Hash , PartialOrd , Ord , Eq , PartialEq , Serialize , Deserialize ) ]
117
155
pub enum Edition {
118
156
/// The 2015 edition
@@ -123,33 +161,6 @@ pub enum Edition {
123
161
Edition2021 ,
124
162
}
125
163
126
- // Adding a new edition:
127
- // - Add the next edition to the enum.
128
- // - Update every match expression that now fails to compile.
129
- // - Update the `FromStr` impl.
130
- // - Update CLI_VALUES to include the new edition.
131
- // - Set LATEST_UNSTABLE to Some with the new edition.
132
- // - Add an unstable feature to the features! macro below for the new edition.
133
- // - Gate on that new feature in TomlManifest::to_real_manifest.
134
- // - Update the shell completion files.
135
- // - Update any failing tests (hopefully there are very few).
136
- // - Update unstable.md to add a new section for this new edition (see
137
- // https://github.com/rust-lang/cargo/blob/3ebb5f15a940810f250b68821149387af583a79e/src/doc/src/reference/unstable.md?plain=1#L1238-L1264
138
- // as an example).
139
- //
140
- // Stabilization instructions:
141
- // - Set LATEST_UNSTABLE to None.
142
- // - Set LATEST_STABLE to the new version.
143
- // - Update `is_stable` to `true`.
144
- // - Set the editionNNNN feature to stable in the features macro below.
145
- // - Update any tests that are affected.
146
- // - Update the man page for the --edition flag.
147
- // - Update unstable.md to move the edition section to the bottom.
148
- // - Update the documentation:
149
- // - Update any features impacted by the edition.
150
- // - Update manifest.md#the-edition-field.
151
- // - Update the --edition flag (options-new.md).
152
- // - Rebuild man pages.
153
164
impl Edition {
154
165
/// The latest edition that is unstable.
155
166
///
0 commit comments