From 590b277d2591725b5f945097dd8551ad3803ae66 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Tue, 11 Feb 2025 14:24:37 -0800
Subject: [PATCH 01/13] Add a test for new 2024 standard library behavior

When migrating the standard library to 2024, there will be some behavior
changes that users will be able to observe. This test should cover that
(I cannot think of any other observable differences).
---
 tests/ui/macros/std-2024-macros.rs     | 16 +++++++++
 tests/ui/macros/std-2024-macros.stderr | 45 ++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 tests/ui/macros/std-2024-macros.rs
 create mode 100644 tests/ui/macros/std-2024-macros.stderr

diff --git a/tests/ui/macros/std-2024-macros.rs b/tests/ui/macros/std-2024-macros.rs
new file mode 100644
index 0000000000000..7a722a2c7c34d
--- /dev/null
+++ b/tests/ui/macros/std-2024-macros.rs
@@ -0,0 +1,16 @@
+// Tests a small handful of macros in the standard library how they handle the
+// new behavior introduced in 2024 that allows `const{}` expressions.
+
+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<String>> = vec![const { vec![] }];
+    //~^ ERROR: no rules expected keyword `const`
+    let _: Vec<Vec<String>> = vec![const { vec![] }; 10];
+    //~^ ERROR: no rules expected keyword `const`
+}
diff --git a/tests/ui/macros/std-2024-macros.stderr b/tests/ui/macros/std-2024-macros.stderr
new file mode 100644
index 0000000000000..8ed38f7acc921
--- /dev/null
+++ b/tests/ui/macros/std-2024-macros.stderr
@@ -0,0 +1,45 @@
+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
+   |
+LL |     let _: Vec<Vec<String>> = vec![const { vec![] }];
+   |                                    ^^^^^ no rules expected this token in macro call
+   |
+   = note: while trying to match end of macro
+
+error: no rules expected keyword `const`
+  --> $DIR/std-2024-macros.rs:14:36
+   |
+LL |     let _: Vec<Vec<String>> = 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
+

From 0e071c2c6a585305c53b9d46cab81286a98eb94a Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Tue, 11 Feb 2025 14:25:26 -0800
Subject: [PATCH 02/13] 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 | 10 +++---
 ...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, 17 insertions(+), 47 deletions(-)

diff --git a/library/core/Cargo.toml b/library/core/Cargo.toml
index edde8153aa1d2..b60826ee4e6c7 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 987fa93d59877..6e058069756f0 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 8d5991872e180..2a672e829707f 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 };
+-         StorageDead(_10);
 +         _0 = copy (*_1);
++         nop;
           StorageDead(_8);
-          StorageDead(_5);
-          StorageDead(_2);
--         StorageDead(_10);
 -         StorageDead(_7);
--         StorageDead(_4);
-+         nop;
 +         nop;
