From 0e071c2c6a585305c53b9d46cab81286a98eb94a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 11 Feb 2025 14:25:26 -0800 Subject: [PATCH] Migrate core to Rust 2024 --- library/core/Cargo.toml | 2 +- library/core/src/lib.rs | 2 +- .../mir-opt/gvn_clone.{impl#0}-clone.GVN.diff | 12 +++---- ...implify-after-simplifycfg.panic-abort.diff | 6 ++-- ...mplify-after-simplifycfg.panic-unwind.diff | 6 ++-- tests/run-make/core-no-fp-fmt-parse/rmake.rs | 2 +- tests/ui/macros/std-2024-macros.rs | 3 -- tests/ui/macros/std-2024-macros.stderr | 33 ++----------------- 8 files changed, 18 insertions(+), 48 deletions(-) diff --git a/library/core/Cargo.toml b/library/core/Cargo.toml index edde8153aa1..b60826ee4e6 100644 --- a/library/core/Cargo.toml +++ b/library/core/Cargo.toml @@ -9,7 +9,7 @@ autobenches = false # If you update this, be sure to update it in a bunch of other places too! # As of 2024, it was src/tools/opt-dist, the core-no-fp-fmt-parse test and # the version of the prelude imported in core/lib.rs. -edition = "2021" +edition = "2024" [lib] test = false diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 987fa93d598..6e058069756 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -226,7 +226,7 @@ extern crate self as core; #[prelude_import] #[allow(unused)] -use prelude::rust_2021::*; +use prelude::rust_2024::*; #[cfg(not(test))] // See #65860 #[macro_use] diff --git a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff index 8d5991872e1..2a672e82970 100644 --- a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff +++ b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff @@ -55,16 +55,16 @@ bb3: { StorageDead(_9); - _0 = AllCopy { a: move _2, b: move _5, c: move _8 }; -+ _0 = copy (*_1); - StorageDead(_8); - StorageDead(_5); - StorageDead(_2); - StorageDead(_10); ++ _0 = copy (*_1); ++ nop; + StorageDead(_8); - StorageDead(_7); ++ nop; + StorageDead(_5); - StorageDead(_4); + nop; -+ nop; -+ nop; + StorageDead(_2); return; } } diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff index d0b50c597c4..5f9a8fe9547 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff @@ -53,12 +53,12 @@ bb3: { StorageDead(_9); _0 = MyThing:: { v: move _2, i: move _5, a: move _8 }; - StorageDead(_8); - StorageDead(_5); - StorageDead(_2); StorageDead(_10); + StorageDead(_8); StorageDead(_7); + StorageDead(_5); StorageDead(_4); + StorageDead(_2); return; } } diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff index b8f4f348530..0a02c2d4c0f 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -53,12 +53,12 @@ bb3: { StorageDead(_9); _0 = MyThing:: { v: move _2, i: move _5, a: move _8 }; - StorageDead(_8); - StorageDead(_5); - StorageDead(_2); StorageDead(_10); + StorageDead(_8); StorageDead(_7); + StorageDead(_5); StorageDead(_4); + StorageDead(_2); return; } diff --git a/tests/run-make/core-no-fp-fmt-parse/rmake.rs b/tests/run-make/core-no-fp-fmt-parse/rmake.rs index 3586922f28e..a790ada40db 100644 --- a/tests/run-make/core-no-fp-fmt-parse/rmake.rs +++ b/tests/run-make/core-no-fp-fmt-parse/rmake.rs @@ -5,7 +5,7 @@ use run_make_support::{rustc, source_root}; fn main() { rustc() - .edition("2021") + .edition("2024") .arg("-Dwarnings") .crate_type("rlib") .input(source_root().join("library/core/src/lib.rs")) diff --git a/tests/ui/macros/std-2024-macros.rs b/tests/ui/macros/std-2024-macros.rs index 7a722a2c7c3..d39b6a9811a 100644 --- a/tests/ui/macros/std-2024-macros.rs +++ b/tests/ui/macros/std-2024-macros.rs @@ -3,11 +3,8 @@ fn main() { assert_eq!(0, const { 0 }); - //~^ ERROR: no rules expected keyword `const` assert_eq!(const { 0 }, const { 0 }); - //~^ ERROR: no rules expected keyword `const` assert_eq!(const { 0 }, 0); - //~^ ERROR: no rules expected keyword `const` let _: Vec> = vec![const { vec![] }]; //~^ ERROR: no rules expected keyword `const` diff --git a/tests/ui/macros/std-2024-macros.stderr b/tests/ui/macros/std-2024-macros.stderr index 8ed38f7acc9..5395b6eac76 100644 --- a/tests/ui/macros/std-2024-macros.stderr +++ b/tests/ui/macros/std-2024-macros.stderr @@ -1,32 +1,5 @@ error: no rules expected keyword `const` - --> $DIR/std-2024-macros.rs:5:19 - | -LL | assert_eq!(0, const { 0 }); - | ^^^^^ no rules expected this token in macro call - | -note: while trying to match meta-variable `$right:expr` - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - -error: no rules expected keyword `const` - --> $DIR/std-2024-macros.rs:7:16 - | -LL | assert_eq!(const { 0 }, const { 0 }); - | ^^^^^ no rules expected this token in macro call - | -note: while trying to match meta-variable `$left:expr` - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - -error: no rules expected keyword `const` - --> $DIR/std-2024-macros.rs:9:16 - | -LL | assert_eq!(const { 0 }, 0); - | ^^^^^ no rules expected this token in macro call - | -note: while trying to match meta-variable `$left:expr` - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - -error: no rules expected keyword `const` - --> $DIR/std-2024-macros.rs:12:36 + --> $DIR/std-2024-macros.rs:9:36 | LL | let _: Vec> = vec![const { vec![] }]; | ^^^^^ no rules expected this token in macro call @@ -34,12 +7,12 @@ LL | let _: Vec> = vec![const { vec![] }]; = note: while trying to match end of macro error: no rules expected keyword `const` - --> $DIR/std-2024-macros.rs:14:36 + --> $DIR/std-2024-macros.rs:11:36 | LL | let _: Vec> = vec![const { vec![] }; 10]; | ^^^^^ no rules expected this token in macro call | = note: while trying to match end of macro -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors