Skip to content

Commit

Permalink
Auto merge of rust-lang#133349 - ehuss:stabilize-2024, r=traviscross,…
Browse files Browse the repository at this point in the history
…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: rust-lang#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.
  • Loading branch information
bors committed Nov 22, 2024
2 parents a475551 + 31c9222 commit f5be3ca
Show file tree
Hide file tree
Showing 116 changed files with 308 additions and 334 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_span/src/edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub const EDITION_NAME_LIST: &str = "2015|2018|2021|2024";

pub const DEFAULT_EDITION: Edition = Edition::Edition2015;

pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2021;
pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2024;

impl fmt::Display for Edition {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -62,7 +62,7 @@ impl Edition {
Edition::Edition2015 => true,
Edition::Edition2018 => true,
Edition::Edition2021 => true,
Edition::Edition2024 => false,
Edition::Edition2024 => true,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ This informs `rustc` of the name of your crate.
<a id="option-edition"></a>
## `--edition`: specify the edition to use

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

[edition guide]: ../edition-guide/introduction.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ are added.
# fn foo() {}
```

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

```rust
Expand Down
2 changes: 1 addition & 1 deletion tests/crashes/124751.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ known-bug: rust-lang/rust#124751
//@ compile-flags: -Zunstable-options --edition=2024
//@ edition: 2024

#![feature(gen_blocks)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/rustc-help/help-v.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Options:
--edition 2015|2018|2021|2024
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
stable edition is 2021.
stable edition is 2024.
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
Comma separated list of types of output for the
compiler to emit
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/rustc-help/help.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Options:
--edition 2015|2018|2021|2024
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
stable edition is 2021.
stable edition is 2024.
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
Comma separated list of types of output for the
compiler to emit
Expand Down
3 changes: 2 additions & 1 deletion tests/rustdoc-ui/2024-doctests-checks.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ check-pass
//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024
//@ edition: 2024
//@ compile-flags: --test --test-args=--test-threads=1
//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-ui/2024-doctests-checks.stdout
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

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

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


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

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

3 changes: 2 additions & 1 deletion tests/rustdoc-ui/2024-doctests-crate-attribute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ check-pass
//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024
//@ edition: 2024
//@ compile-flags: --test --test-args=--test-threads=1
//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-ui/2024-doctests-crate-attribute.stdout
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

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

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


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

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

1 change: 0 additions & 1 deletion tests/rustdoc-ui/doctest/auxiliary/extern_macros_2024.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ edition:2024
//@ compile-flags:-Z unstable-options
#![crate_name="extern_macros"]
#[macro_export]
macro_rules! attrs_on_struct {
Expand Down
3 changes: 2 additions & 1 deletion tests/rustdoc-ui/doctest/dead-code-2024.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This test ensures that the 2024 edition merged doctest will not use `#[allow(unused)]`.

//@ compile-flags:--test -Zunstable-options --edition 2024
//@ edition: 2024
//@ compile-flags:--test
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ failure-status: 101
Expand Down
10 changes: 5 additions & 5 deletions tests/rustdoc-ui/doctest/dead-code-2024.stdout
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

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

failures:

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

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

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

3 changes: 2 additions & 1 deletion tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// FIXME: if/when the output of the test harness can be tested on its own, this test should be
// adapted to use that, and that normalize line can go away

//@ compile-flags:--test -Z unstable-options --edition 2024
//@ edition: 2024
//@ compile-flags:--test
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ failure-status: 101
Expand Down
6 changes: 3 additions & 3 deletions tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

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

failures:

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

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

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

3 changes: 2 additions & 1 deletion tests/rustdoc-ui/doctest/merged-ignore-no_run.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024
//@ edition: 2024
//@ compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-ui/doctest/merged-ignore-no_run.stdout
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

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

3 changes: 2 additions & 1 deletion tests/rustdoc-ui/doctest/standalone-warning-2024.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This test checks that it will output warnings for usage of `standalone` or `standalone_crate`.

//@ compile-flags:--test -Zunstable-options --edition 2024
//@ edition: 2024
//@ compile-flags:--test
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Expand Down
36 changes: 18 additions & 18 deletions tests/rustdoc-ui/doctest/standalone-warning-2024.stderr
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
error: unknown attribute `standalone`
--> $DIR/standalone-warning-2024.rs:10:1
--> $DIR/standalone-warning-2024.rs:11:1
|
10 | / //! ```standalone
11 | | //! bla
12 | | //! ```
13 | | //!
14 | | //! ```standalone-crate
15 | | //! bla
16 | | //! ```
11 | / //! ```standalone
12 | | //! bla
13 | | //! ```
14 | | //!
15 | | //! ```standalone-crate
16 | | //! bla
17 | | //! ```
| |_______^
|
= help: use `standalone_crate` to compile this code block separately
= 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`
note: the lint level is defined here
--> $DIR/standalone-warning-2024.rs:8:9
--> $DIR/standalone-warning-2024.rs:9:9
|
8 | #![deny(warnings)]
9 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`

error: unknown attribute `standalone-crate`
--> $DIR/standalone-warning-2024.rs:10:1
--> $DIR/standalone-warning-2024.rs:11:1
|
10 | / //! ```standalone
11 | | //! bla
12 | | //! ```
13 | | //!
14 | | //! ```standalone-crate
15 | | //! bla
16 | | //! ```
11 | / //! ```standalone
12 | | //! bla
13 | | //! ```
14 | | //!
15 | | //! ```standalone-crate
16 | | //! bla
17 | | //! ```
| |_______^
|
= help: use `standalone_crate` to compile this code block separately
Expand Down
3 changes: 2 additions & 1 deletion tests/rustdoc-ui/doctest/wrong-ast-2024.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024
//@ edition: 2024
//@ compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
Expand Down
14 changes: 7 additions & 7 deletions tests/rustdoc-ui/doctest/wrong-ast-2024.stdout
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

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

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


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

failures:

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

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

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

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

4 changes: 2 additions & 2 deletions tests/ui/async-await/async-fn/edition-2015.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `async` trait bounds are only allowed in Rust 2018 or later
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
| ^^^^^
|
= help: pass `--edition 2021` to `rustc`
= help: pass `--edition 2024` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

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

error[E0658]: async closures are unstable
Expand Down
Loading

0 comments on commit f5be3ca

Please sign in to comment.