Skip to content

Commit f48b0e8

Browse files
authored
Merge pull request #338 from ehuss/stabilize-2024
Update for 2024 stabilization
2 parents ff1c198 + 446b495 commit f48b0e8

29 files changed

+15
-118
lines changed

src/SUMMARY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
## Rust 2024
4040

41-
- [Rust 2024 🚧](rust-2024/index.md)
41+
- [Rust 2024](rust-2024/index.md)
4242
- [Language](rust-2024/language.md)
4343
- [RPIT lifetime capture rules](rust-2024/rpit-lifetime-capture.md)
4444
- [`if let` temporary scope](rust-2024/temporary-if-let-scope.md)

src/editions/creating-a-new-project.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ $ cat foo/Cargo.toml
1111
[package]
1212
name = "foo"
1313
version = "0.1.0"
14-
edition = "2021"
14+
edition = "2024"
1515

1616
[dependencies]
1717
```
1818

19-
That `edition = "2021"` setting configures your package to be built using the
20-
Rust 2021 edition. No further configuration needed!
19+
That `edition = "2024"` setting configures your package to be built using the
20+
Rust 2024 edition. No further configuration needed!
2121

2222
You can use the `--edition <YEAR>` option of `cargo new` to create the project
2323
using some specific edition. For example, creating a new project to use the

src/editions/transitioning-an-existing-project-to-a-new-edition.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ It will update your source code so that it is compatible with the next edition.
55
Briefly, the steps to update to the next edition are:
66

77
1. Run `cargo fix --edition`
8-
2. Edit `Cargo.toml` and set the `edition` field to the next edition, for example `edition = "2021"`
8+
2. Edit `Cargo.toml` and set the `edition` field to the next edition, for example `edition = "2024"`
99
3. Run `cargo build` or `cargo test` to verify the fixes worked.
1010

1111
The following sections dig into the details of these steps, and some of the issues you may encounter along the way.
@@ -93,7 +93,7 @@ The steps are roughly similar to the stable channel:
9393

9494
1. Install the most recent nightly: `rustup update nightly`.
9595
2. Run `cargo +nightly fix --edition`.
96-
3. Edit `Cargo.toml` and place `cargo-features = ["edition2024"]` at the top (above `[package]`), and change the edition field to say `edition = "2024"`.
96+
3. Edit `Cargo.toml` and place `cargo-features = ["edition20xx"]` at the top (above `[package]`), and change the edition field to say `edition = "20xx"` where `20xx` is the edition you are upgrading to.
9797
4. Run `cargo +nightly check` to verify it now works in the new edition.
9898

9999
> **⚠ Caution**: Features implemented in the next edition may not have automatic migrations implemented with `cargo fix`, and the features themselves may not be finished.

src/rust-2024/cargo-inherited-default-features.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Cargo: Reject unused inherited default-features
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
## Summary
64

75
- `default-features = false` is no longer allowed in an inherited workspace dependency if the workspace dependency specifies `default-features = true` (or does not specify `default-features`).

src/rust-2024/cargo-resolver.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Cargo: Rust-version aware resolver
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
## Summary
64

75
- `edition = "2024"` implies `resolver = "3"` in `Cargo.toml` which enables a Rust-version aware dependency resolver.

src/rust-2024/cargo-table-key-names.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Cargo: Table and key name consistency
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
## Summary
64

75
- Several table and key names in `Cargo.toml` have been removed where there were previously two ways to specify the same thing.

src/rust-2024/gen-keyword.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# `gen` keyword
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123904>.
5-
63
## Summary
74

85
- `gen` is a [reserved keyword].

src/rust-2024/index.md

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
11
# Rust 2024
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
| Info | |
64
| --- | --- |
75
| RFC | [#3501](https://rust-lang.github.io/rfcs/3501-edition-2024.html) |
8-
| Release version | 1.85.0 (anticipated) |
9-
10-
The Rust 2024 Edition is scheduled to be frozen on 2024-10-17, stabilized on nightly on 2024-11-28, and released as stable with Rust 1.85.0 on 2025-02-20. In more detail, the currently anticipated release schedule is:
11-
12-
| Date | Version | Edition stage |
13-
|------------|---------------|--------------------------------|
14-
| 2024-10-11 | Branch v1.83 | Go / no go on all items |
15-
| 2024-10-17 | Release v1.82 | Rust 2024 nightly beta |
16-
| 2024-11-22 | Branch v1.84 | Prepare to stabilize... |
17-
| 2024-11-28 | Release v1.83 | Stabilize Rust 2024 on master |
18-
| 2025-01-03 | Branch v1.85 | Cut Rust 2024 to beta |
19-
| 2025-01-09 | Release v1.84 | Announce Rust 2024 is pending! |
20-
| 2025-02-20 | Release v1.85 | Release Rust 2024 |
21-
22-
Our motivating priorities for this edition are to:
23-
24-
- Make *this* edition a success.
25-
- Do so without requiring heroics from anyone.
26-
- ...or stressing anyone or everyone out.
27-
28-
Consequently, it's possible that things could change if needed so as to better adhere to those guiding priorities. This is a project run by volunteers.
29-
30-
However, at the moment, **the edition is on track**.
6+
| Release version | 1.85.0 |

src/rust-2024/intoiterator-box-slice.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Add `IntoIterator` for `Box<[T]>`
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123759>.
5-
63
## Summary
74

85
- Boxed slices implement [`IntoIterator`] in *all* editions.
@@ -39,8 +36,7 @@ This example is allowed on all editions because previously this was an error sin
3936

4037
However, this would normally be a breaking change because existing code that manually called `.into_iter()` on a boxed slice would change from having an iterator over references to an iterator over values. To resolve this problem, method calls of `.into_iter()` on boxed slices have edition-dependent behavior. In editions before 2024, it continues to return an iterator over references, and starting in Edition 2024 it returns an iterator over values.
4138

42-
<!-- TODO: edition2024 -->
43-
```rust
39+
```rust,edition2024
4440
// Example of changed behavior in Edition 2024
4541
let my_boxed_slice: Box<[u32]> = vec![1, 2, 3].into_boxed_slice();
4642
// Example of old code that still manually calls .into_iter()

src/rust-2024/macro-fragment-specifiers.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Macro Fragment Specifiers
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123742>.
5-
63
## Summary
74

85
- The `expr` [fragment specifier] now also supports `const` and `_` expressions.

src/rust-2024/match-ergonomics.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Match ergonomics
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/131414>.
5-
63
**This is a placeholder, docs coming soon!**
74

85
## Summary

src/rust-2024/missing-macro-fragment-specifiers.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Missing macro fragment specifiers
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/128143>.
5-
63
## Summary
74

85
- The [`missing_fragment_specifier`] lint is now a hard error.

src/rust-2024/never-type-fallback.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Never type fallback change
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
## Summary
64

75
- Never type (`!`) to any type ("never-to-any") coercions fall back to never type (`!`) rather than to unit type (`()`).
@@ -85,8 +83,7 @@ You might think that, in this example, type `T` can't be inferred. However, due
8583

8684
To fix the issue you need to specify the `T` type explicitly:
8785

88-
<!-- TODO: edition2024 -->
89-
```rust
86+
```rust,edition2024
9087
# #![deny(dependency_on_unit_never_type_fallback)]
9188
# fn outer<T>(x: T) -> Result<T, ()> {
9289
# fn f<T: Default>() -> Result<T, ()> {
@@ -115,8 +112,7 @@ run(|| panic!());
115112

116113
Previously `!` from the `panic!` coerced to `()` which implements `Unit`. However now the `!` is kept as `!` so this code fails because `!` doesn't implement `Unit`. To fix this you can specify the return type of the closure:
117114

118-
<!-- TODO: edition2024 -->
119-
```rust,should_panic
115+
```rust,edition2024,should_panic
120116
# #![deny(dependency_on_unit_never_type_fallback)]
121117
# trait Unit {}
122118
# impl Unit for () {}
@@ -142,8 +138,7 @@ Previously `()` was inferred as the return type of `Default::default()` because
142138

143139
Again, this can be fixed by specifying the type explicitly:
144140

145-
<!-- TODO: edition2024 -->
146-
```rust
141+
```rust,edition2024
147142
# #![deny(dependency_on_unit_never_type_fallback)]
148143
() = if true {
149144
Default::default()

src/rust-2024/newly-unsafe-functions.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Unsafe functions
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/124866>.
5-
63
## Summary
74

85
- The following functions are now marked [`unsafe`]:

src/rust-2024/prelude.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Additions to the prelude
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/121042>.
5-
63
## Summary
74

85
- The [`Future`] and [`IntoFuture`] traits are now part of the prelude.

src/rust-2024/reserved-syntax.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Reserved syntax
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123735>.
5-
63
## Summary
74

85
- Unprefixed guarded strings of the form `#"foo"#` are reserved for future use.

