Auto merge of #133349 - ehuss:stabilize-2024, r=traviscross,compiler-… · rust-lang/rust@f5be3ca (original) (raw)

File tree

116 files changed

lines changed

116 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ pub const EDITION_NAME_LIST: &str = "2015|2018 2021 2024";
33 33
34 34 pub const DEFAULT_EDITION: Edition = Edition::Edition2015;
35 35
36 -pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2021;
36 +pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2024;
37 37
38 38 impl fmt::Display for Edition {
39 39 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -62,7 +62,7 @@ impl Edition {
62 62 Edition::Edition2015 => true,
63 63 Edition::Edition2018 => true,
64 64 Edition::Edition2021 => true,
65 -Edition::Edition2024 => false,
65 +Edition::Edition2024 => true,
66 66 }
67 67 }
68 68
Original file line number Diff line number Diff line change
@@ -179,7 +179,7 @@ This informs `rustc` of the name of your crate.
179 179 <a id="option-edition"></a>
180 180 ## `--edition`: specify the edition to use
181 181
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
183 183 information about editions may be found in the [edition guide].
184 184
185 185 [edition guide]: ../edition-guide/introduction.html
Original file line number Diff line number Diff line change
@@ -360,7 +360,7 @@ are added.
360 360 # fn foo() {}
361 361 ```
362 362
363 -`edition2015`, `edition2018` and `edition2021` tell `rustdoc`
363 +`edition2015`, `edition2018`, `edition2021`, and `edition2024` tell `rustdoc`
364 364 that the code sample should be compiled using the respective edition of Rust.
365 365
366 366 ```rust
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1 1 //@ known-bug: rust-lang/rust#124751
2 -//@ compile-flags: -Zunstable-options --edition=2024
2 +//@ edition: 2024
3 3
4 4 #![feature(gen_blocks)]
5 5
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ Options:
25 25 --edition 2015|2018
26 26 Specify which edition of the compiler to use when
27 27 compiling code. The default is 2015 and the latest
28 - stable edition is 2021.
28 + stable edition is 2024.
29 29 --emit [asm|llvm-bc
30 30 Comma separated list of types of output for the
31 31 compiler to emit
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ Options:
25 25 --edition 2015|2018
26 26 Specify which edition of the compiler to use when
27 27 compiling code. The default is 2015 and the latest
28 - stable edition is 2021.
28 + stable edition is 2024.
29 29 --emit [asm|llvm-bc
30 30 Comma separated list of types of output for the
31 31 compiler to emit
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1 1 //@ 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
3 4 //@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
4 5 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in TIME"
5 6 //@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
1 1
2 2 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
4 4
5 5 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6 6
7 7
8 8 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
10 10
11 11 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
12 12
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1 1 //@ 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
3 4 //@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
4 5 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in TIME"
5 6 //@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
1 1
2 2 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
4 4
5 5 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6 6
7 7
8 8 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
10 10
11 11 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
12 12
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
1 1 //@ edition:2024
2 -//@ compile-flags:-Z unstable-options
3 2 #![crate_name="extern_macros"]
4 3 #[macro_export]
5 4 macro_rules! attrs_on_struct {
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1 1 // This test ensures that the 2024 edition merged doctest will not use `#[allow(unused)]`.
2 2
3 -//@ compile-flags:--test -Zunstable-options --edition 2024
3 +//@ edition: 2024
4 +//@ compile-flags:--test
4 5 //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
5 6 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in TIME"
6 7 //@ failure-status: 101
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
1 1
2 2 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
4 4
5 5 failures:
6 6
7 ----- $DIR/dead-code-2024.rs - f (line 12) stdout ----
7 +---- $DIR/dead-code-2024.rs - f (line 13) stdout ----
8 8 error: trait `T` is never used
9 - --> $DIR/dead-code-2024.rs:13:7
9 + --> $DIR/dead-code-2024.rs:14:7
10 10 |
11 11 LL | trait T { fn f(); }
12 12 | ^
13 13 |
14 14 note: the lint level is defined here
15 - --> $DIR/dead-code-2024.rs:11:9
15 + --> $DIR/dead-code-2024.rs:12:9
16 16 |
17 17 LL | #![deny(warnings)]
18 18 | ^^^^^^^^
@@ -23,7 +23,7 @@ error: aborting due to 1 previous error
23 23 Couldn't compile the test.
24 24
25 25 failures:
26 - $DIR/dead-code-2024.rs - f (line 12)
26 + $DIR/dead-code-2024.rs - f (line 13)
27 27
28 28 test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
29 29
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
1 1 // FIXME: if/when the output of the test harness can be tested on its own, this test should be
2 2 // adapted to use that, and that normalize line can go away
3 3
4 -//@ compile-flags:--test -Z unstable-options --edition 2024
4 +//@ edition: 2024
5 +//@ compile-flags:--test
5 6 //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
6 7 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in TIME"
7 8 //@ failure-status: 101
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
1 1
2 2 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
4 4
5 5 failures:
6 6
7 ----- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ----
7 +---- $DIR/failed-doctest-should-panic.rs - Foo (line 10) stdout ----
8 8 note: test did not panic as expected
9 9
10 10 failures:
11 - $DIR/failed-doctest-should-panic.rs - Foo (line 9)
11 + $DIR/failed-doctest-should-panic.rs - Foo (line 10)
12 12
13 13 test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
14 14
Original file line number Diff line number Diff 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
2 3 //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
3 4 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in TIME"
4 5 //@ check-pass
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
1 1
2 2 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
5 5
6 6 test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
7 7
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1 1 // This test checks that it will output warnings for usage of `standalone` or `standalone_crate`.
2 2
3 -//@ compile-flags:--test -Zunstable-options --edition 2024
3 +//@ edition: 2024
4 +//@ compile-flags:--test
4 5 //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
5 6 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in TIME"
6 7 //@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
1 1 error: unknown attribute `standalone`
2 - --> $DIR/standalone-warning-2024.rs:10:1
2 + --> $DIR/standalone-warning-2024.rs:11:1
3 3 |
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 | //! ```
11 11 | _______^
12 12 |
13 13 = help: use `standalone_crate` to compile this code block separately
14 14 = 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`
15 15 note: the lint level is defined here
16 - --> $DIR/standalone-warning-2024.rs:8:9
16 + --> $DIR/standalone-warning-2024.rs:9:9
17 17 |
18 -8 | #![deny(warnings)]
18 +9 | #![deny(warnings)]
19 19 | ^^^^^^^^
20 20 = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
21 21
22 22 error: unknown attribute `standalone-crate`
23 - --> $DIR/standalone-warning-2024.rs:10:1
23 + --> $DIR/standalone-warning-2024.rs:11:1
24 24 |
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 | //! ```
32 32 | _______^
33 33 |
34 34 = help: use `standalone_crate` to compile this code block separately
Original file line number Diff line number Diff 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
2 3 //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
3 4 //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in TIME"
4 5 //@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
1 1
2 2 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
4 4
5 5 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6 6
7 7
8 8 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
11 11
12 12 failures:
13 13
14 ----- $DIR/wrong-ast-2024.rs - one (line 7) stdout ----
14 +---- $DIR/wrong-ast-2024.rs - one (line 8) stdout ----
15 15 error[E0758]: unterminated block comment
16 16 --> DIR/wrong−ast−2024.rs:DIR/wrong-ast-2024.rs:DIR/wrongast2024.rs:LINE:$COL
17 17 |
@@ -22,7 +22,7 @@ error: aborting due to 1 previous error
22 22
23 23 For more information about this error, try `rustc --explain E0758`.
24 24 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 ----
26 26 error: unexpected closing delimiter: `}`
27 27 --> DIR/wrong−ast−2024.rs:DIR/wrong-ast-2024.rs:DIR/wrongast2024.rs:LINE:$COL
28 28 |
@@ -34,8 +34,8 @@ error: aborting due to 1 previous error
34 34 Couldn't compile the test.
35 35
36 36 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)
39 39
40 40 test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
41 41
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ error: `async` trait bounds are only allowed in Rust 2018 or later
4 4 LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
5 5 | ^^^^^
6 6 |
7 - = help: pass `--edition 2021` to `rustc`
7 + = help: pass `--edition 2024` to `rustc`
8 8 = note: for more on editions, read https://doc.rust-lang.org/edition-guide
9 9
10 10 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
13 13 LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
14 14 | ^^^^^
15 15 |
16 - = help: pass `--edition 2021` to `rustc`
16 + = help: pass `--edition 2024` to `rustc`
17 17 = note: for more on editions, read https://doc.rust-lang.org/edition-guide
18 18
19 19 error[E0658]: async closures are unstable