commit:     057daa00036e040231855c45bc2bba039c29cb53
Author:     Matt Jolly <kangie <AT> gentoo <DOT> org>
AuthorDate: Sat May 31 06:23:15 2025 +0000
Commit:     Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Tue Jun  3 21:36:56 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=057daa00

dev-lang/rust: stop using FILESDIR

files/ has been too big for a while now. Instead use the rust-patches
repository that was created to manage these patches.

No revbumps required - they were either done beforehand when we dropped
a bad patch _or_ are not required as the only additions are backported
build-time fixes (done in previous commits).

Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>

 dev-lang/rust/Manifest                             |  16 ++
 .../rust/files/1.62.1-musl-dynamic-linking.patch   |  25 --
 dev-lang/rust/files/1.67.0-doc-wasm.patch          |  34 ---
 ....0-ignore-broken-and-non-applicable-tests.patch |  30 ---
 .../rust/files/1.74.1-cross-compile-libz.patch     |  17 --
 .../files/1.75.0-handle-vendored-sources.patch     |  45 ----
 .../rust/files/1.75.0-musl-dynamic-linking.patch   |  19 --
 dev-lang/rust/files/1.76.0-loong-code-model.patch  |  73 ------
 ....0-ignore-broken-and-non-applicable-tests.patch |  30 ---
 .../rust/files/1.78.0-musl-dynamic-linking.patch   |  19 --
 dev-lang/rust/files/1.79.0-revert-8c40426.patch    |  18 --
 .../rust/files/1.81.0-backport-bug937164.patch     |  15 --
 .../rust/files/1.81.0-backport-llvm-pr101761.patch |  30 ---
 .../rust/files/1.81.0-backport-llvm-pr101766.patch |  29 ---
 .../rust/files/1.82.0-dwarf-llvm-assertion.patch   | 247 -------------------
 .../rust/files/1.83.0-cross-compile-libz.patch     |  21 --
 .../rust/files/1.83.0-dwarf-llvm-assertion.patch   | 242 ------------------
 dev-lang/rust/files/1.84.1-fix-cross.patch         |  30 ---
 .../rust/files/1.85.0-cross-compile-libz.patch     |  26 --
 .../rust/files/1.85.0-musl-dynamic-linking.patch   | 271 ---------------------
 dev-lang/rust/files/1.86.0-znver.patch             | 186 --------------
 dev-lang/rust/files/1.87.0-znver.patch             |   9 -
 dev-lang/rust/rust-1.74.1-r101.ebuild              |  46 ++--
 dev-lang/rust/rust-1.75.0-r101.ebuild              |  51 ++--
 dev-lang/rust/rust-1.76.0-r101.ebuild              |  51 ++--
 dev-lang/rust/rust-1.77.1-r101.ebuild              |  50 ++--
 dev-lang/rust/rust-1.78.0-r101.ebuild              |  50 ++--
 dev-lang/rust/rust-1.79.0-r101.ebuild              |  50 ++--
 dev-lang/rust/rust-1.80.1-r101.ebuild              |  49 ++--
 dev-lang/rust/rust-1.81.0-r101.ebuild              |  49 ++--
 dev-lang/rust/rust-1.82.0-r103.ebuild              |  42 ++--
 dev-lang/rust/rust-1.83.0-r3.ebuild                |  42 ++--
 dev-lang/rust/rust-1.84.0-r2.ebuild                |  42 ++--
 dev-lang/rust/rust-1.84.1-r2.ebuild                |  43 ++--
 dev-lang/rust/rust-1.85.0-r2.ebuild                |  16 +-
 dev-lang/rust/rust-1.85.1-r1.ebuild                |  16 +-
 dev-lang/rust/rust-1.86.0-r2.ebuild                |  17 +-
 dev-lang/rust/rust-1.87.0-r1.ebuild                |  17 +-
 38 files changed, 395 insertions(+), 1668 deletions(-)

diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
index 85bc23dc6e11..1f106081eb13 100644
--- a/dev-lang/rust/Manifest
+++ b/dev-lang/rust/Manifest
@@ -1,3 +1,19 @@
+DIST rust-patches-1.74.1-r101.tar.bz2 3887 BLAKE2B 
0afb0252fe56ac8c572fe20acd989f9ef3f33cb8134cdb8fbf5cb064156556aedeb226fd50af465f35f656ebd0c0a163ca060490f44811def8535bad70f5f24d
 SHA512 
7253728000d49fd8533182aa8961e70aef41a48e2df03e72d1ea93ca7abb924bbe1689692d874f2b18469e5a54ea572e55ddc18c9f4d81d1e8ec380f2d72095b
+DIST rust-patches-1.75.0-r101.tar.bz2 4419 BLAKE2B 
389a688a6e92d5f9325bade125b006deb7453d9d7ae0483c8ec0cf580f95eb03a65f600e79ed354029b4b91ab8f66929877bdc6ebf83e7b8d3b1d9451fecd8b6
 SHA512 
6f36e9e13e590bff72483ea4364c045579858da5db3868048f79e0dd6ac896aaf00a1fb9d156820e742a1f5ec412ddfa897677133669b77a4f219c6d90365775
+DIST rust-patches-1.76.0-r101.tar.bz2 5513 BLAKE2B 
52816dffac969520e7b73ceaae1201bb7abba129da1021e8e39ccd6e471281c51cf005221589c7b08fc328be54ba2d6134fc8e240cb15f0b877e370009937084
 SHA512 
a65d306d709e99c688e4febb439a60f9ac8b506a86fdb3021782dfbb8991ddcc07adcd19494a8e76233ad2bec7f23896b6eb80c13929b7c997fdc3fd45f8b63a
+DIST rust-patches-1.77.1-r101.tar.bz2 4937 BLAKE2B 
2b6cdb6d61c7bde5cfaaeea4ae0076acc4d43375805567a48d10b4c9a622ad6234dc5725c30df7ab26d8d67566f405d89b1fff384f263cf3dd404e4298a53801
 SHA512 
e9d16860549f2698957cbd8dd46278a5706c630ff78b8d1199be1b9ba724e60e8ae7020b0a30695841f77053294c043e5957425573db709f30a7b40d4cb53613
+DIST rust-patches-1.78.0-r101.tar.bz2 4098 BLAKE2B 
a62ed3ca1b0ac51c6b0b01653b5ea6e831794de983f72714da36ba508aef655b9255498d7fd0c05c5034ef70a319fc00b913c0fb81f7ae17721ee53ff5e45f92
 SHA512 
cbe95306fe97224f2921a5846204d49a84276a38047ad8f8256fdd349fd45a63b3462810c75384b079e2141ebee3288987e9a4510e2605a5ecbb8612084694e9
+DIST rust-patches-1.79.0-r101.tar.bz2 4102 BLAKE2B 
42c4202d778c286122bd00f758ad3ecc6c3fc2a3d8dda7bf49baec126a4ae1112846b0d1314d9331db99f762e971815fdd3b6e47fedb7a9ecedafbf2ffa08649
 SHA512 
7e518ccba28bafaf03e5512c4567e3b63d17a30e8df025a8ffe1d62c521db2986cdeb6a25cdacafe1e27d05eef01bed43ad42a9dc6a9d4bda1cf7cb98505673e
+DIST rust-patches-1.80.1-r101.tar.bz2 3609 BLAKE2B 
d13296fb44c1ab4b6bc6133b64baf7073b686f4a93b0a75cde4e73f90ee84d009ea9c931c9244081e2c86b40a91829f3768e27c339a4e3d457cb01756f689fe6
 SHA512 
8c9e0d06af8ce2387355a8917383686f05021b4313c9b4f0a1eaf1a81fb08323686cff6ce06e013b6919f25a50a2a5fb5d0c605740e46c68677c4d665c069b41
+DIST rust-patches-1.81.0-r101.tar.bz2 3607 BLAKE2B 
7a200d740920b965f6ef97e23c1f0b20b5e0f055b0c3655c85d55cd11287c07c0c4b7149bccb4ab1a7982c5a8c75d8ad44272abac131f90bd9de161821548f80
 SHA512 
64af65287ed551143ba2bf2e6828e3ccdb5e92b393d8ad9fe9fa3e6b38c67c856f9e37caa9cf1441ce1c7a8e37e22d78f6d15d97713df66abd95798ae9d2da9f
+DIST rust-patches-1.82.0-r103.tar.bz2 5843 BLAKE2B 
0083bdbdfdf564fab9709bdffadd99de024296619aace7a0cfd8cef080ec002452b8e20bb61a3a828d3ae0cd3d5174a04d89ee6351fc976f0678b9ff0dee4eaf
 SHA512 
71296ae4991f67a5983c54800eed58b15ab0a25aa117f5ac56131f9c895014bbc42feab5cc319fd97f0fc64e7715e6b945715375bc32890e6bc5bb308ec0a5a1
+DIST rust-patches-1.83.0-r3.tar.bz2 5886 BLAKE2B 
e7506d4b2d137d7746bd85581170401a700dbedad7c1bb063fedbfd19021a7c6312d541d33dfc7444cfbee64bd3b904cbaf64233523f1e23743925868979b75f
 SHA512 
0f79df5617f900420eacf1e100323defc8316ac3d7733a5ef127551cf6d6667e96bc337540a25f1d464d14e0b3815d66041a0bf7570f3279a978f6eef64dfccd
+DIST rust-patches-1.84.0-r2.tar.bz2 2507 BLAKE2B 
ffe4e5fc49deebdb8b8b3022f951dfeaad15c57c0afe17b050489ee19419f66be0bf4349b300a91c316bf669d22627c7270c013264aee176e846f5b2894f66f0
 SHA512 
bca8e22947c8f9073e3de67030372f326b94aea28dbdc57bfe0f35f40df2bc6380f519ffe2cc0f4014830bc9fcc902612ccf104768bde94da9e4989245e31601
+DIST rust-patches-1.84.1-r2.tar.bz2 2982 BLAKE2B 
2f7addfa4530f3eab79f55ea44eee6390970874ae5ed40ef8706224024db47c861326dc5a79ed9bffcffbad5b27d44b6a3aebab7987fdb61124be3083fbabd71
 SHA512 
cc852e1e679827390134b47bfaa68567a75a5e8559a3caa24ab3931955050bac59f4fe6a4c249d83bde0aa25667ea04749f3763ff3566daa2999df8cbf2d0981
+DIST rust-patches-1.85.0-r2.tar.bz2 4462 BLAKE2B 
61cfde8688fecab1a5c3c80f29b37b691581f3f8be1648f9db34fff15026dab426458cba3b9f06fc5606a0a878b0527698ea6f94c7dff014e4339154ac907d13
 SHA512 
317ab0bcbb792faa1a761893264a29bd650b0d6c5ab17aa762075daccfda684bc6cdd20c0ef89b51bde1a7384fb1df576b18b5303115a8cf04877b435b2d6491
+DIST rust-patches-1.85.1-r1.tar.bz2 4473 BLAKE2B 
fad2fe3222e2625b5cbc60ea1fb805080ce70f751c930c0e3bde9cf043059e1fc3ba4d8e618166fe99a7fcf12d5cccb684c05d4c2542a89c9794869204cbcb09
 SHA512 
edf680a1d3a29ae5d8140031dc8b232b747d08494db2f3393ccc286d9197139583bcaf536d5125b8c896a610c075115b9a16a6e6f3f6b5da60e58433f000dba6
+DIST rust-patches-1.86.0-r2.tar.bz2 5980 BLAKE2B 
179d6acc8c7006eac4d00e073ec1f5496756ef51d465bc098daf1cfe650f469f4341893c72a65e21d84ecb3ccaeb46f5204ef517ae942482d835f89c0a934391
 SHA512 
