diff --git a/src/SUMMARY.md b/src/SUMMARY.md index c4e84760..84988617 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -38,7 +38,7 @@ ## Rust 2024 -- [Rust 2024 🚧](rust-2024/index.md) +- [Rust 2024](rust-2024/index.md) - [Language](rust-2024/language.md) - [RPIT lifetime capture rules](rust-2024/rpit-lifetime-capture.md) - [`if let` temporary scope](rust-2024/temporary-if-let-scope.md) diff --git a/src/editions/creating-a-new-project.md b/src/editions/creating-a-new-project.md index 838cf2d2..0f5fefa8 100644 --- a/src/editions/creating-a-new-project.md +++ b/src/editions/creating-a-new-project.md @@ -11,13 +11,13 @@ $ cat foo/Cargo.toml [package] name = "foo" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] ``` -That `edition = "2021"` setting configures your package to be built using the -Rust 2021 edition. No further configuration needed! +That `edition = "2024"` setting configures your package to be built using the +Rust 2024 edition. No further configuration needed! You can use the `--edition ` option of `cargo new` to create the project using some specific edition. For example, creating a new project to use the diff --git a/src/editions/transitioning-an-existing-project-to-a-new-edition.md b/src/editions/transitioning-an-existing-project-to-a-new-edition.md index 9e225048..5d85c962 100644 --- a/src/editions/transitioning-an-existing-project-to-a-new-edition.md +++ b/src/editions/transitioning-an-existing-project-to-a-new-edition.md @@ -5,7 +5,7 @@ It will update your source code so that it is compatible with the next edition. Briefly, the steps to update to the next edition are: 1. Run `cargo fix --edition` -2. Edit `Cargo.toml` and set the `edition` field to the next edition, for example `edition = "2021"` +2. Edit `Cargo.toml` and set the `edition` field to the next edition, for example `edition = "2024"` 3. Run `cargo build` or `cargo test` to verify the fixes worked. 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: 1. Install the most recent nightly: `rustup update nightly`. 2. Run `cargo +nightly fix --edition`. -3. Edit `Cargo.toml` and place `cargo-features = ["edition2024"]` at the top (above `[package]`), and change the edition field to say `edition = "2024"`. +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. 4. Run `cargo +nightly check` to verify it now works in the new edition. > **⚠ Caution**: Features implemented in the next edition may not have automatic migrations implemented with `cargo fix`, and the features themselves may not be finished. diff --git a/src/rust-2024/cargo-inherited-default-features.md b/src/rust-2024/cargo-inherited-default-features.md index 61a9b860..9c7c2b44 100644 --- a/src/rust-2024/cargo-inherited-default-features.md +++ b/src/rust-2024/cargo-inherited-default-features.md @@ -1,7 +1,5 @@ # Cargo: Reject unused inherited default-features -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - ## Summary - `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`). diff --git a/src/rust-2024/cargo-resolver.md b/src/rust-2024/cargo-resolver.md index f79e87d7..17b76d41 100644 --- a/src/rust-2024/cargo-resolver.md +++ b/src/rust-2024/cargo-resolver.md @@ -1,7 +1,5 @@ # Cargo: Rust-version aware resolver -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - ## Summary - `edition = "2024"` implies `resolver = "3"` in `Cargo.toml` which enables a Rust-version aware dependency resolver. diff --git a/src/rust-2024/cargo-table-key-names.md b/src/rust-2024/cargo-table-key-names.md index 1bdcabae..32b4811d 100644 --- a/src/rust-2024/cargo-table-key-names.md +++ b/src/rust-2024/cargo-table-key-names.md @@ -1,7 +1,5 @@ # Cargo: Table and key name consistency -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - ## Summary - Several table and key names in `Cargo.toml` have been removed where there were previously two ways to specify the same thing. diff --git a/src/rust-2024/gen-keyword.md b/src/rust-2024/gen-keyword.md index 8881b18b..55537dd0 100644 --- a/src/rust-2024/gen-keyword.md +++ b/src/rust-2024/gen-keyword.md @@ -1,8 +1,5 @@ # `gen` keyword -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - `gen` is a [reserved keyword]. diff --git a/src/rust-2024/index.md b/src/rust-2024/index.md index d7df49cb..e8dfbcaa 100644 --- a/src/rust-2024/index.md +++ b/src/rust-2024/index.md @@ -1,30 +1,6 @@ # Rust 2024 -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - | Info | | | --- | --- | | RFC | [#3501](https://rust-lang.github.io/rfcs/3501-edition-2024.html) | -| Release version | 1.85.0 (anticipated) | - -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: - -| Date | Version | Edition stage | -|------------|---------------|--------------------------------| -| 2024-10-11 | Branch v1.83 | Go / no go on all items | -| 2024-10-17 | Release v1.82 | Rust 2024 nightly beta | -| 2024-11-22 | Branch v1.84 | Prepare to stabilize... | -| 2024-11-28 | Release v1.83 | Stabilize Rust 2024 on master | -| 2025-01-03 | Branch v1.85 | Cut Rust 2024 to beta | -| 2025-01-09 | Release v1.84 | Announce Rust 2024 is pending! | -| 2025-02-20 | Release v1.85 | Release Rust 2024 | - -Our motivating priorities for this edition are to: - -- Make *this* edition a success. -- Do so without requiring heroics from anyone. - - ...or stressing anyone or everyone out. - -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. - -However, at the moment, **the edition is on track**. +| Release version | 1.85.0 | diff --git a/src/rust-2024/intoiterator-box-slice.md b/src/rust-2024/intoiterator-box-slice.md index 99efc3e8..ec239878 100644 --- a/src/rust-2024/intoiterator-box-slice.md +++ b/src/rust-2024/intoiterator-box-slice.md @@ -1,8 +1,5 @@ # Add `IntoIterator` for `Box<[T]>` -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - 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 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. - -```rust +```rust,edition2024 // Example of changed behavior in Edition 2024 let my_boxed_slice: Box<[u32]> = vec![1, 2, 3].into_boxed_slice(); // Example of old code that still manually calls .into_iter() diff --git a/src/rust-2024/macro-fragment-specifiers.md b/src/rust-2024/macro-fragment-specifiers.md index d97b82e1..728a2062 100644 --- a/src/rust-2024/macro-fragment-specifiers.md +++ b/src/rust-2024/macro-fragment-specifiers.md @@ -1,8 +1,5 @@ # Macro Fragment Specifiers -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - The `expr` [fragment specifier] now also supports `const` and `_` expressions. diff --git a/src/rust-2024/match-ergonomics.md b/src/rust-2024/match-ergonomics.md index 53cce054..2dc7a4e4 100644 --- a/src/rust-2024/match-ergonomics.md +++ b/src/rust-2024/match-ergonomics.md @@ -1,8 +1,5 @@ # Match ergonomics -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - **This is a placeholder, docs coming soon!** ## Summary diff --git a/src/rust-2024/missing-macro-fragment-specifiers.md b/src/rust-2024/missing-macro-fragment-specifiers.md index 2c2d12ed..16854313 100644 --- a/src/rust-2024/missing-macro-fragment-specifiers.md +++ b/src/rust-2024/missing-macro-fragment-specifiers.md @@ -1,8 +1,5 @@ # Missing macro fragment specifiers -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - The [`missing_fragment_specifier`] lint is now a hard error. diff --git a/src/rust-2024/never-type-fallback.md b/src/rust-2024/never-type-fallback.md index 768d3d80..12f48bba 100644 --- a/src/rust-2024/never-type-fallback.md +++ b/src/rust-2024/never-type-fallback.md @@ -1,7 +1,5 @@ # Never type fallback change -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - ## Summary - 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 To fix the issue you need to specify the `T` type explicitly: - -```rust +```rust,edition2024 # #![deny(dependency_on_unit_never_type_fallback)] # fn outer(x: T) -> Result { # fn f() -> Result { @@ -115,8 +112,7 @@ run(|| panic!()); 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: - -```rust,should_panic +```rust,edition2024,should_panic # #![deny(dependency_on_unit_never_type_fallback)] # trait Unit {} # impl Unit for () {} @@ -142,8 +138,7 @@ Previously `()` was inferred as the return type of `Default::default()` because Again, this can be fixed by specifying the type explicitly: - -```rust +```rust,edition2024 # #![deny(dependency_on_unit_never_type_fallback)] () = if true { Default::default() diff --git a/src/rust-2024/newly-unsafe-functions.md b/src/rust-2024/newly-unsafe-functions.md index 31569145..d2a19a9c 100644 --- a/src/rust-2024/newly-unsafe-functions.md +++ b/src/rust-2024/newly-unsafe-functions.md @@ -1,8 +1,5 @@ # Unsafe functions -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - The following functions are now marked [`unsafe`]: diff --git a/src/rust-2024/prelude.md b/src/rust-2024/prelude.md index 1cf52057..e72b0db3 100644 --- a/src/rust-2024/prelude.md +++ b/src/rust-2024/prelude.md @@ -1,8 +1,5 @@ # Additions to the prelude -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - The [`Future`] and [`IntoFuture`] traits are now part of the prelude. diff --git a/src/rust-2024/reserved-syntax.md b/src/rust-2024/reserved-syntax.md index 99e77e69..93349409 100644 --- a/src/rust-2024/reserved-syntax.md +++ b/src/rust-2024/reserved-syntax.md @@ -1,8 +1,5 @@ # Reserved syntax -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - Unprefixed guarded strings of the form `#"foo"#` are reserved for future use. diff --git a/src/rust-2024/rpit-lifetime-capture.md b/src/rust-2024/rpit-lifetime-capture.md index 8bf6dc76..b4e023a3 100644 --- a/src/rust-2024/rpit-lifetime-capture.md +++ b/src/rust-2024/rpit-lifetime-capture.md @@ -1,7 +1,5 @@ # RPIT lifetime capture rules -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - 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. [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> { In Rust 2024, the `use<..>` bound can often be omitted entirely, and the above can be written simply as: - -```rust +```rust,edition2024 # #![feature(lifetime_capture_rules_2024)] fn f<'a, T>(x: &'a (), y: T) -> impl Sized { (x, y) @@ -284,8 +281,7 @@ fn f(x: &(), y: T) -> impl Sized + use<'_, T> { In Rust 2024, the `use<..>` bound can often be omitted entirely, and the above can be written simply as: - -```rust +```rust,edition2024 # #![feature(precise_capturing)] # #![feature(lifetime_capture_rules_2024)] fn f(x: &(), y: T) -> impl Sized { diff --git a/src/rust-2024/rustdoc-doctests.md b/src/rust-2024/rustdoc-doctests.md index 313dacbd..d980549c 100644 --- a/src/rust-2024/rustdoc-doctests.md +++ b/src/rust-2024/rustdoc-doctests.md @@ -1,8 +1,5 @@ # Rustdoc combined tests -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - [Doctests] are now combined into a single binary which should result in a significant performance improvement. diff --git a/src/rust-2024/rustdoc-nested-includes.md b/src/rust-2024/rustdoc-nested-includes.md index 301e3745..22c7a5cd 100644 --- a/src/rust-2024/rustdoc-nested-includes.md +++ b/src/rust-2024/rustdoc-nested-includes.md @@ -1,8 +1,5 @@ # Rustdoc nested `include!` change -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary 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. diff --git a/src/rust-2024/rustfmt-overflow-delimited-expr.md b/src/rust-2024/rustfmt-overflow-delimited-expr.md index 72ee2903..b428c275 100644 --- a/src/rust-2024/rustfmt-overflow-delimited-expr.md +++ b/src/rust-2024/rustfmt-overflow-delimited-expr.md @@ -1,7 +1,5 @@ # Rustfmt: Combine all delimited exprs as last argument -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - This feature is not yet implemented. More information may be found in . diff --git a/src/rust-2024/rustfmt-raw-identifier-sorting.md b/src/rust-2024/rustfmt-raw-identifier-sorting.md index 5c91f67b..81f38774 100644 --- a/src/rust-2024/rustfmt-raw-identifier-sorting.md +++ b/src/rust-2024/rustfmt-raw-identifier-sorting.md @@ -1,9 +1,5 @@ # Rustfmt: Raw identifier sorting -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - -More information may be found in the tracking issue at . - ## Summary `rustfmt` now properly sorts [raw identifiers]. diff --git a/src/rust-2024/rustfmt-style-edition.md b/src/rust-2024/rustfmt-style-edition.md index d48bb796..aff1ed87 100644 --- a/src/rust-2024/rustfmt-style-edition.md +++ b/src/rust-2024/rustfmt-style-edition.md @@ -1,9 +1,5 @@ # Rustfmt: Style edition -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - -More information may be found in the tracking issue at . - ## Summary User can now control which style edition to use with `rustfmt`. diff --git a/src/rust-2024/rustfmt-version-sorting.md b/src/rust-2024/rustfmt-version-sorting.md index 499a524f..50c156ea 100644 --- a/src/rust-2024/rustfmt-version-sorting.md +++ b/src/rust-2024/rustfmt-version-sorting.md @@ -1,9 +1,5 @@ # Rustfmt: Version sorting -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - -More information may be found in the tracking issues at and . - ## Summary `rustfmt` utilizes a new sorting algorithm. diff --git a/src/rust-2024/static-mut-references.md b/src/rust-2024/static-mut-references.md index 01b61b46..0cd26559 100644 --- a/src/rust-2024/static-mut-references.md +++ b/src/rust-2024/static-mut-references.md @@ -1,8 +1,5 @@ # Disallow references to static mut -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - The [`static_mut_refs`] lint level is now `deny` by default. diff --git a/src/rust-2024/temporary-if-let-scope.md b/src/rust-2024/temporary-if-let-scope.md index 6ac6fb77..a89cdf35 100644 --- a/src/rust-2024/temporary-if-let-scope.md +++ b/src/rust-2024/temporary-if-let-scope.md @@ -1,8 +1,5 @@ # `if let` temporary scope -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - 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()` 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. - -```rust +```rust,edition2024 // Starting with 2024 # use std::sync::RwLock; diff --git a/src/rust-2024/temporary-tail-expr-scope.md b/src/rust-2024/temporary-tail-expr-scope.md index b8a04a1a..4bdece55 100644 --- a/src/rust-2024/temporary-tail-expr-scope.md +++ b/src/rust-2024/temporary-tail-expr-scope.md @@ -1,8 +1,5 @@ # Tail expression temporary scope -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - Temporary values generated in evaluation of the tail expression of a [function] or closure body, or a [block] are now dropped before local variables. diff --git a/src/rust-2024/unsafe-attributes.md b/src/rust-2024/unsafe-attributes.md index c3d2ad47..391962c4 100644 --- a/src/rust-2024/unsafe-attributes.md +++ b/src/rust-2024/unsafe-attributes.md @@ -1,8 +1,5 @@ # Unsafe attributes -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - The following attributes must now be marked as `unsafe`: @@ -49,8 +46,7 @@ fn foo() -> usize { 1 } 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: - -```rust +```rust,edition2024 // SAFETY: There should only be a single definition of the loop symbol. #[unsafe(export_name="loop")] fn arduino_loop() { diff --git a/src/rust-2024/unsafe-extern.md b/src/rust-2024/unsafe-extern.md index 47221db5..8c52b967 100644 --- a/src/rust-2024/unsafe-extern.md +++ b/src/rust-2024/unsafe-extern.md @@ -1,8 +1,5 @@ # Unsafe `extern` blocks -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". -More information may be found in the tracking issue at . - ## Summary - [`extern` blocks] must now be marked with the `unsafe` keyword. diff --git a/src/rust-2024/unsafe-op-in-unsafe-fn.md b/src/rust-2024/unsafe-op-in-unsafe-fn.md index 0093f147..0486e907 100644 --- a/src/rust-2024/unsafe-op-in-unsafe-fn.md +++ b/src/rust-2024/unsafe-op-in-unsafe-fn.md @@ -1,7 +1,5 @@ # unsafe_op_in_unsafe_fn warning -🚧 The 2024 Edition has not yet been released and hence this section is still "under construction". - ## Summary - The [`unsafe_op_in_unsafe_fn`] lint now warns by default.