Skip to content

Commit f5be3ca

Browse files
committed
Auto merge of #133349 - ehuss:stabilize-2024, r=traviscross,compiler-errors
Stabilize the 2024 edition This stabilizes the 2024 edition for Rust 1.85, scheduled to be released on February 20, 2025. 🎉 cc tracking issue: #117258 There is a fair amount of follow-up work after this that I am working on (various docs, cargo, rustfmt, etc.), and this is will unblock those other changes.
2 parents a475551 + 31c9222 commit f5be3ca

File tree

116 files changed

+308
-334
lines changed

Some content is hidden

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

116 files changed

+308
-334
lines changed

compiler/rustc_span/src/edition.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub const EDITION_NAME_LIST: &str = "2015|2018|2021|2024";
3333

3434
pub const DEFAULT_EDITION: Edition = Edition::Edition2015;
3535

36-
pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2021;
36+
pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2024;
3737

3838
impl fmt::Display for Edition {
3939
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -62,7 +62,7 @@ impl Edition {
6262
Edition::Edition2015 => true,
6363
Edition::Edition2018 => true,
6464
Edition::Edition2021 => true,
65-
Edition::Edition2024 => false,
65+
Edition::Edition2024 => true,
6666
}
6767
}
6868

src/doc/rustc/src/command-line-arguments.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ This informs `rustc` of the name of your crate.
179179
<a id="option-edition"></a>
180180
## `--edition`: specify the edition to use
181181

182-
This flag takes a value of `2015`, `2018` or `2021`. The default is `2015`. More
182+
This flag takes a value of `2015`, `2018`,`2021`, or `2024`. The default is `2015`. More
183183
information about editions may be found in the [edition guide].
184184

185185
[edition guide]: ../edition-guide/introduction.html

src/doc/rustdoc/src/write-documentation/documentation-tests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ are added.
360360
# fn foo() {}
361361
```
362362

363-
`edition2015`, `edition2018` and `edition2021` tell `rustdoc`
363+
`edition2015`, `edition2018`, `edition2021`, and `edition2024` tell `rustdoc`
364364
that the code sample should be compiled using the respective edition of Rust.
365365

366366
```rust

tests/crashes/124751.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ known-bug: rust-lang/rust#124751
2-
//@ compile-flags: -Zunstable-options --edition=2024
2+
//@ edition: 2024
33

44
#![feature(gen_blocks)]
55

tests/run-make/rustc-help/help-v.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Options:
2525
--edition 2015|2018|2021|2024
2626
Specify which edition of the compiler to use when
2727
compiling code. The default is 2015 and the latest
28-
stable edition is 2021.
28+
stable edition is 2024.
2929
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
3030
Comma separated list of types of output for the
3131
compiler to emit

tests/run-make/rustc-help/help.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Options:
2525
--edition 2015|2018|2021|2024
2626
Specify which edition of the compiler to use when
2727
compiling code. The default is 2015 and the latest
28-
stable edition is 2021.
28+
stable edition is 2024.
2929
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
3030
Comma separated list of types of output for the
3131
compiler to emit

tests/rustdoc-ui/2024-doctests-checks.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ check-pass
2-
//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024
2+
//@ edition: 2024
3+
//@ compile-flags: --test --test-args=--test-threads=1
34
//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
45
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
56
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
running 1 test
3-
test $DIR/2024-doctests-checks.rs - Foo (line 7) ... ok
3+
test $DIR/2024-doctests-checks.rs - Foo (line 8) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

77

88
running 1 test
9-
test $DIR/2024-doctests-checks.rs - Foo (line 14) ... ok
9+
test $DIR/2024-doctests-checks.rs - Foo (line 15) ... ok
1010

1111
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
1212

tests/rustdoc-ui/2024-doctests-crate-attribute.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ check-pass
2-
//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024
2+
//@ edition: 2024
3+
//@ compile-flags: --test --test-args=--test-threads=1
34
//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
45
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
56
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
running 1 test
3-
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 19) ... ok
3+
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 20) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

77

88
running 1 test
9-
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 10) ... ok
9+
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 11) ... ok
1010

1111
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
1212