31e902661d5ee2da82858910551393890583d9702303fed5652122c852e9384fb88a42eddd0b968558865e16b5bd4ac2a13a35bd01ec3f8c3adbb673bc465596
+DIST rust-patches-1.87.0-r1.tar.bz2 4635 BLAKE2B 
d813ec4a602d3bb879927a44a0b9f752aac255e31dfd13c56ab71b3fae7ce46a742c1d2e7494a7e17728f1edb2327ddd6ad6ebabc0c47d66326b766bbd323fbd
 SHA512 
596ffe744a5849b443f077bbd4edbcbb240b9ac51c9d53e0e436e46d7c93a6734477d22eba4a066a0cf474503a6357a72dfa124e594f645be6f50d9bd25bdb10
 DIST rust-patches-1.88.0_beta20250526.tar.bz2 4073 BLAKE2B 
4ae2fd9d87116ee6f779e60ffcbed16ef778fd4e87d4f6f8e2588348b7d0aa28de3627f8c2d43cef540b2422278d4018618c6f0da6936be03de68aba3420f5a4
 SHA512 
8f775901aff2c0da66c01e20c983ca965eddf38cd106d055b6e480e9ca73418abc416fe28215d4f700eb8cce52a90808c0513d23d495977ac19a3b5d82e109ff
 DIST rustc-1.74.1-src.tar.xz 155968724 BLAKE2B 
e05f2379ac94b286f85791a138e1928e5b5b5a7749f0981d82c40c2a12860f55bf96bb2f0e924e35a0f8b2447b13052d38adea909aaa3199105787bb5a4861b3
 SHA512 
14c7e7ed2f38ab60299d8c7d41d78f042b6b57ef822d577b5138e60bdde31cf141eccd4332a25bc5da3d58eb5313d63c1448b5dfe9e11b8055bb8ea133a9038d
 DIST rustc-1.74.1-src.tar.xz.asc 801 BLAKE2B 
ddf73175b164233babf31ca3a381b03e20c0f36d017c1d5f85d6ab11f0986d861ab23b11c061e6b2444ced70c3d6a494cc3de4ec86f0deb221a805491bd75420
 SHA512 
9a96ff9ba9a4e2af4e267b2ec126fc0675c78d0eb767703daa2f28491c3d85c2ab00fbd8584390bf658812ec6c4ab6c57e43b386db59fd505bd3134a8873a09e

diff --git a/dev-lang/rust/files/1.62.1-musl-dynamic-linking.patch 
b/dev-lang/rust/files/1.62.1-musl-dynamic-linking.patch
deleted file mode 100644
index fd56396d127e..000000000000
--- a/dev-lang/rust/files/1.62.1-musl-dynamic-linking.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001
-From: Jory Pratt <[email protected]>
-Date: Tue, 2 Aug 2022 18:32:53 -0500
-Subject: [PATCH] Enable dynamic linking by default for musl
-
-Signed-off-by: Jory Pratt <[email protected]>
----
- compiler/rustc_target/src/spec/linux_musl_base.rs | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/compiler/rustc_target/src/spec/linux_musl_base.rs 
b/compiler/rustc_target/src/spec/linux_musl_base.rs
-index 207a87ab0..8a5a43363 100644
---- a/compiler/rustc_target/src/spec/linux_musl_base.rs
-+++ b/compiler/rustc_target/src/spec/linux_musl_base.rs
-@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions {
-     base.crt_objects_fallback = Some(CrtObjectsFallback::Musl);
- 
-     // These targets statically link libc by default
--    base.crt_static_default = true;
-+    base.crt_static_default = false;
- 
-     base
- }
--- 
-2.35.1

diff --git a/dev-lang/rust/files/1.67.0-doc-wasm.patch 
b/dev-lang/rust/files/1.67.0-doc-wasm.patch
deleted file mode 100644
index 06011deb795b..000000000000
--- a/dev-lang/rust/files/1.67.0-doc-wasm.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 92aa5f6b272bcdc020a34f8d90f9ef851b5b4504 Mon Sep 17 00:00:00 2001
-From: John Millikin <[email protected]>
-Date: Mon, 9 Jan 2023 13:54:21 +0900
-Subject: [PATCH] Disable `linux_ext` in wasm32 and fortanix rustdoc builds.
-
-The `std::os::unix` module is stubbed out when building docs for these
-target platforms. The introduction of Linux-specific extension traits
-caused `std::os::net` to depend on sub-modules of `std::os::unix`,
-which broke rustdoc for the `wasm32-unknown-unknown` target.
-
-Adding an additional `#[cfg]` guard solves that rustdoc failure by
-not declaring `linux_ext` on targets with a stubbed `std::os::unix`.
----
- library/std/src/os/net/mod.rs | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/library/std/src/os/net/mod.rs b/library/std/src/os/net/mod.rs
-index 5ec267c41e97c..b7046dd7c598c 100644
---- a/library/std/src/os/net/mod.rs
-+++ b/library/std/src/os/net/mod.rs
-@@ -1,4 +1,13 @@
- //! OS-specific networking functionality.
- 
-+// See cfg macros in `library/std/src/os/mod.rs` for why these platforms must
-+// be special-cased during rustdoc generation.
-+#[cfg(not(all(
-+    doc,
-+    any(
-+        all(target_arch = "wasm32", not(target_os = "wasi")),
-+        all(target_vendor = "fortanix", target_env = "sgx")
-+    )
-+)))]
- #[cfg(any(target_os = "linux", target_os = "android", doc))]
- pub(super) mod linux_ext;

diff --git 
a/dev-lang/rust/files/1.70.0-ignore-broken-and-non-applicable-tests.patch 
b/dev-lang/rust/files/1.70.0-ignore-broken-and-non-applicable-tests.patch
deleted file mode 100644
index 2e12c7820550..000000000000
--- a/dev-lang/rust/files/1.70.0-ignore-broken-and-non-applicable-tests.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 1879d1d1a284bf51c752e47db284ce22701ed5d0 Mon Sep 17 00:00:00 2001
-From: Samuel Holland <[email protected]>
-Date: Sun, 16 Sep 2018 16:38:48 +0000
-Subject: [PATCH 12/15] Ignore broken and non-applicable tests
-
-c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, #56475
-env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox)
-long-linker-command-lines: takes >10 minutes to run (but still passes)
-simd-intrinsic-generic-bitmask.rs: broken on BE, #59356
-sparc-struct-abi: no sparc target
-sysroot-crates-are-unstable: can't run rustc without RPATH
----
- test/ui/env-funky-keys.rs                                   | 1 +
- 6 files changed, 10 insertions(+)
-
-diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/env-funky-keys.rs
-index c5c824ac58d..f3fe047a79c 100644
---- a/tests/ui/env-funky-keys.rs
-+++ b/tests/ui/env-funky-keys.rs
-@@ -1,6 +1,7 @@
- // run-pass
- // Ignore this test on Android, because it segfaults there.
- 
-+// ignore-test
- // ignore-android
- // ignore-windows
- // ignore-cloudabi no execve
--- 
-2.24.1
-