src/rust-2024/rpit-lifetime-capture.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# RPIT lifetime capture rules
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
This chapter describes changes related to the **Lifetime Capture Rules 2024** introduced in [RFC 3498], including how to use opaque type *precise capturing* (introduced in [RFC 3617]) to migrate your code.
64

75
[RFC 3498]: https://github.com/rust-lang/rfcs/pull/3498
@@ -237,8 +235,7 @@ fn f<'a, T>(x: &'a (), y: T) -> impl Sized + use<'a, T> {
237235

238236
In Rust 2024, the `use<..>` bound can often be omitted entirely, and the above can be written simply as:
239237

240-
<!-- TODO: edition2024 -->
241-
```rust
238+
```rust,edition2024
242239
# #![feature(lifetime_capture_rules_2024)]
243240
fn f<'a, T>(x: &'a (), y: T) -> impl Sized {
244241
(x, y)
@@ -284,8 +281,7 @@ fn f<T>(x: &(), y: T) -> impl Sized + use<'_, T> {
284281

285282
In Rust 2024, the `use<..>` bound can often be omitted entirely, and the above can be written simply as:
286283

287-
<!-- TODO: edition2024 -->
288-
```rust
284+
```rust,edition2024
289285
# #![feature(precise_capturing)]
290286
# #![feature(lifetime_capture_rules_2024)]
291287
fn f<T>(x: &(), y: T) -> impl Sized {

src/rust-2024/rustdoc-doctests.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Rustdoc combined tests
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/124853>.
5-
63
## Summary
74

85
- [Doctests] are now combined into a single binary which should result in a significant performance improvement.

src/rust-2024/rustdoc-nested-includes.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Rustdoc nested `include!` change
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/132230>.
5-
63
## Summary
74

85
When a doctest is included with `include_str!`, if that doctest itself also uses `include!`, `include_str!`, or `include_bytes!`, the path is resolved relative to the Markdown file, rather than to the Rust source file.

src/rust-2024/rustfmt-overflow-delimited-expr.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Rustfmt: Combine all delimited exprs as last argument
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
This feature is not yet implemented.
64
More information may be found in <https://github.com/rust-lang/rust/pull/114764>.
75

src/rust-2024/rustfmt-raw-identifier-sorting.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Rustfmt: Raw identifier sorting
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
5-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/124764>.
6-
73
## Summary
84

95
`rustfmt` now properly sorts [raw identifiers].

src/rust-2024/rustfmt-style-edition.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Rustfmt: Style edition
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
5-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123799>.
6-
73
## Summary
84

95
User can now control which style edition to use with `rustfmt`.

src/rust-2024/rustfmt-version-sorting.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Rustfmt: Version sorting
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
5-
More information may be found in the tracking issues at <https://github.com/rust-lang/rust/issues/123800> and <https://github.com/rust-lang/rust/issues/123802>.
6-
73
## Summary
84

95
`rustfmt` utilizes a new sorting algorithm.

src/rust-2024/static-mut-references.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Disallow references to static mut
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123758>.
5-
63
## Summary
74

85
- The [`static_mut_refs`] lint level is now `deny` by default.

src/rust-2024/temporary-if-let-scope.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# `if let` temporary scope
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/124085>.
5-
63
## Summary
74

85
- In an `if let $pat = $expr { .. } else { .. }` expression, the temporary values generated from evaluating `$expr` will be dropped before the program enters the `else` branch instead of after.
@@ -34,8 +31,7 @@ In this example, the temporary read lock generated by the call to `value.read()`
3431

3532
The 2024 Edition shortens the lifetime of the temporaries to the point where the then-block is completely evaluated or the program control enters the `else` block.
3633

37-
<!-- TODO: edition2024 -->
38-
```rust
34+
```rust,edition2024
3935
// Starting with 2024
4036
# use std::sync::RwLock;
4137

src/rust-2024/temporary-tail-expr-scope.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Tail expression temporary scope
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123739>.
5-
63
## Summary
74

85
- Temporary values generated in evaluation of the tail expression of a [function] or closure body, or a [block] are now dropped before local variables.

src/rust-2024/unsafe-attributes.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Unsafe attributes
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123757>.
5-
63
## Summary
74

85
- The following attributes must now be marked as `unsafe`:
@@ -49,8 +46,7 @@ fn foo() -> usize { 1 }
4946

5047
In the 2024 Edition, it is now required to mark these attributes as unsafe to emphasize that it is required to ensure that the symbol is defined correctly:
5148

52-
<!-- TODO: edition2024 -->
53-
```rust
49+
```rust,edition2024
5450
// SAFETY: There should only be a single definition of the loop symbol.
5551
#[unsafe(export_name="loop")]
5652
fn arduino_loop() {

src/rust-2024/unsafe-extern.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Unsafe `extern` blocks
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
More information may be found in the tracking issue at <https://github.com/rust-lang/rust/issues/123743>.
5-
63
## Summary
74

85
- [`extern` blocks] must now be marked with the `unsafe` keyword.

src/rust-2024/unsafe-op-in-unsafe-fn.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# unsafe_op_in_unsafe_fn warning
22

3-
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4-
53
## Summary
64

75
- The [`unsafe_op_in_unsafe_fn`] lint now warns by default.

0 commit comments

Comments
 (0)