+          StorageDead(_5);
+-         StorageDead(_4);
 +         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 d0b50c597c4f7..5f9a8fe9547dd 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::<T> { 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 b8f4f348530a3..0a02c2d4c0f1b 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::<T> { 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 3586922f28ecb..a790ada40db85 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 7a722a2c7c34d..d39b6a9811a51 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<String>> = 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 8ed38f7acc921..5395b6eac763d 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<String>> = vec![const { vec![] }];
    |                                    ^^^^^ no rules expected this token in macro call
@@ -34,12 +7,12 @@ LL |     let _: Vec<Vec<String>> = 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<String>> = 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
 

From f505d4e8e380305e9c028c50e5e3a143d4635161 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Tue, 11 Feb 2025 15:20:06 -0800
Subject: [PATCH 03/13] Migrate alloc to Rust 2024

---
 library/alloc/Cargo.toml               |  2 +-
 tests/ui/macros/std-2024-macros.rs     |  4 ++--
 tests/ui/macros/std-2024-macros.stderr | 18 ------------------
 3 files changed, 3 insertions(+), 21 deletions(-)
 delete mode 100644 tests/ui/macros/std-2024-macros.stderr

diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
index dbdf292433bea..8d0253bd29aa2 100644
--- a/library/alloc/Cargo.toml
+++ b/library/alloc/Cargo.toml
@@ -8,7 +8,7 @@ repository = "https://github.com/rust-lang/rust.git"
 description = "The Rust core allocation and collections library"
 autotests = false
 autobenches = false
-edition = "2021"
+edition = "2024"
 
 [lib]
 test = false
diff --git a/tests/ui/macros/std-2024-macros.rs b/tests/ui/macros/std-2024-macros.rs
index d39b6a9811a51..453c7ee16e5a6 100644
--- a/tests/ui/macros/std-2024-macros.rs
+++ b/tests/ui/macros/std-2024-macros.rs
@@ -1,13 +1,13 @@
 // Tests a small handful of macros in the standard library how they handle the
 // new behavior introduced in 2024 that allows `const{}` expressions.
 
+//@ check-pass
+
 fn main() {
     assert_eq!(0, const { 0 });
     assert_eq!(const { 0 }, const { 0 });
     assert_eq!(const { 0 }, 0);
 
     let _: Vec<Vec<String>> = vec![const { vec![] }];
-    //~^ ERROR: no rules expected keyword `const`
     let _: Vec<Vec<String>> = vec![const { vec![] }; 10];
-    //~^ ERROR: no rules expected keyword `const`
 }
diff --git a/tests/ui/macros/std-2024-macros.stderr b/tests/ui/macros/std-2024-macros.stderr
deleted file mode 100644
index 5395b6eac763d..0000000000000
--- a/tests/ui/macros/std-2024-macros.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: no rules expected keyword `const`
-  --> $DIR/std-2024-macros.rs:9:36
-   |
-LL |     let _: Vec<Vec<String>> = vec![const { vec![] }];
-   |                                    ^^^^^ no rules expected this token in macro call
-   |
-   = note: while trying to match end of macro
-
-error: no rules expected keyword `const`
-  --> $DIR/std-2024-macros.rs:11:36
-   |
-LL |     let _: Vec<Vec<String>> = vec![const { vec![] }; 10];
-   |                                    ^^^^^ no rules expected this token in macro call
-   |
-   = note: while trying to match end of macro
-
-error: aborting due to 2 previous errors
-

From b9454af36def6d5f4b690cffabf8cd7a6f2f45d6 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Tue, 11 Feb 2025 15:41:40 -0800
Subject: [PATCH 04/13] Migrate panic_abort to Rust 2024

---
 library/panic_abort/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/panic_abort/Cargo.toml b/library/panic_abort/Cargo.toml
index a9d1f53761cbf..6f43ac4809a32 100644
--- a/library/panic_abort/Cargo.toml
+++ b/library/panic_abort/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.0.0"
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/rust.git"
 description = "Implementation of Rust panics via process aborts"
-edition = "2021"
+edition = "2024"
 
 [lib]
 test = false

From 985f66bc22885073b6375d47e1c095ab3510b79a Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Tue, 11 Feb 2025 18:56:09 -0800
Subject: [PATCH 05/13] Migrate panic_unwind to Rust 2024

---
 library/panic_unwind/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/panic_unwind/Cargo.toml b/library/panic_unwind/Cargo.toml
index c2abb79192e9f..d176434e06ba1 100644
--- a/library/panic_unwind/Cargo.toml
+++ b/library/panic_unwind/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.0.0"
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/rust.git"
 description = "Implementation of Rust panics via stack unwinding"
-edition = "2021"
+edition = "2024"
 
 [lib]
 test = false

From 540ef90832539fbad89f2958c66c0af1d66d49b6 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Tue, 11 Feb 2025 19:23:46 -0800
Subject: [PATCH 06/13] Migrate unwind to Rust 2024

---
 library/unwind/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml
index 66e8d1a3ffe5f..da60924c2b419 100644
--- a/library/unwind/Cargo.toml
+++ b/library/unwind/Cargo.toml
@@ -3,7 +3,7 @@ name = "unwind"
 version = "0.0.0"
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/rust.git"
-edition = "2021"
+edition = "2024"
 include = [
   '/libunwind/*',
 ]

From 993359e70112fab8daad4c85ff5b069f9fbdd197 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Wed, 12 Feb 2025 14:18:17 -0800
Subject: [PATCH 07/13] Migrate std to Rust 2024

---
 library/std/Cargo.toml                | 2 +-
 library/std/src/keyword_docs.rs       | 2 +-
 library/std/src/os/windows/process.rs | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
index 0ec167c2d1618..19fe0cdd7aeb3 100644
--- a/library/std/Cargo.toml
+++ b/library/std/Cargo.toml
@@ -6,7 +6,7 @@ version = "0.0.0"
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/rust.git"
 description = "The Rust Standard Library"
-edition = "2021"
+edition = "2024"
 autobenches = false
 
 [lib]
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index 5ac3dbc3e9852..c07c391892d80 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -1064,7 +1064,7 @@ mod move_keyword {}
 /// ```rust,compile_fail,E0502
 /// let mut v = vec![0, 1];
 /// let mut_ref_v = &mut v;
-/// ##[allow(unused)]
+/// # #[allow(unused)]
 /// let ref_v = &v;
 /// mut_ref_v.push(2);
 /// ```
diff --git a/library/std/src/os/windows/process.rs b/library/std/src/os/windows/process.rs
index fa65a7c51bfa0..a084f452e55d0 100644
--- a/library/std/src/os/windows/process.rs
+++ b/library/std/src/os/windows/process.rs
@@ -531,7 +531,7 @@ impl<'a> ProcThreadAttributeListBuilder<'a> {
     ///     pub Y: i16,
     /// }
     ///
-    /// extern "system" {
+    /// unsafe extern "system" {
     ///     fn CreatePipe(
     ///         hreadpipe: *mut HANDLE,
     ///         hwritepipe: *mut HANDLE,

From f1a95138d92aaa54716e4ecd4470f76d47dc33ac Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Wed, 12 Feb 2025 14:47:53 -0800
Subject: [PATCH 08/13] Migrate test to Rust 2024

---
 library/test/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/test/Cargo.toml b/library/test/Cargo.toml
index 241ef324b0088..2a32a7dd76eed 100644
--- a/library/test/Cargo.toml
+++ b/library/test/Cargo.toml
@@ -3,7 +3,7 @@ cargo-features = ["public-dependency"]
 [package]
 name = "test"
 version = "0.0.0"
-edition = "2021"
+edition = "2024"
 
 [dependencies]
 getopts = { version = "0.2.21", features = ['rustc-dep-of-std'] }

From 0b2489c226c3b4a828d090060edce46f70e42bb9 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Wed, 12 Feb 2025 14:49:21 -0800
Subject: [PATCH 09/13] Migrate proc_macro to Rust 2024

---
 library/proc_macro/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/proc_macro/Cargo.toml b/library/proc_macro/Cargo.toml
index e54a50aa15c61..72cb4e4166f8e 100644
--- a/library/proc_macro/Cargo.toml
+++ b/library/proc_macro/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "proc_macro"
 version = "0.0.0"
-edition = "2021"
+edition = "2024"
 
 [dependencies]
 std = { path = "../std" }

From 80311c4d86b2af3d34a8378aa651439901d4e00e Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Wed, 12 Feb 2025 14:55:04 -0800
Subject: [PATCH 10/13] Migrate profiler_builtins to Rust 2024

---
 library/profiler_builtins/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/profiler_builtins/Cargo.toml b/library/profiler_builtins/Cargo.toml
index 230e8051602e4..e075a38daea11 100644
--- a/library/profiler_builtins/Cargo.toml
+++ b/library/profiler_builtins/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "profiler_builtins"
 version = "0.0.0"
-edition = "2021"
+edition = "2024"
 
 [lib]
 test = false

From 32c61f70e7c7a723a53a08c9267a2bd61d99575c Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Wed, 12 Feb 2025 14:55:21 -0800
Subject: [PATCH 11/13] Migrated the rustc-std-workspace crates to Rust 2024

---
 library/rustc-std-workspace-alloc/Cargo.toml | 2 +-
 library/rustc-std-workspace-core/Cargo.toml  | 2 +-
 library/rustc-std-workspace-std/Cargo.toml   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/library/rustc-std-workspace-alloc/Cargo.toml b/library/rustc-std-workspace-alloc/Cargo.toml
index 049ca3e46b57d..5a177808d1bd8 100644
--- a/library/rustc-std-workspace-alloc/Cargo.toml
+++ b/library/rustc-std-workspace-alloc/Cargo.toml
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
 description = """
 Hack for the compiler's own build system
 """
-edition = "2021"
+edition = "2024"
 
 [lib]
 path = "lib.rs"
diff --git a/library/rustc-std-workspace-core/Cargo.toml b/library/rustc-std-workspace-core/Cargo.toml
index ff5cfcbd64144..9315c08a4d199 100644
--- a/library/rustc-std-workspace-core/Cargo.toml
+++ b/library/rustc-std-workspace-core/Cargo.toml
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
 description = """
 Hack for the compiler's own build system
 """
-edition = "2021"
+edition = "2024"
 
 [lib]
 path = "lib.rs"
diff --git a/library/rustc-std-workspace-std/Cargo.toml b/library/rustc-std-workspace-std/Cargo.toml
index 3a1dc2a02b557..f70994e1f8868 100644
--- a/library/rustc-std-workspace-std/Cargo.toml
+++ b/library/rustc-std-workspace-std/Cargo.toml
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
 description = """
 Hack for the compiler's own build system
 """
-edition = "2021"
+edition = "2024"
 
 [lib]
 path = "lib.rs"

From ba06ce611439cfe4beead76b650e8c0b0bf538b1 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Wed, 12 Feb 2025 14:55:46 -0800
Subject: [PATCH 12/13] Migrate the sysroot crate to Rust 2024

---
 library/sysroot/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml
index 0f6fa2d291ab3..ec6ae31507e05 100644
--- a/library/sysroot/Cargo.toml
+++ b/library/sysroot/Cargo.toml
@@ -3,7 +3,7 @@ cargo-features = ["public-dependency"]
 [package]
 name = "sysroot"
 version = "0.0.0"
-edition = "2021"
+edition = "2024"
 
 # this is a dummy crate to ensure that all required crates appear in the sysroot
 [dependencies]

From b130747e92c92c6cf3a1abb1ac71825eba6b18e3 Mon Sep 17 00:00:00 2001
From: Eric Huss <eric@huss.org>
Date: Wed, 12 Feb 2025 14:59:57 -0800
Subject: [PATCH 13/13] Migrate windows-targets to Rust 2024

---
 library/windows_targets/Cargo.toml | 2 +-
 library/windows_targets/src/lib.rs | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/library/windows_targets/Cargo.toml b/library/windows_targets/Cargo.toml
index 94d7c8210647c..705c9e0438119 100644
--- a/library/windows_targets/Cargo.toml
+++ b/library/windows_targets/Cargo.toml
@@ -2,7 +2,7 @@
 name = "windows-targets"
 description = "A drop-in replacement for the real windows-targets crate for use in std only."
 version = "0.0.0"
-edition = "2021"
+edition = "2024"
 
 [features]
 # Enable using raw-dylib for Windows imports.
diff --git a/library/windows_targets/src/lib.rs b/library/windows_targets/src/lib.rs
index 939fab7d5fe62..c7d158584ebd8 100644
--- a/library/windows_targets/src/lib.rs
+++ b/library/windows_targets/src/lib.rs
@@ -12,7 +12,7 @@ pub macro link {
     ($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
         #[cfg_attr(not(target_arch = "x86"), link(name = $library, kind = "raw-dylib", modifiers = "+verbatim"))]
         #[cfg_attr(target_arch = "x86", link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated"))]
-        extern $abi {
+        unsafe extern $abi {
             $(#[link_name=$link_name])?
             pub fn $($function)*;
         }
@@ -26,7 +26,7 @@ pub macro link {
         // libraries below by using an empty extern block. This works because extern blocks are not
         // connected to the library given in the #[link] attribute.
         #[link(name = "kernel32")]
-        extern $abi {
+        unsafe extern $abi {
             $(#[link_name=$link_name])?
             pub fn $($function)*;
         }