diff --git a/dev-lang/rust/files/1.74.1-cross-compile-libz.patch 
b/dev-lang/rust/files/1.74.1-cross-compile-libz.patch
deleted file mode 100644
index 98cec093d006..000000000000
--- a/dev-lang/rust/files/1.74.1-cross-compile-libz.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
-https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
-
---- a/compiler/rustc_llvm/build.rs
-+++ b/compiler/rustc_llvm/build.rs
-@@ -237,10 +237,7 @@ fn main() {
-     // of llvm-config, not the target that we're attempting to link.
-     let mut cmd = Command::new(&llvm_config);
-     cmd.arg(llvm_link_arg).arg("--libs");
--
--    if !is_crossed {
--        cmd.arg("--system-libs");
--    }
-+    cmd.arg("--system-libs");
- 
-     if (target.starts_with("arm") && !target.contains("freebsd"))
-         || target.starts_with("mips-")

diff --git a/dev-lang/rust/files/1.75.0-handle-vendored-sources.patch 
b/dev-lang/rust/files/1.75.0-handle-vendored-sources.patch
deleted file mode 100644
index c68ceba15e82..000000000000
--- a/dev-lang/rust/files/1.75.0-handle-vendored-sources.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 4b7e0a0b56aa2446e670dfd6558380a1039a86aa Mon Sep 17 00:00:00 2001
-From: Arlo Siemsen <[email protected]>
-Date: Thu, 4 Jan 2024 11:40:56 -0600
-Subject: [PATCH] Handle vendored sources when remapping paths
-
-Signed-off-by: Randy Barlow <[email protected]>
----
- src/bootstrap/src/core/builder.rs | 19 ++++++++++++-------
- 1 file changed, 12 insertions(+), 7 deletions(-)
-
-diff --git a/src/bootstrap/src/core/builder.rs 
b/src/bootstrap/src/core/builder.rs
-index 4e20babc55a..3770d0687b2 100644
---- a/src/bootstrap/src/core/builder.rs
-+++ b/src/bootstrap/src/core/builder.rs
-@@ -1799,15 +1799,20 @@ pub fn cargo(
-         }
- 
-         if self.config.rust_remap_debuginfo {
--            // FIXME: handle vendored sources
--            let registry_src = 
t!(home::cargo_home()).join("registry").join("src");
-             let mut env_var = OsString::new();
--            for entry in t!(std::fs::read_dir(registry_src)) {
--                if !env_var.is_empty() {
--                    env_var.push("\t");
--                }
--                env_var.push(t!(entry).path());
-+            if self.config.vendor {
-+                let vendor = self.build.src.join("vendor");
-+                env_var.push(vendor);
-                 env_var.push("=/rust/deps");
-+            } else {
-+                let registry_src = 
t!(home::cargo_home()).join("registry").join("src");
-+                for entry in t!(std::fs::read_dir(registry_src)) {
-+                    if !env_var.is_empty() {
-+                        env_var.push("\t");
-+                    }
-+                    env_var.push(t!(entry).path());
-+                    env_var.push("=/rust/deps");
-+                }
-             }
-             cargo.env("RUSTC_CARGO_REGISTRY_SRC_TO_REMAP", env_var);
-         }
--- 
-2.43.0
-

diff --git a/dev-lang/rust/files/1.75.0-musl-dynamic-linking.patch 
b/dev-lang/rust/files/1.75.0-musl-dynamic-linking.patch
deleted file mode 100644
index 7dc34f8ad6b8..000000000000
--- a/dev-lang/rust/files/1.75.0-musl-dynamic-linking.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001
-From: Jory Pratt <[email protected]>
-Date: Tue, 2 Aug 2022 18:32:53 -0500
-Subject: [PATCH] Enable dynamic linking by default for musl
-
-Signed-off-by: Jory Pratt <[email protected]>
---- a/compiler/rustc_target/src/spec/base/linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
-@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions {
-     base.crt_objects_fallback = Some(CrtObjectsFallback::Musl);
- 
-     // These targets statically link libc by default
--    base.crt_static_default = true;
-+    base.crt_static_default = false;
- 
-     base
- }
--- 
-2.35.1

diff --git a/dev-lang/rust/files/1.76.0-loong-code-model.patch 
b/dev-lang/rust/files/1.76.0-loong-code-model.patch
deleted file mode 100644
index 02bfeca55b1d..000000000000
--- a/dev-lang/rust/files/1.76.0-loong-code-model.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-https://github.com/rust-lang/rust/pull/120661
-From: WANG Xuerui <[email protected]>
-Date: Mon, 5 Feb 2024 13:18:32 +0800
-Subject: [PATCH] target: default to the medium code model on LoongArch targets
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The Rust LoongArch targets have been using the default LLVM code model
-so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak.
-As described in the "Code Model" section of LoongArch ELF psABI spec
-v20231219 [1], one can only make function calls as far as ±128MiB with
-the "normal" code model; this is insufficient for very large software
-containing Rust components that needs to be linked into the big text
-section, such as Chromium.
-
-Because:
-
-* we do not want to ask users to recompile std if they are to build
-  such software,
-* objects compiled with larger code models can be linked with those
-  with smaller code models without problems, and
-* the "medium" code model is comparable to the "small"/"normal" one
-  performance-wise (same data access pattern; each function call
-  becomes 2-insn long and indirect, but this may be relaxed back into
-  the direct 1-insn form in a future LLVM version), but is able to
-  perform function calls within ±128GiB,
-
-it is better to just switch the targets to the "medium" code model,
-which is also "medium" in LLVM-speak.
-
-[1]: https://github.com/loongson/la-abi-specs/blob/v2.30/laelf.adoc#code-models
---- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs
-+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs
-@@ -1,4 +1,4 @@
--use crate::spec::{base, Target, TargetOptions};
-+use crate::spec::{base, CodeModel, Target, TargetOptions};
- 
- pub fn target() -> Target {
-     Target {
-@@ -7,6 +7,7 @@ pub fn target() -> Target {
-         data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
-         arch: "loongarch64".into(),
-         options: TargetOptions {
-+            code_model: Some(CodeModel::Medium),
-             cpu: "generic".into(),
-             features: "+f,+d".into(),
-             llvm_abiname: "lp64d".into(),
---- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs
-+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs
-@@ -16,7 +16,7 @@ pub fn target() -> Target {
-             max_atomic_width: Some(64),
-             relocation_model: RelocModel::Static,
-             panic_strategy: PanicStrategy::Abort,
--            code_model: Some(CodeModel::Small),
-+            code_model: Some(CodeModel::Medium),
-             ..Default::default()
-         },
-     }
---- 
a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs
-+++ 
b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs
-@@ -17,7 +17,7 @@ pub fn target() -> Target {
-             max_atomic_width: Some(64),
-             relocation_model: RelocModel::Static,
-             panic_strategy: PanicStrategy::Abort,
--            code_model: Some(CodeModel::Small),
-+            code_model: Some(CodeModel::Medium),
-             ..Default::default()
-         },
-     }
--- 
-2.43.0
-

diff --git 
a/dev-lang/rust/files/1.78.0-ignore-broken-and-non-applicable-tests.patch 
b/dev-lang/rust/files/1.78.0-ignore-broken-and-non-applicable-tests.patch
deleted file mode 100644
index 610e5d04ea2b..000000000000
--- a/dev-lang/rust/files/1.78.0-ignore-broken-and-non-applicable-tests.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 1879d1d1a284bf51c752e47db284ce22701ed5d0 Mon Sep 17 00:00:00 2001
-From: Samuel Holland <[email protected]>
-Date: Sun, 16 Sep 2018 16:38:48 +0000
-Subject: [PATCH 12/15] Ignore broken and non-applicable tests
-
-c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, #56475
-env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox)
-long-linker-command-lines: takes >10 minutes to run (but still passes)
-simd-intrinsic-generic-bitmask.rs: broken on BE, #59356
-sparc-struct-abi: no sparc target
-sysroot-crates-are-unstable: can't run rustc without RPATH
----
- test/ui/env-funky-keys.rs                                   | 1 +
- 6 files changed, 10 insertions(+)
-
-diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/env-funky-keys.rs
-index c5c824ac58d..f3fe047a79c 100644
---- a/tests/ui/env-funky-keys.rs
-+++ b/tests/ui/env-funky-keys.rs
-@@ -1,6 +1,7 @@
- //@ run-pass
- //@ Ignore this test on Android, because it segfaults there.
- 
-+//@ ignore-test
- //@ ignore-android
- //@ ignore-windows
- //@ ignore-cloudabi no execve
--- 
-2.24.1
-

diff --git a/dev-lang/rust/files/1.78.0-musl-dynamic-linking.patch 
b/dev-lang/rust/files/1.78.0-musl-dynamic-linking.patch
deleted file mode 100644
index 25a281ceaaaf..000000000000
--- a/dev-lang/rust/files/1.78.0-musl-dynamic-linking.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001
-From: Jory Pratt <[email protected]>
-Date: Tue, 2 Aug 2022 18:32:53 -0500
-Subject: [PATCH] Enable dynamic linking by default for musl
-
-Signed-off-by: Jory Pratt <[email protected]>
---- a/compiler/rustc_target/src/spec/base/linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
-@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions {
-     base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
- 
-     // These targets statically link libc by default
--    base.crt_static_default = true;
-+    base.crt_static_default = false;
- 
-     base
- }
--- 
-2.35.1

diff --git a/dev-lang/rust/files/1.79.0-revert-8c40426.patch 
b/dev-lang/rust/files/1.79.0-revert-8c40426.patch
deleted file mode 100644
index 583f4001c9cb..000000000000
--- a/dev-lang/rust/files/1.79.0-revert-8c40426.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-This reverts commit 8c40426051a667673cdac9975f84cb6acd4e245f.
-
-https://bugs.gentoo.org/933382
-
-diff --git a/src/bootstrap/src/core/build_steps/llvm.rs 
b/src/bootstrap/src/core/build_steps/llvm.rs
-index d4473e24039..58f351d17fa 100644
---- a/src/bootstrap/src/core/build_steps/llvm.rs
-+++ b/src/bootstrap/src/core/build_steps/llvm.rs
-@@ -724,8 +724,7 @@ fn configure_cmake(
-             }
-         }
-         cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc))
--            .define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx))
--            .define("CMAKE_ASM_COMPILER", sanitize_cc(&cc));
-+            .define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx));
-     }
- 
-     cfg.build_arg("-j").build_arg(builder.jobs().to_string());

diff --git a/dev-lang/rust/files/1.81.0-backport-bug937164.patch 
b/dev-lang/rust/files/1.81.0-backport-bug937164.patch
deleted file mode 100644
index a6e887db34ab..000000000000
--- a/dev-lang/rust/files/1.81.0-backport-bug937164.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-https://bugs.gentoo.org/937525
-https://bugs.gentoo.org/937164
-
-Unnecessary on 19+ because 2222fddfc0a2ff02036542511597839856289094 adds
-SmallVector and SmallVector is fixed by another patch.
---- a/src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
-+++ b/src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
-@@ -13,6 +13,7 @@
- #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
- #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
- 
-+#include <cstdint>
- #include <memory>
- #include <string>
- 

