Skip to content

Commit 25a84da

Browse files
committed
feat: Stabilize Edition 2024
1 parent 88edf01 commit 25a84da

File tree

49 files changed

+109
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+109
-205
lines changed

src/cargo/core/features.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ impl Edition {
200200
/// The latest edition that is unstable.
201201
///
202202
/// This is `None` if there is no next unstable edition.
203-
pub const LATEST_UNSTABLE: Option<Edition> = Some(Edition::Edition2024);
203+
pub const LATEST_UNSTABLE: Option<Edition> = None;
204204
/// The latest stable edition.
205-
pub const LATEST_STABLE: Edition = Edition::Edition2021;
205+
pub const LATEST_STABLE: Edition = Edition::Edition2024;
206206
pub const ALL: &'static [Edition] = &[
207207
Self::Edition2015,
208208
Self::Edition2018,
@@ -223,7 +223,7 @@ impl Edition {
223223
Edition2015 => None,
224224
Edition2018 => Some(semver::Version::new(1, 31, 0)),
225225
Edition2021 => Some(semver::Version::new(1, 56, 0)),
226-
Edition2024 => None,
226+
Edition2024 => Some(semver::Version::new(1, 85, 0)),
227227
}
228228
}
229229

@@ -234,7 +234,7 @@ impl Edition {
234234
Edition2015 => true,
235235
Edition2018 => true,
236236
Edition2021 => true,
237-
Edition2024 => false,
237+
Edition2024 => true,
238238
}
239239
}
240240

@@ -507,7 +507,7 @@ features! {
507507
(stable, workspace_inheritance, "1.64", "reference/unstable.html#workspace-inheritance"),
508508

509509
/// Support for 2024 edition.
510-
(unstable, edition2024, "", "reference/unstable.html#edition-2024"),
510+
(stable, edition2024, "1.85", "reference/unstable.html#edition-2024"),
511511

512512
/// Allow setting trim-paths in a profile to control the sanitisation of file paths in build outputs.
513513
(unstable, trim_paths, "", "reference/unstable.html#profile-trim-paths-option"),

src/cargo/util/toml/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,9 +1217,7 @@ pub fn to_real_manifest(
12171217
// features.require(Feature::edition20xx())?;
12181218
// }
12191219
// ```
1220-
if edition == Edition::Edition2024 {
1221-
features.require(Feature::edition2024())?;
1222-
} else if !edition.is_stable() {
1220+
if !edition.is_stable() {
12231221
// Guard in case someone forgets to add .require()
12241222
return Err(util::errors::internal(format!(
12251223
"edition {} should be gated",

src/doc/src/reference/resolver.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ resolver = "2"
507507
- `"2"` ([`edition = "2021"`](manifest.md#the-edition-field) default): Introduces changes in [feature
508508
unification](#features). See the [features chapter][features-2] for more
509509
details.
510-
- `"3"` (requires Rust 1.84+): Change the default for [`resolver.incompatible-rust-versions`] from `allow` to `fallback`
510+
- `"3"` ([`edition = "2024"`](manifest.md#the-edition-field) default, requires Rust 1.84+): Change the default for [`resolver.incompatible-rust-versions`] from `allow` to `fallback`
511511

512512
The resolver is a global option that affects the entire workspace. The
513513
`resolver` version in dependencies is ignored, only the value in the top-level

src/doc/src/reference/unstable.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ Each new feature described below should explain how to use it.
100100
* [codegen-backend](#codegen-backend) --- Select the codegen backend used by rustc.
101101
* [per-package-target](#per-package-target) --- Sets the `--target` to use for each individual package.
102102
* [artifact dependencies](#artifact-dependencies) --- Allow build artifacts to be included into other build artifacts and build them for different targets.
103-
* [Edition 2024](#edition-2024) — Adds support for the 2024 Edition.
104103
* [Profile `trim-paths` option](#profile-trim-paths-option) --- Control the sanitization of file paths in build outputs.
105104
* [`[lints.cargo]`](#lintscargo) --- Allows configuring lints for Cargo.
106105
* [path bases](#path-bases) --- Named base directories for path dependencies.
@@ -1363,32 +1362,6 @@ Differences between `cargo run --manifest-path <path>` and `cargo <path>`
13631362

13641363
### Documentation Updates
13651364

1366-
## Edition 2024
1367-
* Tracking Issue: (none created yet)
1368-
* RFC: [rust-lang/rfcs#3501](https://github.com/rust-lang/rfcs/pull/3501)
1369-
1370-
Support for the 2024 [edition] can be enabled by adding the `edition2024`
1371-
unstable feature to the top of `Cargo.toml`:
1372-
1373-
```toml
1374-
cargo-features = ["edition2024"]
1375-
1376-
[package]
1377-
name = "my-package"
1378-
version = "0.1.0"
1379-
edition = "2024"
1380-
```
1381-
1382-
If you want to transition an existing project from a previous edition, then
1383-
`cargo fix --edition` can be used on the nightly channel. After running `cargo
1384-
fix`, you can switch the edition to 2024 as illustrated above.
1385-
1386-
This feature is very unstable, and is only intended for early testing and
1387-
experimentation. Future nightly releases may introduce changes for the 2024
1388-
edition that may break your build.
1389-
1390-
[edition]: ../../edition-guide/index.html
1391-
13921365
## Profile `trim-paths` option
13931366

13941367
* Tracking Issue: [rust-lang/cargo#12137](https://github.com/rust-lang/cargo/issues/12137)
@@ -2013,3 +1986,10 @@ default behavior.
20131986

20141987
See the [build script documentation](build-scripts.md#rustc-check-cfg) for information
20151988
about specifying custom cfgs.
1989+
1990+
## Edition 2024
1991+
1992+
The 2024 edition has been stabilized in the 1.85 release.
1993+
See the [`edition` field](manifest.md#the-edition-field) for more information on setting the edition.
1994+
See [`cargo fix --edition`](../commands/cargo-fix.md) and [The Edition Guide](../../edition-guide/index.html) for more information on migrating existing projects.
1995+

0 commit comments

Comments
 (0)