tests/rustdoc-ui/doctest/auxiliary/extern_macros_2024.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ edition:2024
2-
//@ compile-flags:-Z unstable-options
32
#![crate_name="extern_macros"]
43
#[macro_export]
54
macro_rules! attrs_on_struct {

tests/rustdoc-ui/doctest/dead-code-2024.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// This test ensures that the 2024 edition merged doctest will not use `#[allow(unused)]`.
22

3-
//@ compile-flags:--test -Zunstable-options --edition 2024
3+
//@ edition: 2024
4+
//@ compile-flags:--test
45
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
56
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
67
//@ failure-status: 101
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

22
running 1 test
3-
test $DIR/dead-code-2024.rs - f (line 12) - compile ... FAILED
3+
test $DIR/dead-code-2024.rs - f (line 13) - compile ... FAILED
44

55
failures:
66

7-
---- $DIR/dead-code-2024.rs - f (line 12) stdout ----
7+
---- $DIR/dead-code-2024.rs - f (line 13) stdout ----
88
error: trait `T` is never used
9-
--> $DIR/dead-code-2024.rs:13:7
9+
--> $DIR/dead-code-2024.rs:14:7
1010
|
1111
LL | trait T { fn f(); }
1212
| ^
1313
|
1414
note: the lint level is defined here
15-
--> $DIR/dead-code-2024.rs:11:9
15+
--> $DIR/dead-code-2024.rs:12:9
1616
|
1717
LL | #![deny(warnings)]
1818
| ^^^^^^^^
@@ -23,7 +23,7 @@ error: aborting due to 1 previous error
2323
Couldn't compile the test.
2424

2525
failures:
26-
$DIR/dead-code-2024.rs - f (line 12)
26+
$DIR/dead-code-2024.rs - f (line 13)
2727

2828
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
2929

tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// FIXME: if/when the output of the test harness can be tested on its own, this test should be
22
// adapted to use that, and that normalize line can go away
33

4-
//@ compile-flags:--test -Z unstable-options --edition 2024
4+
//@ edition: 2024
5+
//@ compile-flags:--test
56
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
67
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
78
//@ failure-status: 101
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
running 1 test
3-
test $DIR/failed-doctest-should-panic.rs - Foo (line 9) - should panic ... FAILED
3+
test $DIR/failed-doctest-should-panic.rs - Foo (line 10) - should panic ... FAILED
44

55
failures:
66

7-
---- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ----
7+
---- $DIR/failed-doctest-should-panic.rs - Foo (line 10) stdout ----
88
note: test did not panic as expected
99

1010
failures:
11-
$DIR/failed-doctest-should-panic.rs - Foo (line 9)
11+
$DIR/failed-doctest-should-panic.rs - Foo (line 10)
1212

1313
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
1414

tests/rustdoc-ui/doctest/merged-ignore-no_run.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024
1+
//@ edition: 2024
2+
//@ compile-flags:--test --test-args=--test-threads=1
23
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
34
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
45
//@ check-pass
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 2 tests
3-
test $DIR/merged-ignore-no_run.rs - ignored (line 6) ... ignored
4-
test $DIR/merged-ignore-no_run.rs - no_run (line 11) - compile ... ok
3+
test $DIR/merged-ignore-no_run.rs - ignored (line 7) ... ignored
4+
test $DIR/merged-ignore-no_run.rs - no_run (line 12) - compile ... ok
55

66
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
77

tests/rustdoc-ui/doctest/standalone-warning-2024.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// This test checks that it will output warnings for usage of `standalone` or `standalone_crate`.
22

3-
//@ compile-flags:--test -Zunstable-options --edition 2024
3+
//@ edition: 2024
4+
//@ compile-flags:--test
45
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
56
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
67
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"

tests/rustdoc-ui/doctest/standalone-warning-2024.stderr

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
error: unknown attribute `standalone`
2-
--> $DIR/standalone-warning-2024.rs:10:1
2+
--> $DIR/standalone-warning-2024.rs:11:1
33
|
4-
10 | / //! ```standalone
5-
11 | | //! bla
6-
12 | | //! ```
7-
13 | | //!
8-
14 | | //! ```standalone-crate
9-
15 | | //! bla
10-
16 | | //! ```
4+
11 | / //! ```standalone
5+
12 | | //! bla
6+
13 | | //! ```
7+
14 | | //!
8+
15 | | //! ```standalone-crate
9+
16 | | //! bla
10+
17 | | //! ```
1111
| |_______^
1212
|
1313
= help: use `standalone_crate` to compile this code block separately
1414
= help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
1515
note: the lint level is defined here
16-
--> $DIR/standalone-warning-2024.rs:8:9
16+
--> $DIR/standalone-warning-2024.rs:9:9
1717
|
18-
8 | #![deny(warnings)]
18+
9 | #![deny(warnings)]
1919
| ^^^^^^^^
2020
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
2121

2222
error: unknown attribute `standalone-crate`
23-
--> $DIR/standalone-warning-2024.rs:10:1
23+
--> $DIR/standalone-warning-2024.rs:11:1
2424
|
25-
10 | / //! ```standalone
26-
11 | | //! bla
27-
12 | | //! ```
28-
13 | | //!
29-
14 | | //! ```standalone-crate
30-
15 | | //! bla
31-
16 | | //! ```
25+
11 | / //! ```standalone
26+
12 | | //! bla
27+
13 | | //! ```
28+
14 | | //!
29+
15 | | //! ```standalone-crate
30+
16 | | //! bla
31+
17 | | //! ```
3232
| |_______^
3333
|
3434
= help: use `standalone_crate` to compile this code block separately

tests/rustdoc-ui/doctest/wrong-ast-2024.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024
1+
//@ edition: 2024
2+
//@ compile-flags:--test --test-args=--test-threads=1
23
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
34
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
45
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

22
running 1 test
3-
test $DIR/wrong-ast-2024.rs - three (line 17) - should panic ... ok
3+
test $DIR/wrong-ast-2024.rs - three (line 18) - should panic ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

77

88
running 2 tests
9-
test $DIR/wrong-ast-2024.rs - one (line 7) ... FAILED
10-
test $DIR/wrong-ast-2024.rs - two (line 12) ... FAILED
9+
test $DIR/wrong-ast-2024.rs - one (line 8) ... FAILED
10+
test $DIR/wrong-ast-2024.rs - two (line 13) ... FAILED
1111

1212
failures:
1313

14-
---- $DIR/wrong-ast-2024.rs - one (line 7) stdout ----
14+
---- $DIR/wrong-ast-2024.rs - one (line 8) stdout ----
1515
error[E0758]: unterminated block comment
1616
--> $DIR/wrong-ast-2024.rs:$LINE:$COL
1717
|
@@ -22,7 +22,7 @@ error: aborting due to 1 previous error
2222

2323
For more information about this error, try `rustc --explain E0758`.
2424
Couldn't compile the test.
25-
---- $DIR/wrong-ast-2024.rs - two (line 12) stdout ----
25+
---- $DIR/wrong-ast-2024.rs - two (line 13) stdout ----
2626
error: unexpected closing delimiter: `}`
2727
--> $DIR/wrong-ast-2024.rs:$LINE:$COL
2828
|
@@ -34,8 +34,8 @@ error: aborting due to 1 previous error
3434
Couldn't compile the test.
3535

3636
failures:
37-
$DIR/wrong-ast-2024.rs - one (line 7)
38-
$DIR/wrong-ast-2024.rs - two (line 12)
37+
$DIR/wrong-ast-2024.rs - one (line 8)
38+
$DIR/wrong-ast-2024.rs - two (line 13)
3939

4040
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
4141

tests/ui/async-await/async-fn/edition-2015.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: `async` trait bounds are only allowed in Rust 2018 or later
44
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
55
| ^^^^^
66
|
7-
= help: pass `--edition 2021` to `rustc`
7+
= help: pass `--edition 2024` to `rustc`
88
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
99

1010
error: `async` trait bounds are only allowed in Rust 2018 or later
@@ -13,7 +13,7 @@ error: `async` trait bounds are only allowed in Rust 2018 or later
1313
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
1414
| ^^^^^
1515
|
16-
= help: pass `--edition 2021` to `rustc`
16+
= help: pass `--edition 2024` to `rustc`
1717
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1818

1919
error[E0658]: async closures are unstable

0 commit comments

Comments
 (0)