diff --git a/dev-lang/rust/files/1.81.0-backport-llvm-pr101761.patch 
b/dev-lang/rust/files/1.81.0-backport-llvm-pr101761.patch
deleted file mode 100644
index fccb22d57ce4..000000000000
--- a/dev-lang/rust/files/1.81.0-backport-llvm-pr101761.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-https://bugs.gentoo.org/937525
-https://bugs.gentoo.org/937164
-https://github.com/llvm/llvm-project/commit/7e44305041d96b064c197216b931ae3917a34ac1
-https://github.com/llvm/llvm-project/pull/101761
-
-From 7e44305041d96b064c197216b931ae3917a34ac1 Mon Sep 17 00:00:00 2001
-From: Sam James <[email protected]>
-Date: Fri, 2 Aug 2024 23:07:21 +0100
-Subject: [PATCH] [ADT] Add `<cstdint>` to SmallVector (#101761)
-
-SmallVector uses `uint32_t`, `uint64_t` without including `<cstdint>`
-which fails to build w/ GCC 15 after a change in libstdc++ [0]
-
-[0] 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84a74e3076ee2
----
- src/llvm-project/llvm/include/llvm/ADT/SmallVector.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h 
b/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
-index 09676d792dfebd..17444147b102a9 100644
---- a/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
-+++ b/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
-@@ -19,6 +19,7 @@
- #include <algorithm>
- #include <cassert>
- #include <cstddef>
-+#include <cstdint>
- #include <cstdlib>
- #include <cstring>
- #include <functional>

diff --git a/dev-lang/rust/files/1.81.0-backport-llvm-pr101766.patch 
b/dev-lang/rust/files/1.81.0-backport-llvm-pr101766.patch
deleted file mode 100644
index fdecdaf66a95..000000000000
--- a/dev-lang/rust/files/1.81.0-backport-llvm-pr101766.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-https://bugs.gentoo.org/937525
-https://bugs.gentoo.org/937164
-https://github.com/llvm/llvm-project/pull/101766
-
-From 5b69d0cf697f0d78406a5a7ed18eaa4f57a0580a Mon Sep 17 00:00:00 2001
-From: Sam James <[email protected]>
-Date: Fri, 2 Aug 2024 23:38:55 +0100
-Subject: [PATCH] [AMDGPU] Include `<cstdint>` in AMDGPUMCTargetDesc
-
-createAMDGPUELFObjectWriter uses `uint8_t` without including `<cstdint>`
-which fails to build w/ GCC 15 after a change in libstdc++ [0].
-
-[0] 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84a74e3076ee2
----
- src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h | 1 
+
- 1 file changed, 1 insertion(+)
-
-diff --git 
a/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h 
b/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
-index 3ef00f75735b0d..879dbe1b279b18 100644
---- a/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
-+++ b/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
-@@ -15,6 +15,7 @@
- #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H
- #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H
- 
-+#include <cstdint>
- #include <memory>
- 
- namespace llvm {

diff --git a/dev-lang/rust/files/1.82.0-dwarf-llvm-assertion.patch 
b/dev-lang/rust/files/1.82.0-dwarf-llvm-assertion.patch
deleted file mode 100644
index 8c99c9aacc90..000000000000
--- a/dev-lang/rust/files/1.82.0-dwarf-llvm-assertion.patch
+++ /dev/null
@@ -1,247 +0,0 @@
-https://bugs.gentoo.org/942013
-https://bugs.gentoo.org/942884
-https://github.com/rust-lang/rust/issues/131944
-https://github.com/rust-lang/rust/pull/132613
-
-From 1dc106121b62562ead6e7d612fa136dc4b35cd5d Mon Sep 17 00:00:00 2001
-From: Kyle Huey <[email protected]>
-Date: Mon, 4 Nov 2024 11:38:14 -0800
-Subject: [PATCH] Add discriminators to DILocations when multiple functions are
- inlined into a single point.
-
-LLVM does not expect to ever see multiple dbg_declares for the same variable 
at the same
-location with different values. proc-macros make it possible for arbitrary 
code,
-including multiple calls that get inlined, to happen at any given location in 
the source
-code. Add discriminators when that happens so these locations are different to 
LLVM.
-
-This may interfere with the AddDiscriminators pass in LLVM, which is added by 
the
-unstable flag -Zdebug-info-for-profiling.
-
-Fixes #131944
----
- .../src/debuginfo/create_scope_map.rs         | 60 ++++++++++++++++++-
- compiler/rustc_codegen_llvm/src/llvm/ffi.rs   |  4 ++
- .../rustc_llvm/llvm-wrapper/RustWrapper.cpp   |  8 +++
- .../auxiliary/macro_def.rs                    | 11 ++++
- .../mir_inlined_twice_var_locs.rs             | 53 ++++++++++++++++
- 5 files changed, 133 insertions(+), 3 deletions(-)
- create mode 100644 tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
- create mode 100644 
tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
-
-diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs 
b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
-index ac6c2fb1b83a6..0f1909486ec7e 100644
---- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
-+++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
-@@ -1,11 +1,15 @@
-+use std::collections::hash_map::Entry;
-+
- use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext};
- use rustc_codegen_ssa::traits::*;
-+use rustc_data_structures::fx::FxHashMap;
- use rustc_index::bit_set::BitSet;
- use rustc_index::Idx;
- use rustc_middle::mir::{Body, SourceScope};
- use rustc_middle::ty::layout::FnAbiOf;
- use rustc_middle::ty::{self, Instance};
- use rustc_session::config::DebugInfo;
-+use rustc_span::BytePos;
- 
- use super::metadata::file_metadata;
- use super::utils::DIB;
-@@ -37,10 +41,20 @@ pub(crate) fn compute_mir_scopes<'ll, 'tcx>(
-         None
-     };
-     let mut instantiated = BitSet::new_empty(mir.source_scopes.len());
-+    let mut discriminators = FxHashMap::default();
-     // Instantiate all scopes.
-     for idx in 0..mir.source_scopes.len() {
-         let scope = SourceScope::new(idx);
--        make_mir_scope(cx, instance, mir, &variables, debug_context, &mut 
instantiated, scope);
-+        make_mir_scope(
-+            cx,
-+            instance,
-+            mir,
-+            &variables,
-+            debug_context,
-+            &mut instantiated,
-+            &mut discriminators,
-+            scope,
-+        );
-     }
-     assert!(instantiated.count() == mir.source_scopes.len());
- }
-@@ -52,6 +66,7 @@ fn make_mir_scope<'ll, 'tcx>(
-     variables: &Option<BitSet<SourceScope>>,
-     debug_context: &mut FunctionDebugContext<'tcx, &'ll DIScope, &'ll 
DILocation>,
-     instantiated: &mut BitSet<SourceScope>,
-+    discriminators: &mut FxHashMap<BytePos, u32>,
-     scope: SourceScope,
- ) {
-     if instantiated.contains(scope) {
-@@ -60,7 +75,16 @@ fn make_mir_scope<'ll, 'tcx>(
- 
-     let scope_data = &mir.source_scopes[scope];
-     let parent_scope = if let Some(parent) = scope_data.parent_scope {
--        make_mir_scope(cx, instance, mir, variables, debug_context, 
instantiated, parent);
-+        make_mir_scope(
-+            cx,
-+            instance,
-+            mir,
-+            variables,
-+            debug_context,
-+            instantiated,
-+            discriminators,
-+            parent,
-+        );
-         debug_context.scopes[parent]
-     } else {
-         // The root is the function itself.
-@@ -117,7 +141,37 @@ fn make_mir_scope<'ll, 'tcx>(
-         // FIXME(eddyb) this doesn't account for the macro-related
-         // `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does.
-         let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, 
callsite_span);
--        cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span)
-+        let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, 
callsite_span);
-+
-+        // NB: In order to produce proper debug info for variables 
(particularly
-+        // arguments) in multiply-inline functions, LLVM expects to see a 
single
-+        // DILocalVariable with multiple different DILocations in the IR. 
While
-+        // the source information for each DILocation would be identical, 
their
-+        // inlinedAt attributes will be unique to the particular callsite.
-+        //
-+        // We generate DILocations here based on the callsite's location in 
the
-+        // source code. A single location in the source code usually can't
-+        // produce multiple distinct calls so this mostly works, until
-+        // proc-macros get involved. A proc-macro can generate multiple calls
-+        // at the same span, which breaks the assumption that we're going to
-+        // produce a unique DILocation for every scope we process here. We
-+        // have to explicitly add discriminators if we see inlines into the
-+        // same source code location.
-+        //
-+        // Note further that we can't key this hashtable on the span itself,
-+        // because these spans could have distinct SyntaxContexts. We have
-+        // to key on exactly what we're giving to LLVM.
-+        match discriminators.entry(callsite_span.lo()) {
-+            Entry::Occupied(mut o) => {
-+                *o.get_mut() += 1;
-+                unsafe { 
llvm::LLVMRustDILocationCloneWithBaseDiscriminator(loc, *o.get()) }
-+                    .expect("Failed to encode discriminator in DILocation")
-+            }
-+            Entry::Vacant(v) => {
-+                v.insert(0);
-+                loc
-+            }
-+        }
-     });
- 
-     debug_context.scopes[scope] = DebugScope {
-diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs 
b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
-index 3d2e270a3868e..75a5ec44c2285 100644
---- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
-+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
-@@ -2174,6 +2174,10 @@ unsafe extern "C" {
-         Scope: &'a DIScope,
-         InlinedAt: Option<&'a DILocation>,
-     ) -> &'a DILocation;
-+    pub fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
-+        Location: &'a DILocation,
-+        BD: c_uint,
-+    ) -> Option<&'a DILocation>;
-     pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
-     pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
-     pub fn LLVMRustDIBuilderCreateOpLLVMFragment() -> u64;
-diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp 
b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
-index 9330c83b7f230..cd70c3f266920 100644
---- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
-+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
-@@ -1305,6 +1305,14 @@ LLVMRustDIBuilderCreateDebugLocation(unsigned Line, 
unsigned Column,
-   return wrap(Loc);
- }
- 
-+extern "C" LLVMMetadataRef
-+LLVMRustDILocationCloneWithBaseDiscriminator(LLVMMetadataRef Location,
-+                                             unsigned BD) {
-+  DILocation *Loc = unwrapDIPtr<DILocation>(Location);
-+  auto NewLoc = Loc->cloneWithBaseDiscriminator(BD);
-+  return wrap(NewLoc.has_value() ? NewLoc.value() : nullptr);
-+}
-+
- extern "C" uint64_t LLVMRustDIBuilderCreateOpDeref() {
-   return dwarf::DW_OP_deref;
- }
-diff --git a/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs 
b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
-new file mode 100644
-index 0000000000000..159ecfd09743d
---- /dev/null
-+++ b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
-@@ -0,0 +1,11 @@
-+//@ force-host
-+//@ no-prefer-dynamic
-+#![crate_type = "proc-macro"]
-+
-+extern crate proc_macro;
-+use proc_macro::*;
-+
-+#[proc_macro]
-+pub fn square_twice(_item: TokenStream) -> TokenStream {
-+    "(square(env::vars().count() as i32), square(env::vars().count() as 
i32))".parse().unwrap()
-+}
-diff --git a/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs 
b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
-new file mode 100644
-index 0000000000000..c3858044c0c9f
---- /dev/null
-+++ b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
-@@ -0,0 +1,53 @@
-+//@ min-llvm-version: 19
-+//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Zmir-enable-passes=+Inline
-+// MSVC is different because of the individual allocas.
-+//@ ignore-msvc
-+
-+//@ aux-build:macro_def.rs
-+
-+// Find the variable.
-+// CHECK-DAG: ![[#var_dbg:]] = !DILocalVariable(name: "n",{{( arg: 1,)?}} 
scope: ![[#var_scope:]]
-+
-+// Find both dbg_declares. These will proceed the variable metadata, of 
course, so we're looking
-+// backwards.
-+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill{{[0-9]}}, ![[#var_dbg]], 
!DIExpression(), ![[#var_loc2:]])
-+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill, ![[#var_dbg]], !DIExpression(), 
![[#var_loc1:]])
-+
-+// Find the first location definition, looking forwards again.
-+// CHECK: ![[#var_loc1]] = !DILocation
-+// CHECK-SAME: scope: ![[#var_scope:]], inlinedAt: ![[#var_inlinedAt1:]]
-+
-+// Find the first location's inlinedAt
-+// NB: If we fail here it's *probably* because we failed to produce two
-+// different locations and ended up reusing an earlier one.
-+// CHECK: ![[#var_inlinedAt1]] = !DILocation
-+// CHECK-SAME: scope: ![[var_inlinedAt1_scope:]]
-+
-+// Find the second location definition, still looking forwards.
-+// NB: If we failed to produce two different locations, the test will
-+// definitely fail by this point (if it hasn't already) because we won't
-+// be able to find the same line again.
-+// CHECK: ![[#var_loc2]] = !DILocation
-+// CHECK-SAME: scope: ![[#var_scope]], inlinedAt: ![[#var_inlinedAt2:]]
-+
-+// Find the second location's inlinedAt.
-+// CHECK: ![[#var_inlinedAt2]] = !DILocation
-+// CHECK-SAME: scope: ![[#var_inlinedAt2_scope:]]
-+
-+// Finally, check that a discriminator was emitted for the second scope.
-+// FIXMEkhuey ideally we would check that *either* scope has a discriminator
-+// but I don't know that it's possible to check that with FileCheck.
-+// CHECK: ![[#var_inlinedAt2_scope]] = !DILexicalBlockFile
-+// CHECK-SAME: discriminator: [[#]]
-+extern crate macro_def;
-+
-+use std::env;
-+
-+fn square(n: i32) -> i32 {
-+    n * n
-+}
-+
-+fn main() {
-+    let (z1, z2) = macro_def::square_twice!();
-+    println!("{z1} == {z2}");
-+}

diff --git a/dev-lang/rust/files/1.83.0-cross-compile-libz.patch 
b/dev-lang/rust/files/1.83.0-cross-compile-libz.patch
deleted file mode 100644
index 12844fd7efc7..000000000000
--- a/dev-lang/rust/files/1.83.0-cross-compile-libz.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
-https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
-
-diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
-index f606fa483ca..8a2e1c40e8b 100644
---- a/compiler/rustc_llvm/build.rs
-+++ b/compiler/rustc_llvm/build.rs
-@@ -220,12 +220,7 @@
-     let mut cmd = Command::new(&llvm_config);
-     cmd.arg(llvm_link_arg).arg("--libs");
-
--    // Don't link system libs if cross-compiling unless targetting Windows.
--    // On Windows system DLLs aren't linked directly, instead import 
libraries are used.
--    // These import libraries are independent of the host.
--    if !is_crossed || target.contains("windows") {
--        cmd.arg("--system-libs");
--    }
-+    cmd.arg("--system-libs");
-
-     // We need libkstat for getHostCPUName on SPARC builds.
-     // See also: https://github.com/llvm/llvm-project/issues/64186

diff --git a/dev-lang/rust/files/1.83.0-dwarf-llvm-assertion.patch 
b/dev-lang/rust/files/1.83.0-dwarf-llvm-assertion.patch
deleted file mode 100644
index 64d00ac0aaaf..000000000000
--- a/dev-lang/rust/files/1.83.0-dwarf-llvm-assertion.patch
+++ /dev/null
@@ -1,242 +0,0 @@
-From 1dc106121b62562ead6e7d612fa136dc4b35cd5d Mon Sep 17 00:00:00 2001
-From: Kyle Huey <[email protected]>
-Date: Mon, 4 Nov 2024 11:38:14 -0800
-Subject: [PATCH] Add discriminators to DILocations when multiple functions are
- inlined into a single point.
-
-LLVM does not expect to ever see multiple dbg_declares for the same variable 
at the same
-location with different values. proc-macros make it possible for arbitrary 
code,
-including multiple calls that get inlined, to happen at any given location in 
the source
-code. Add discriminators when that happens so these locations are different to 
LLVM.
-
-This may interfere with the AddDiscriminators pass in LLVM, which is added by 
the
-unstable flag -Zdebug-info-for-profiling.
-
-Fixes #131944
----
- .../src/debuginfo/create_scope_map.rs         | 60 ++++++++++++++++++-
- compiler/rustc_codegen_llvm/src/llvm/ffi.rs   |  4 ++
- .../rustc_llvm/llvm-wrapper/RustWrapper.cpp   |  8 +++
- .../auxiliary/macro_def.rs                    | 11 ++++
- .../mir_inlined_twice_var_locs.rs             | 53 ++++++++++++++++
- 5 files changed, 133 insertions(+), 3 deletions(-)
- create mode 100644 tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
- create mode 100644 
tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
-
-diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs 
b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
-index ac6c2fb1b83a6..0f1909486ec7e 100644
---- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
-+++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
-@@ -1,11 +1,15 @@
-+use std::collections::hash_map::Entry;
-+
- use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext};
- use rustc_codegen_ssa::traits::*;
-+use rustc_data_structures::fx::FxHashMap;
- use rustc_index::Idx;
- use rustc_index::bit_set::BitSet;
- use rustc_middle::mir::{Body, SourceScope};
- use rustc_middle::ty::layout::FnAbiOf;
- use rustc_middle::ty::{self, Instance};
- use rustc_session::config::DebugInfo;
-+use rustc_span::BytePos;
- 
- use super::metadata::file_metadata;
- use super::utils::DIB;
-@@ -37,10 +41,20 @@ pub(crate) fn compute_mir_scopes<'ll, 'tcx>(
-         None
-     };
-     let mut instantiated = BitSet::new_empty(mir.source_scopes.len());
-+    let mut discriminators = FxHashMap::default();
-     // Instantiate all scopes.
-     for idx in 0..mir.source_scopes.len() {
-         let scope = SourceScope::new(idx);
--        make_mir_scope(cx, instance, mir, &variables, debug_context, &mut 
instantiated, scope);
-+        make_mir_scope(
-+            cx,
-+            instance,
-+            mir,
-+            &variables,
-+            debug_context,
-+            &mut instantiated,
-+            &mut discriminators,
-+            scope,
-+        );
-     }
-     assert!(instantiated.count() == mir.source_scopes.len());
- }
-@@ -52,6 +66,7 @@ fn make_mir_scope<'ll, 'tcx>(
-     variables: &Option<BitSet<SourceScope>>,
-     debug_context: &mut FunctionDebugContext<'tcx, &'ll DIScope, &'ll 
DILocation>,
-     instantiated: &mut BitSet<SourceScope>,
-+    discriminators: &mut FxHashMap<BytePos, u32>,
-     scope: SourceScope,
- ) {
-     if instantiated.contains(scope) {
-@@ -60,7 +75,16 @@ fn make_mir_scope<'ll, 'tcx>(
- 
-     let scope_data = &mir.source_scopes[scope];
-     let parent_scope = if let Some(parent) = scope_data.parent_scope {
--        make_mir_scope(cx, instance, mir, variables, debug_context, 
instantiated, parent);
-+        make_mir_scope(
-+            cx,
-+            instance,
-+            mir,
-+            variables,
-+            debug_context,
-+            instantiated,
-+            discriminators,
-+            parent,
-+        );
-         debug_context.scopes[parent]
-     } else {
-         // The root is the function itself.
-@@ -117,7 +141,37 @@ fn make_mir_scope<'ll, 'tcx>(
-         // FIXME(eddyb) this doesn't account for the macro-related
-         // `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does.
-         let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, 
callsite_span);
--        cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span)
-+        let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, 
callsite_span);
-+
-+        // NB: In order to produce proper debug info for variables 
(particularly
-+        // arguments) in multiply-inline functions, LLVM expects to see a 
single
-+        // DILocalVariable with multiple different DILocations in the IR. 
While
-+        // the source information for each DILocation would be identical, 
their
-+        // inlinedAt attributes will be unique to the particular callsite.
-+        //
-+        // We generate DILocations here based on the callsite's location in 
the
-+        // source code. A single location in the source code usually can't
-+        // produce multiple distinct calls so this mostly works, until
-+        // proc-macros get involved. A proc-macro can generate multiple calls
-+        // at the same span, which breaks the assumption that we're going to
-+        // produce a unique DILocation for every scope we process here. We
-+        // have to explicitly add discriminators if we see inlines into the
-+        // same source code location.
-+        //
-+        // Note further that we can't key this hashtable on the span itself,
-+        // because these spans could have distinct SyntaxContexts. We have
-+        // to key on exactly what we're giving to LLVM.
-+        match discriminators.entry(callsite_span.lo()) {
-+            Entry::Occupied(mut o) => {
-+                *o.get_mut() += 1;
-+                unsafe { 
llvm::LLVMRustDILocationCloneWithBaseDiscriminator(loc, *o.get()) }
-+                    .expect("Failed to encode discriminator in DILocation")
-+            }
-+            Entry::Vacant(v) => {
-+                v.insert(0);
-+                loc
-+            }
-+        }
-     });
- 
-     debug_context.scopes[scope] = DebugScope {
-diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs 
b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
-index 3d2e270a3868e..75a5ec44c2285 100644
---- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
-+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
-@@ -2174,6 +2174,10 @@ unsafe extern "C" {
-         Scope: &'a DIScope,
-         InlinedAt: Option<&'a DILocation>,
-     ) -> &'a DILocation;
-+    pub fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
-+        Location: &'a DILocation,
-+        BD: c_uint,
-+    ) -> Option<&'a DILocation>;
-     pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
-     pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
-     pub fn LLVMRustDIBuilderCreateOpLLVMFragment() -> u64;
-diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp 
b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
-index 9330c83b7f230..cd70c3f266920 100644
---- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
-+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
-@@ -1305,6 +1305,14 @@ LLVMRustDIBuilderCreateDebugLocation(unsigned Line, 
unsigned Column,
-   return wrap(Loc);
- }
- 
-+extern "C" LLVMMetadataRef
-+LLVMRustDILocationCloneWithBaseDiscriminator(LLVMMetadataRef Location,
-+                                             unsigned BD) {
-+  DILocation *Loc = unwrapDIPtr<DILocation>(Location);
-+  auto NewLoc = Loc->cloneWithBaseDiscriminator(BD);
-+  return wrap(NewLoc.has_value() ? NewLoc.value() : nullptr);
-+}
-+
- extern "C" uint64_t LLVMRustDIBuilderCreateOpDeref() {
-   return dwarf::DW_OP_deref;
- }
-diff --git a/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs 
b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
-new file mode 100644
-index 0000000000000..159ecfd09743d
---- /dev/null
-+++ b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
-@@ -0,0 +1,11 @@
-+//@ force-host
-+//@ no-prefer-dynamic
-+#![crate_type = "proc-macro"]
-+
-+extern crate proc_macro;
-+use proc_macro::*;
-+
-+#[proc_macro]
-+pub fn square_twice(_item: TokenStream) -> TokenStream {
-+    "(square(env::vars().count() as i32), square(env::vars().count() as 
i32))".parse().unwrap()
-+}
-diff --git a/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs 
b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
-new file mode 100644
-index 0000000000000..c3858044c0c9f
---- /dev/null
-+++ b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
-@@ -0,0 +1,53 @@
-+//@ min-llvm-version: 19
-+//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Zmir-enable-passes=+Inline
-+// MSVC is different because of the individual allocas.
-+//@ ignore-msvc
-+
-+//@ aux-build:macro_def.rs
-+
-+// Find the variable.
-+// CHECK-DAG: ![[#var_dbg:]] = !DILocalVariable(name: "n",{{( arg: 1,)?}} 
scope: ![[#var_scope:]]
-+
-+// Find both dbg_declares. These will proceed the variable metadata, of 
course, so we're looking
-+// backwards.
-+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill{{[0-9]}}, ![[#var_dbg]], 
!DIExpression(), ![[#var_loc2:]])
-+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill, ![[#var_dbg]], !DIExpression(), 
![[#var_loc1:]])
-+
-+// Find the first location definition, looking forwards again.
-+// CHECK: ![[#var_loc1]] = !DILocation
-+// CHECK-SAME: scope: ![[#var_scope:]], inlinedAt: ![[#var_inlinedAt1:]]
-+
-+// Find the first location's inlinedAt
-+// NB: If we fail here it's *probably* because we failed to produce two
-+// different locations and ended up reusing an earlier one.
-+// CHECK: ![[#var_inlinedAt1]] = !DILocation
-+// CHECK-SAME: scope: ![[var_inlinedAt1_scope:]]
-+
-+// Find the second location definition, still looking forwards.
-+// NB: If we failed to produce two different locations, the test will
-+// definitely fail by this point (if it hasn't already) because we won't
-+// be able to find the same line again.
-+// CHECK: ![[#var_loc2]] = !DILocation
-+// CHECK-SAME: scope: ![[#var_scope]], inlinedAt: ![[#var_inlinedAt2:]]
-+
-+// Find the second location's inlinedAt.
-+// CHECK: ![[#var_inlinedAt2]] = !DILocation
-+// CHECK-SAME: scope: ![[#var_inlinedAt2_scope:]]
-+
-+// Finally, check that a discriminator was emitted for the second scope.
-+// FIXMEkhuey ideally we would check that *either* scope has a discriminator
-+// but I don't know that it's possible to check that with FileCheck.
-+// CHECK: ![[#var_inlinedAt2_scope]] = !DILexicalBlockFile
-+// CHECK-SAME: discriminator: [[#]]
-+extern crate macro_def;
-+
-+use std::env;
-+
-+fn square(n: i32) -> i32 {
-+    n * n
-+}
-+
-+fn main() {
-+    let (z1, z2) = macro_def::square_twice!();
-+    println!("{z1} == {z2}");
-+}

diff --git a/dev-lang/rust/files/1.84.1-fix-cross.patch 
b/dev-lang/rust/files/1.84.1-fix-cross.patch
deleted file mode 100644
index 47d7766ae951..000000000000
--- a/dev-lang/rust/files/1.84.1-fix-cross.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-https://github.com/rust-lang/rust/issues/133629
-https://github.com/rust-lang/rust/commit/a24d859f19bbefe5371694f318568b0ab5a13299
-
-From: onur-ozkan <[email protected]>
-Date: Thu, 30 Jan 2025 16:51:08 +0000
-Subject: [PATCH] set rustc dylib on manually constructed rustc command
-
-Signed-off-by: onur-ozkan <[email protected]>
---- a/src/bootstrap/src/core/builder/cargo.rs
-+++ b/src/bootstrap/src/core/builder/cargo.rs
-@@ -653,7 +653,10 @@ impl Builder<'_> {
-                 // Build proc macros both for the host and the target unless 
proc-macros are not
-                 // supported by the target.
-                 if target != compiler.host && cmd_kind != Kind::Check {
--                    let error = command(self.rustc(compiler))
-+                    let mut rustc_cmd = command(self.rustc(compiler));
-+                    self.add_rustc_lib_path(compiler, &mut rustc_cmd);
-+
-+                    let error = rustc_cmd
-                         .arg("--target")
-                         .arg(target.rustc_target_arg())
-                         .arg("--print=file-names")
-@@ -661,6 +664,7 @@ impl Builder<'_> {
-                         .arg("-")
-                         .run_capture(self)
-                         .stderr();
-+
-                     let not_supported = error
-                         .lines()
-                         .any(|line| line.contains("unsupported crate type 
`proc-macro`"));

diff --git a/dev-lang/rust/files/1.85.0-cross-compile-libz.patch 
b/dev-lang/rust/files/1.85.0-cross-compile-libz.patch
deleted file mode 100644
index 7bd45c4e09e5..000000000000
--- a/dev-lang/rust/files/1.85.0-cross-compile-libz.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 768f7e50a6d9a3db4e4eef45dcb4c56e9b580389 Mon Sep 17 00:00:00 2001
-From: Matt Jolly <[email protected]>
-Date: Sun, 9 Feb 2025 21:12:43 +1000
-Subject: [PATCH] Update libz cross-compile patch for 9999 (1.86.0)
-
-See-also: 
https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
-See-also: https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
---- a/compiler/rustc_llvm/build.rs
-+++ b/compiler/rustc_llvm/build.rs
-@@ -219,13 +219,7 @@ fn main() {
-     // of llvm-config, not the target that we're attempting to link.
-     let mut cmd = Command::new(&llvm_config);
-     cmd.arg(llvm_link_arg).arg("--libs");
--
--    // Don't link system libs if cross-compiling unless targeting Windows.
--    // On Windows system DLLs aren't linked directly, instead import 
libraries are used.
--    // These import libraries are independent of the host.
--    if !is_crossed || target.contains("windows") {
--        cmd.arg("--system-libs");
--    }
-+    cmd.arg("--system-libs");
- 
-     // We need libkstat for getHostCPUName on SPARC builds.
-     // See also: https://github.com/llvm/llvm-project/issues/64186
--- 
-2.48.0

diff --git a/dev-lang/rust/files/1.85.0-musl-dynamic-linking.patch 
b/dev-lang/rust/files/1.85.0-musl-dynamic-linking.patch
deleted file mode 100644
index a6ab967417c4..000000000000
--- a/dev-lang/rust/files/1.85.0-musl-dynamic-linking.patch
+++ /dev/null
@@ -1,271 +0,0 @@
-From be965af5421e55c0032a989b220bc0da005d2272 Mon Sep 17 00:00:00 2001
-From: Michal Rostecki <[email protected]>
-Date: Tue, 25 Feb 2025 16:24:21 +0100
-Subject: [PATCH] Enable dynamic linking by default for musl
-
----
- .../src/spec/targets/aarch64_unknown_linux_musl.rs             | 3 ---
- .../src/spec/targets/arm_unknown_linux_musleabi.rs             | 3 +--
- .../src/spec/targets/arm_unknown_linux_musleabihf.rs           | 3 +--
- .../src/spec/targets/armv5te_unknown_linux_musleabi.rs         | 3 +--
- .../src/spec/targets/armv7_unknown_linux_musleabi.rs           | 3 +--
- .../src/spec/targets/armv7_unknown_linux_musleabihf.rs         | 3 +--
- .../rustc_target/src/spec/targets/i586_unknown_linux_musl.rs   | 2 --
- .../rustc_target/src/spec/targets/i686_unknown_linux_musl.rs   | 2 --
- .../src/spec/targets/mips64_unknown_linux_muslabi64.rs         | 3 +--
- .../src/spec/targets/mips64el_unknown_linux_muslabi64.rs       | 2 --
- .../src/spec/targets/powerpc64_unknown_linux_musl.rs           | 2 --
- .../src/spec/targets/powerpc64le_unknown_linux_musl.rs         | 2 --
- .../src/spec/targets/powerpc_unknown_linux_musl.rs             | 2 --
- .../src/spec/targets/powerpc_unknown_linux_muslspe.rs          | 2 --
- .../src/spec/targets/riscv32gc_unknown_linux_musl.rs           | 3 +--
- .../rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs  | 2 --
- .../src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs   | 3 +--
- .../rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs | 2 --
- 18 files changed, 8 insertions(+), 37 deletions(-)
-
-diff --git 
a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
-index 4fefdfa5c5e..bb65048a56d 100644
---- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
-@@ -12,9 +12,6 @@ pub(crate) fn target() -> Target {
-         | SanitizerSet::MEMORY
-         | SanitizerSet::THREAD;
- 
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
--
-     Target {
-         llvm_target: "aarch64-unknown-linux-musl".into(),
-         metadata: crate::spec::TargetMetadata {
-diff --git 
a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs 
b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
-index 26241dd0bd4..cab79e2bf7d 100644
---- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
-+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
-@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
-             features: "+strict-align,+v6".into(),
-             max_atomic_width: Some(64),
-             mcount: "\u{1}mcount".into(),
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base::linux_musl::opts()
-         },
-     }
-diff --git 
a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs 
b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
-index 4bbde7667b9..c5f6c180a95 100644
---- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
-+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
-@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
-             features: "+strict-align,+v6,+vfp2,-d32".into(),
-             max_atomic_width: Some(64),
-             mcount: "\u{1}mcount".into(),
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base::linux_musl::opts()
-         },
-     }
-diff --git 
a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs 
b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
-index 62619546891..680dafe6943 100644
---- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
-+++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
-@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
-             max_atomic_width: Some(32),
-             mcount: "\u{1}mcount".into(),
-             has_thumb_interworking: true,
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base::linux_musl::opts()
-         },
-     }
-diff --git 
a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs 
b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
-index 0436e0d8df4..e862b28ca92 100644
---- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
-+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
-@@ -24,8 +24,7 @@ pub(crate) fn target() -> Target {
-             features: "+v7,+thumb2,+soft-float,-neon".into(),
-             max_atomic_width: Some(64),
-             mcount: "\u{1}mcount".into(),
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base::linux_musl::opts()
-         },
-     }
-diff --git 
a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs 
b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
-index 22e49f2f1b0..acb7c99cdaf 100644
---- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
-+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
-@@ -23,8 +23,7 @@ pub(crate) fn target() -> Target {
-             features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
-             max_atomic_width: Some(64),
-             mcount: "\u{1}mcount".into(),
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base::linux_musl::opts()
-         },
-     }
-diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
-index 8ad93496f3a..623422a89ea 100644
---- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
-@@ -4,7 +4,5 @@ pub(crate) fn target() -> Target {
-     let mut base = super::i686_unknown_linux_musl::target();
-     base.cpu = "pentium".into();
-     base.llvm_target = "i586-unknown-linux-musl".into();
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
-     base
- }
-diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
-index 6ba87c732b7..b805b80b85b 100644
---- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
-     base.max_atomic_width = Some(64);
-     base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", 
"-Wl,-melf_i386"]);
-     base.stack_probes = StackProbeType::Inline;
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
- 
-     // The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
-     // implementation, apparently relies on frame pointers existing... 
somehow.
-diff --git 
a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs 
b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
-index 32f5c79d653..9a25fe773fb 100644
---- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
-+++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
-@@ -22,8 +22,7 @@ pub(crate) fn target() -> Target {
-             abi: "abi64".into(),
-             endian: Endian::Big,
-             mcount: "_mcount".into(),
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base
-         },
-     }
-diff --git 
a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs 
b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
-index 5e7c37fd46c..4f50e8b7033 100644
---- 
a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
-+++ 
b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
-@@ -5,8 +5,6 @@ pub(crate) fn target() -> Target {
-     base.cpu = "mips64r2".into();
-     base.features = "+mips64r2".into();
-     base.max_atomic_width = Some(64);
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
-     Target {
-         // LLVM doesn't recognize "muslabi64" yet.
-         llvm_target: "mips64el-unknown-linux-musl".into(),
-diff --git 
a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
-index a54b17c87a7..a964f417799 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
-@@ -7,8 +7,6 @@ pub(crate) fn target() -> Target {
-     base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
-     base.max_atomic_width = Some(64);
-     base.stack_probes = StackProbeType::Inline;
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
- 
-     Target {
-         llvm_target: "powerpc64-unknown-linux-musl".into(),
-diff --git 
a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
-index f763c37f535..d0335506f16 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
-     base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
-     base.max_atomic_width = Some(64);
-     base.stack_probes = StackProbeType::Inline;
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
- 
-     Target {
-         llvm_target: "powerpc64le-unknown-linux-musl".into(),
-diff --git 
a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
-index 0cd0ea96ad3..5372a83e29a 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
-     base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
-     base.max_atomic_width = Some(32);
-     base.stack_probes = StackProbeType::Inline;
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
- 
-     Target {
-         llvm_target: "powerpc-unknown-linux-musl".into(),
-diff --git 
a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs 
b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
-index b86c3c2e8e0..2305db81c5e 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
-     base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
-     base.max_atomic_width = Some(32);
-     base.stack_probes = StackProbeType::Inline;
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
- 
-     Target {
-         llvm_target: "powerpc-unknown-linux-muslspe".into(),
-diff --git 
a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
-index a07429bb0c5..cf2d7669a8a 100644
---- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
-@@ -23,8 +23,7 @@ pub(crate) fn target() -> Target {
-             llvm_abiname: "ilp32d".into(),
-             max_atomic_width: Some(32),
-             supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base::linux_musl::opts()
-         },
-     }
-diff --git 
a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
-index fbe8c48eca7..7a78004927b 100644
---- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
-@@ -12,8 +12,6 @@ pub(crate) fn target() -> Target {
-     base.stack_probes = StackProbeType::Inline;
-     base.supported_sanitizers =
-         SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | 
SanitizerSet::THREAD;
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
- 
-     Target {
-         llvm_target: "s390x-unknown-linux-musl".into(),
-diff --git 
a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
 
b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
-index 1149b6d16eb..e1e060c211d 100644
---- 
a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
-+++ 
b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
-@@ -27,8 +27,7 @@ pub(crate) fn target() -> Target {
-             features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
-             max_atomic_width: Some(64),
-             mcount: "\u{1}mcount".into(),
--            // FIXME(compiler-team#422): musl targets should be dynamically 
linked by default.
--            crt_static_default: true,
-+            crt_static_default: false,
-             ..base::linux_musl::opts()
-         },
-     }
-diff --git 
a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs 
b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
-index 8dcdc5be8a9..8be0f335db9 100644
---- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
-@@ -14,8 +14,6 @@ pub(crate) fn target() -> Target {
-         | SanitizerSet::MEMORY
-         | SanitizerSet::THREAD;
-     base.supports_xray = true;
--    // FIXME(compiler-team#422): musl targets should be dynamically linked by 
default.
--    base.crt_static_default = true;
- 
-     Target {
-         llvm_target: "x86_64-unknown-linux-musl".into(),
--- 
-2.45.3
-

diff --git a/dev-lang/rust/files/1.86.0-znver.patch 
b/dev-lang/rust/files/1.86.0-znver.patch
deleted file mode 100644
index 5b93a76e653c..000000000000
--- a/dev-lang/rust/files/1.86.0-znver.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-https://github.com/rust-lang/rust/issues/138054
-https://bugs.gentoo.org/953109#c7
-diff --git a/library/portable-simd/crates/core_simd/src/lib.rs 
b/library/portable-simd/crates/core_simd/src/lib.rs
-index 7f57847c9c234..717b882b64ba1 100644
---- a/library/portable-simd/crates/core_simd/src/lib.rs
-+++ b/library/portable-simd/crates/core_simd/src/lib.rs
-@@ -35,7 +35,11 @@
-     feature(stdarch_x86_avx512)
- )]
- #![warn(missing_docs, clippy::missing_inline_in_public_items)] // basically 
all items, really
--#![deny(unsafe_op_in_unsafe_fn, clippy::undocumented_unsafe_blocks)]
-+#![deny(
-+    unsafe_op_in_unsafe_fn,
-+    unreachable_pub,
-+    clippy::undocumented_unsafe_blocks
-+)]
- #![doc(test(attr(deny(warnings))))]
- #![allow(internal_features)]
- #![unstable(feature = "portable_simd", issue = "86656")]
-diff --git a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs 
b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
-index db4312d5bf88a..8221d8f17e90e 100644
---- a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
-+++ b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
-@@ -5,7 +5,7 @@ use core::marker::PhantomData;
- 
- /// A mask where each lane is represented by a single bit.
- #[repr(transparent)]
--pub struct Mask<T, const N: usize>(
-+pub(crate) struct Mask<T, const N: usize>(
-     <LaneCount<N> as SupportedLaneCount>::BitMask,
-     PhantomData<T>,
- )
-@@ -78,7 +78,7 @@ where
- {
-     #[inline]
-     #[must_use = "method returns a new mask and does not mutate the original 
value"]
--    pub fn splat(value: bool) -> Self {
-+    pub(crate) fn splat(value: bool) -> Self {
-         let mut mask = <LaneCount<N> as 
SupportedLaneCount>::BitMask::default();
-         if value {
-             mask.as_mut().fill(u8::MAX)
-@@ -93,12 +93,12 @@ where
- 
-     #[inline]
-     #[must_use = "method returns a new bool and does not mutate the original 
value"]
--    pub unsafe fn test_unchecked(&self, lane: usize) -> bool {
-+    pub(crate) unsafe fn test_unchecked(&self, lane: usize) -> bool {
-         (self.0.as_ref()[lane / 8] >> (lane % 8)) & 0x1 > 0
-     }
- 
-     #[inline]
--    pub unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
-+    pub(crate) unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
-         unsafe {
-             self.0.as_mut()[lane / 8] ^= ((value ^ self.test_unchecked(lane)) 
as u8) << (lane % 8)
-         }
-@@ -106,7 +106,7 @@ where
- 
-     #[inline]
-     #[must_use = "method returns a new vector and does not mutate the 
original value"]
--    pub fn to_int(self) -> Simd<T, N> {
-+    pub(crate) fn to_int(self) -> Simd<T, N> {
-         unsafe {
-             core::intrinsics::simd::simd_select_bitmask(
-                 self.0,
-@@ -118,19 +118,19 @@ where
- 
-     #[inline]
-     #[must_use = "method returns a new mask and does not mutate the original 
value"]
--    pub unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
-+    pub(crate) unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
-         unsafe { Self(core::intrinsics::simd::simd_bitmask(value), 
PhantomData) }
-     }
- 
-     #[inline]
--    pub fn to_bitmask_integer(self) -> u64 {
-+    pub(crate) fn to_bitmask_integer(self) -> u64 {
-         let mut bitmask = [0u8; 8];
-         bitmask[..self.0.as_ref().len()].copy_from_slice(self.0.as_ref());
-         u64::from_ne_bytes(bitmask)
-     }
- 
-     #[inline]
--    pub fn from_bitmask_integer(bitmask: u64) -> Self {
-+    pub(crate) fn from_bitmask_integer(bitmask: u64) -> Self {
-         let mut bytes = <LaneCount<N> as 
SupportedLaneCount>::BitMask::default();
-         let len = bytes.as_mut().len();
-         bytes
-@@ -141,7 +141,7 @@ where
- 
-     #[inline]
-     #[must_use = "method returns a new mask and does not mutate the original 
value"]
--    pub fn convert<U>(self) -> Mask<U, N>
-+    pub(crate) fn convert<U>(self) -> Mask<U, N>
-     where
-         U: MaskElement,
-     {
-@@ -151,13 +151,13 @@ where
- 
-     #[inline]
-     #[must_use = "method returns a new bool and does not mutate the original 
value"]
--    pub fn any(self) -> bool {
-+    pub(crate) fn any(self) -> bool {
-         self != Self::splat(false)
-     }
- 
-     #[inline]
-     #[must_use = "method returns a new bool and does not mutate the original 
value"]
--    pub fn all(self) -> bool {
-+    pub(crate) fn all(self) -> bool {
-         self == Self::splat(true)
-     }
- }
-diff --git a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs 
b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
-index ae55cf1f8fa87..a693ea90b9cb8 100644
---- a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
-+++ b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
-@@ -3,7 +3,7 @@
- use crate::simd::{LaneCount, MaskElement, Simd, SupportedLaneCount};
- 
- #[repr(transparent)]
--pub struct Mask<T, const N: usize>(Simd<T, N>)
-+pub(crate) struct Mask<T, const N: usize>(Simd<T, N>)
- where
-     T: MaskElement,
-     LaneCount<N>: SupportedLaneCount;
-@@ -103,36 +103,36 @@ where
- {
-     #[inline]
-     #[must_use = "method returns a new mask and does not mutate the original 
value"]
--    pub fn splat(value: bool) -> Self {
-+    pub(crate) fn splat(value: bool) -> Self {
-         Self(Simd::splat(if value { T::TRUE } else { T::FALSE }))
-     }
- 
-     #[inline]
-     #[must_use = "method returns a new bool and does not mutate the original 
value"]
--    pub unsafe fn test_unchecked(&self, lane: usize) -> bool {
-+    pub(crate) unsafe fn test_unchecked(&self, lane: usize) -> bool {
-         T::eq(self.0[lane], T::TRUE)
-     }
- 
-     #[inline]
--    pub unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
-+    pub(crate) unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
-         self.0[lane] = if value { T::TRUE } else { T::FALSE }
-     }
- 
-     #[inline]
-     #[must_use = "method returns a new vector and does not mutate the 
original value"]
--    pub fn to_int(self) -> Simd<T, N> {
-+    pub(crate) fn to_int(self) -> Simd<T, N> {
-         self.0
-     }
- 
-     #[inline]
-     #[must_use = "method returns a new mask and does not mutate the original 
value"]
--    pub unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
-+    pub(crate) unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
-         Self(value)
-     }
- 
-     #[inline]
-     #[must_use = "method returns a new mask and does not mutate the original 
value"]
--    pub fn convert<U>(self) -> Mask<U, N>
-+    pub(crate) fn convert<U>(self) -> Mask<U, N>
-     where
-         U: MaskElement,
-     {
-@@ -221,14 +221,14 @@ where
- 
-     #[inline]
-     #[must_use = "method returns a new bool and does not mutate the original 
value"]
--    pub fn any(self) -> bool {
-+    pub(crate) fn any(self) -> bool {
-         // Safety: use `self` as an integer vector
-         unsafe { core::intrinsics::simd::simd_reduce_any(self.to_int()) }
-     }
- 
-     #[inline]
-     #[must_use = "method returns a new bool and does not mutate the original 
value"]
--    pub fn all(self) -> bool {
-+    pub(crate) fn all(self) -> bool {
-         // Safety: use `self` as an integer vector
-         unsafe { core::intrinsics::simd::simd_reduce_all(self.to_int()) }
-     }

diff --git a/dev-lang/rust/files/1.87.0-znver.patch 
b/dev-lang/rust/files/1.87.0-znver.patch
deleted file mode 100644
index 11424a41566e..000000000000
--- a/dev-lang/rust/files/1.87.0-znver.patch
+++ /dev/null
@@ -1,9 +0,0 @@
-https://bugs.gentoo.org/956018#c3
---- a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
-+++ b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
-@@ -1,4 +1,5 @@
- #![allow(unused_imports)]
-+#![allow(unused_attributes)]
- use super::MaskElement;
- use crate::simd::{LaneCount, Simd, SupportedLaneCount};
- use core::marker::PhantomData;

diff --git a/dev-lang/rust/rust-1.74.1-r101.ebuild 
b/dev-lang/rust/rust-1.74.1-r101.ebuild
index 67485149b4d6..4e70d311fb46 100644
--- a/dev-lang/rust/rust-1.74.1-r101.ebuild
+++ b/dev-lang/rust/rust-1.74.1-r101.ebuild
@@ -6,6 +6,8 @@ EAPI=8
 LLVM_COMPAT=( 17 )
 PYTHON_COMPAT=( python3_{10..12} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 RUST_OPTIONAL=1
@@ -16,27 +18,38 @@ MRUSTC_RUST_VERSION="1.74.0"
 inherit check-reqs cmake edo estack flag-o-matic llvm-r1 multiprocessing 
multilib multilib-build \
        optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Language empowering everyone to build reliable and efficient 
software"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -151,16 +164,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.62.1-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -251,6 +254,9 @@ pkg_setup() {
 }
 
 src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
        default
        # We'll need to revert this after the bootstrap.
        if use mrustc-bootstrap; then

diff --git a/dev-lang/rust/rust-1.75.0-r101.ebuild 
b/dev-lang/rust/rust-1.75.0-r101.ebuild
index 3690aea32f0a..891a4c2ebca7 100644
--- a/dev-lang/rust/rust-1.75.0-r101.ebuild
+++ b/dev-lang/rust/rust-1.75.0-r101.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 17 )
 PYTHON_COMPAT=( python3_{10..12} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib 
multilib-build \
        optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Language empowering everyone to build reliable and efficient 
software"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,17 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-       "${FILESDIR}"/1.75.0-handle-vendored-sources.patch
-       "${FILESDIR}"/1.75.0-musl-dynamic-linking.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -229,6 +232,14 @@ pkg_setup() {
        fi
 }
 
+src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+
+       default
+}
+
 src_configure() {
        if tc-is-cross-compiler; then
                export PKG_CONFIG_ALLOW_CROSS=1

diff --git a/dev-lang/rust/rust-1.76.0-r101.ebuild 
b/dev-lang/rust/rust-1.76.0-r101.ebuild
index e0094a404e2c..3c3120985cb2 100644
--- a/dev-lang/rust/rust-1.76.0-r101.ebuild
+++ b/dev-lang/rust/rust-1.76.0-r101.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 17 )
 PYTHON_COMPAT=( python3_{10..12} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib 
multilib-build \
        optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,18 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-       "${FILESDIR}"/1.75.0-handle-vendored-sources.patch
-       "${FILESDIR}"/1.75.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.76.0-loong-code-model.patch  # remove for >=1.78.0
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -230,6 +232,13 @@ pkg_setup() {
        fi
 }
 
+src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+       default
+}
+
 src_configure() {
        if tc-is-cross-compiler; then
                export PKG_CONFIG_ALLOW_CROSS=1

diff --git a/dev-lang/rust/rust-1.77.1-r101.ebuild 
b/dev-lang/rust/rust-1.77.1-r101.ebuild
index d3a88f3f17e8..1c8c1002540f 100644
--- a/dev-lang/rust/rust-1.77.1-r101.ebuild
+++ b/dev-lang/rust/rust-1.77.1-r101.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 17 )
 PYTHON_COMPAT=( python3_{10..12} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib 
multilib-build \
        optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,17 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-       "${FILESDIR}"/1.75.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.76.0-loong-code-model.patch  # remove for >=1.78.0
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -229,6 +232,13 @@ pkg_setup() {
        fi
 }
 
+src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+       default
+}
+
 src_configure() {
        if tc-is-cross-compiler; then
                export PKG_CONFIG_ALLOW_CROSS=1

diff --git a/dev-lang/rust/rust-1.78.0-r101.ebuild 
b/dev-lang/rust/rust-1.78.0-r101.ebuild
index adc1ab036c79..37204338929f 100644
--- a/dev-lang/rust/rust-1.78.0-r101.ebuild
+++ b/dev-lang/rust/rust-1.78.0-r101.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 18 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib 
multilib-build \
        optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,17 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-       "${FILESDIR}"/1.78.0-ignore-broken-and-non-applicable-tests.patch
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.79.0-revert-8c40426.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -229,6 +232,13 @@ pkg_setup() {
        fi
 }
 
+src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+       default
+}
+
 src_configure() {
        if tc-is-cross-compiler; then
                export PKG_CONFIG_ALLOW_CROSS=1

diff --git a/dev-lang/rust/rust-1.79.0-r101.ebuild 
b/dev-lang/rust/rust-1.79.0-r101.ebuild
index 8a61200fdcd4..4f49ec4f88a6 100644
--- a/dev-lang/rust/rust-1.79.0-r101.ebuild
+++ b/dev-lang/rust/rust-1.79.0-r101.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 18 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib 
multilib-build \
        optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,17 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-       "${FILESDIR}"/1.78.0-ignore-broken-and-non-applicable-tests.patch
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.79.0-revert-8c40426.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -229,6 +232,13 @@ pkg_setup() {
        fi
 }
 
+src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+       default
+}
+
 src_configure() {
        if tc-is-cross-compiler; then
                export PKG_CONFIG_ALLOW_CROSS=1

diff --git a/dev-lang/rust/rust-1.80.1-r101.ebuild 
b/dev-lang/rust/rust-1.80.1-r101.ebuild
index e871cf82359f..9b16c81739c1 100644
--- a/dev-lang/rust/rust-1.80.1-r101.ebuild
+++ b/dev-lang/rust/rust-1.80.1-r101.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 18 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib 
multilib-build \
        optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,16 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.79.0-revert-8c40426.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -228,6 +232,13 @@ pkg_setup() {
        fi
 }
 
+src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+       default
+}
+
 src_configure() {
        if tc-is-cross-compiler; then
                export PKG_CONFIG_ALLOW_CROSS=1

diff --git a/dev-lang/rust/rust-1.81.0-r101.ebuild 
b/dev-lang/rust/rust-1.81.0-r101.ebuild
index 7534c71c5151..359ef4db4049 100644
--- a/dev-lang/rust/rust-1.81.0-r101.ebuild
+++ b/dev-lang/rust/rust-1.81.0-r101.ebuild
@@ -6,20 +6,40 @@ EAPI=8
 LLVM_COMPAT=( 18 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
        multilib multilib-build python-any-r1 rust rust-toolchain 
toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
 fi
 
@@ -27,12 +47,6 @@ RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).1"
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -141,16 +155,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.79.0-revert-8c40426.patch
-       "${FILESDIR}/1.81.0-backport-bug937164.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
-       "${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -229,6 +233,13 @@ pkg_setup() {
        fi
 }
 
+src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+       default
+}
+
 src_configure() {
        if tc-is-cross-compiler; then
                export PKG_CONFIG_ALLOW_CROSS=1

diff --git a/dev-lang/rust/rust-1.82.0-r103.ebuild 
b/dev-lang/rust/rust-1.82.0-r103.ebuild
index 96715a562188..f154dcdc02fc 100644
--- a/dev-lang/rust/rust-1.82.0-r103.ebuild
+++ b/dev-lang/rust/rust-1.82.0-r103.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 19 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
        multilib multilib-build python-any-r1 rust rust-toolchain 
toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,13 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.74.1-cross-compile-libz.patch
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.82.0-dwarf-llvm-assertion.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -226,6 +233,9 @@ pkg_setup() {
 }
 
 src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
 
        default
 }

diff --git a/dev-lang/rust/rust-1.83.0-r3.ebuild 
b/dev-lang/rust/rust-1.83.0-r3.ebuild
index 6b9a50d31c79..736656dc0131 100644
--- a/dev-lang/rust/rust-1.83.0-r3.ebuild
+++ b/dev-lang/rust/rust-1.83.0-r3.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 19 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
        multilib multilib-build python-any-r1 rust rust-toolchain 
toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -140,13 +154,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.83.0-cross-compile-libz.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.83.0-dwarf-llvm-assertion.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -226,6 +233,9 @@ pkg_setup() {
 }
 
 src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
 
        default
 }

diff --git a/dev-lang/rust/rust-1.84.0-r2.ebuild 
b/dev-lang/rust/rust-1.84.0-r2.ebuild
index 9b974070b81f..2b23b59e2c5c 100644
--- a/dev-lang/rust/rust-1.84.0-r2.ebuild
+++ b/dev-lang/rust/rust-1.84.0-r2.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 19 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
        multilib multilib-build python-any-r1 rust rust-toolchain 
toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc 
~x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -146,12 +160,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.83.0-cross-compile-libz.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -231,6 +239,10 @@ pkg_setup() {
 }
 
 src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+
        if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
                export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
        fi

diff --git a/dev-lang/rust/rust-1.84.1-r2.ebuild 
b/dev-lang/rust/rust-1.84.1-r2.ebuild
index a79e51dfd654..4cd383929c72 100644
--- a/dev-lang/rust/rust-1.84.1-r2.ebuild
+++ b/dev-lang/rust/rust-1.84.1-r2.ebuild
@@ -6,32 +6,46 @@ EAPI=8
 LLVM_COMPAT=( 19 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV}
 RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
 
 inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
        multilib multilib-build python-any-r1 rust rust-toolchain 
toolchain-funcs verify-sig
 
-if [[ ${PV} = *beta* ]]; then
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/rust-lang/rust.git";
+       EGIT_SUBMODULES=(
+               "*"
+               "-src/gcc"
+       )
+elif [[ ${PV} == *beta* ]]; then
+       # Identify the snapshot date of the beta release:
+       # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep 
beta-src.tar.xz
        betaver=${PV//*beta}
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
-       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
+       
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
+                       -> rustc-${PV}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
 else
        MY_P="rustc-${PV}"
-       SRC="${MY_P}-src.tar.xz"
+       SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
+               verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
+       "
+       S="${WORKDIR}/${MY_P}-src"
        KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
 fi
 
 DESCRIPTION="Systems programming language from Mozilla"
 HOMEPAGE="https://www.rust-lang.org/";
 
-SRC_URI="
-       https://static.rust-lang.org/dist/${SRC}
-       verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
-"
-S="${WORKDIR}/${MY_P}-src"
-
 # keep in sync with llvm ebuild of the same version as bundled one.
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
        LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@@ -146,13 +160,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.83.0-cross-compile-libz.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.84.1-fix-cross.patch # already upstreamed
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -232,6 +239,10 @@ pkg_setup() {
 }
 
 src_prepare() {
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+
        if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
                export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
        fi

diff --git a/dev-lang/rust/rust-1.85.0-r2.ebuild 
b/dev-lang/rust/rust-1.85.0-r2.ebuild
index 0ae50344ef14..7df54a40c3b6 100644
--- a/dev-lang/rust/rust-1.85.0-r2.ebuild
+++ b/dev-lang/rust/rust-1.85.0-r2.ebuild
@@ -6,6 +6,8 @@ EAPI=8
 LLVM_COMPAT=( 19 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV%%_*}
 if [[ ${PV} == *9999* ]]; then
        RUST_MIN_VER="1.85.0" # Update this as new `beta` releases come out.
@@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
        
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
                        -> rustc-${PV}-src.tar.xz.asc )
        "
@@ -44,6 +47,7 @@ elif [[ ${PV} == *beta* ]]; then
 else
        MY_P="rustc-${PV}"
        SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
        "
        S="${WORKDIR}/${MY_P}-src"
@@ -170,12 +174,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.85.0-cross-compile-libz.patch
-       "${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -301,9 +299,13 @@ pkg_setup() {
 src_prepare() {
        if [[ ${PV} = *9999* ]]; then
                # We need to update / generate lockfiles for the workspace
-               ${CARGO} generate-lockfile --offline
+               ${CARGO} generate-lockfile --offline || die "Failed to generate 
lockfiles"
        fi
 
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+
        if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
                export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
        fi

diff --git a/dev-lang/rust/rust-1.85.1-r1.ebuild 
b/dev-lang/rust/rust-1.85.1-r1.ebuild
index e2221c52726d..17189a56db43 100644
--- a/dev-lang/rust/rust-1.85.1-r1.ebuild
+++ b/dev-lang/rust/rust-1.85.1-r1.ebuild
@@ -6,6 +6,8 @@ EAPI=8
 LLVM_COMPAT=( 19 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV%%_*}
 if [[ ${PV} == *9999* ]]; then
        RUST_MIN_VER="1.85.0" # Update this as new `beta` releases come out.
@@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
        
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
                        -> rustc-${PV}-src.tar.xz.asc )
        "
@@ -44,6 +47,7 @@ elif [[ ${PV} == *beta* ]]; then
 else
        MY_P="rustc-${PV}"
        SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
        "
        S="${WORKDIR}/${MY_P}-src"
@@ -170,12 +174,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.85.0-cross-compile-libz.patch
-       "${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -301,9 +299,13 @@ pkg_setup() {
 src_prepare() {
        if [[ ${PV} = *9999* ]]; then
                # We need to update / generate lockfiles for the workspace
-               ${CARGO} generate-lockfile --offline
+               ${CARGO} generate-lockfile --offline || die "Failed to generate 
lockfiles"
        fi
 
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+
        if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
                export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
        fi

diff --git a/dev-lang/rust/rust-1.86.0-r2.ebuild 
b/dev-lang/rust/rust-1.86.0-r2.ebuild
index 8edc7bf68253..1c2a241fe42c 100644
--- a/dev-lang/rust/rust-1.86.0-r2.ebuild
+++ b/dev-lang/rust/rust-1.86.0-r2.ebuild
@@ -6,6 +6,8 @@ EAPI=8
 LLVM_COMPAT=( 19 )
 PYTHON_COMPAT=( python3_{10..13} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV%%_*}
 if [[ ${PV} == *9999* ]]; then
        RUST_MIN_VER="1.85.0" # Update this as new `beta` releases come out.
@@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
        
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
                        -> rustc-${PV}-src.tar.xz.asc )
        "
@@ -44,6 +47,7 @@ elif [[ ${PV} == *beta* ]]; then
 else
        MY_P="rustc-${PV}"
        SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
        "
        S="${WORKDIR}/${MY_P}-src"
@@ -171,13 +175,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.85.0-cross-compile-libz.patch
-       "${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.86.0-znver.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -303,9 +300,13 @@ pkg_setup() {
 src_prepare() {
        if [[ ${PV} = *9999* ]]; then
                # We need to update / generate lockfiles for the workspace
-               ${CARGO} generate-lockfile --offline
+               ${CARGO} generate-lockfile --offline || die "Failed to generate 
lockfiles"
        fi
 
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+
        if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
                export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
        fi

diff --git a/dev-lang/rust/rust-1.87.0-r1.ebuild 
b/dev-lang/rust/rust-1.87.0-r1.ebuild
index 4fac672978bc..24dde5d5164b 100644
--- a/dev-lang/rust/rust-1.87.0-r1.ebuild
+++ b/dev-lang/rust/rust-1.87.0-r1.ebuild
@@ -6,6 +6,8 @@ EAPI=8
 LLVM_COMPAT=( 20 )
 PYTHON_COMPAT=( python3_{11..14} )
 
+RUST_PATCH_VER=${PVR}
+
 RUST_MAX_VER=${PV%%_*}
 if [[ ${PV} == *9999* ]]; then
        RUST_MIN_VER="1.85.0" # Update this as new `beta` releases come out.
@@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
        BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
        MY_P="rustc-beta"
        
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz
 -> rustc-${PV}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
                        -> rustc-${PV}-src.tar.xz.asc )
        "
@@ -44,6 +47,7 @@ elif [[ ${PV} == *beta* ]]; then
 else
        MY_P="rustc-${PV}"
        SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
+               
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
                verify-sig? ( 
https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
        "
        S="${WORKDIR}/${MY_P}-src"
@@ -172,13 +176,6 @@ RESTRICT="test"
 
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
 
-PATCHES=(
-       "${FILESDIR}"/1.85.0-cross-compile-libz.patch
-       "${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
-       "${FILESDIR}"/1.67.0-doc-wasm.patch
-       "${FILESDIR}"/1.87.0-znver.patch
-)
-
 clear_vendor_checksums() {
        sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || 
die
 }
@@ -304,9 +301,13 @@ pkg_setup() {
 src_prepare() {
        if [[ ${PV} = *9999* ]]; then
                # We need to update / generate lockfiles for the workspace
-               ${CARGO} generate-lockfile --offline
+               ${CARGO} generate-lockfile --offline || die "Failed to generate 
lockfiles"
        fi
 
+       PATCHES=(
+               "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
+       )
+
        if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
                export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
        fi

Reply via email to