Subject: [bug#78688] [PATCH rust-team 1/3] gnu: rust and rust-bootstrap packages: Use gexps.

From: Morgan Smith <[email-masked]>
Date: Tue, 3 Jun 2025 22:13:21 -0400

* gnu/packages/rust.scm
(rust-bootstrapped-package): Use correct package name now that custom labels
are removed.
(rust-bootstrap-1.54): Use gexps.  Remove labels from native-inputs.
(rust-1.55): Use gexps.  Remove labels from inputs and native-inputs.
(rust-1.56, rust-1.59, rust-1.64, rust-1.65, rust-1.74): Use gexps.
(rust-1.75): Use gexps.  Use correct package name now that custom labels
are removed.
(rust-1.76, rust-1.77, rust-1.82, rust-1.83) Use gexps.
(rust): Use gexps.  Remove labels from inputs and native-inputs.

Change-Id: Ifc046388b251ea3db19e5b509fe04da372a529b9
---
 gnu/packages/rust.scm | 1314 +++++++++++++++++++++--------------------
 1 file changed, 658 insertions(+), 656 deletions(-)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index c24b771405..2130322942 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -127,8 +127,8 @@ (define* (rust-bootstrapped-package base-rust version checksum)
         (list base-rust))))
     (native-inputs
      (modify-inputs (package-native-inputs base-rust)
-       (replace "rustc-bootstrap" base-rust)
-       (replace "cargo-bootstrap" (list base-rust "cargo"))))))
+       (replace "rust" base-rust)
+       (replace "rust:cargo" (list base-rust "cargo"))))))
 
 ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed
 ;;; to be used in source form.
@@ -203,132 +203,133 @@ (define-public rust-bootstrap-1.54
            openssl-1.1
            zlib))
     (native-inputs
-     `(("pkg-config" ,pkg-config)
-       ("mrustc-source" ,%mrustc-source)))
+     (list pkg-config %mrustc-source))
     (arguments
-     `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
-       #:modules ((guix build cargo-utils)
+     (list
+      #:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
+      #:modules '((guix build cargo-utils)
                   (guix build utils)
                   (guix build gnu-build-system))
-       #:test-target "test"
-       ;; Rust's own .so library files are not found in any RUNPATH, but
-       ;; that doesn't seem to cause issues.
-       #:validate-runpath? #f
-       #:make-flags
-       ,#~(let ((source #$(package-source this-package)))
-            (list (string-append "RUSTC_TARGET="
-                                 #$(platform-rust-target
-                                     (lookup-platform-by-target-or-system
-                                       (or (%current-target-system)
-                                           (%current-system)))))
-                  (string-append "RUSTC_VERSION=" #$version)
-                  (string-append "MRUSTC_TARGET_VER="
-                                 #$(version-major+minor version))
-                  (string-append "RUSTC_SRC_TARBALL=" source)
-                  "OUTDIR_SUF="))       ;do not add version suffix to output dir
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'unpack
-           (lambda* (#:key source inputs #:allow-other-keys)
-             ((assoc-ref %standard-phases 'unpack)
-              #:source (assoc-ref inputs "mrustc-source"))))
-         (add-after 'unpack 'patch-makefiles
-           ;; This disables building the (unbundled) LLVM.
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* '("minicargo.mk"
-                            "run_rustc/Makefile")
-               ;; Use the system-provided LLVM.
-               (("LLVM_CONFIG [:|?]= .*")
-                (string-append "LLVM_CONFIG := "
-                               (search-input-file inputs "/bin/llvm-config") "\n")))
-             (substitute* "Makefile"
-               ;; Patch date and git obtained version information.
-               ((" -D VERSION_GIT_FULLHASH=.*")
-                (string-append
-                 " -D VERSION_GIT_FULLHASH=\\\"" ,%mrustc-commit "\\\""
-                 " -D VERSION_GIT_BRANCH=\\\"master\\\""
-                 " -D VERSION_GIT_SHORTHASH=\\\""
-                 ,(string-take %mrustc-commit 7) "\\\""
-                 " -D VERSION_BUILDTIME="
-                 "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
-                 " -D VERSION_GIT_ISDIRTY=0\n")))
-             (substitute* '("run_rustc/Makefile"
-                            "run_rustc/rustc_proxy.sh")
-               ;; Patch the shebang of a generated wrapper for rustc
-               (("#!/bin/sh")
-                (string-append "#!" (which "sh"))))))
-         (add-before 'configure 'configure-cargo-home
-           (lambda _
-             (let ((cargo-home (string-append (getcwd) "/.cargo")))
-               (mkdir-p cargo-home)
-               (setenv "CARGO_HOME" cargo-home))))
-         (replace 'configure
-           (lambda _
-             (setenv "CC" "gcc")
-             (setenv "CXX" "g++")
-             ;; The Guix LLVM package installs only shared libraries.
-             (setenv "LLVM_LINK_SHARED" "1")
-             ;; rustc still insists on having 'cc' on PATH in some places
-             ;; (e.g. when building the 'test' library crate).
-             (mkdir-p "/tmp/bin")
-             (symlink (which "gcc") "/tmp/bin/cc")
-             (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
-         (delete 'patch-generated-file-shebangs)
-         (replace 'build
-           (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
-             (let ((job-count (if parallel-build?
-                                  (parallel-job-count)
-                                  1)))
-               ;; Adapted from:
-               ;; https://github.com/dtolnay/bootstrap/blob/master/build-1.54.0.sh.
-               ;; Use PARLEVEL since both minicargo and mrustc use it
-               ;; to set the level of parallelism.
-               (setenv "PARLEVEL" (number->string job-count))
-               (display "Building mrustc...\n")
-               (apply invoke "make" make-flags)
+      #:test-target "test"
+      ;; Rust's own .so library files are not found in any RUNPATH, but
+      ;; that doesn't seem to cause issues.
+      #:validate-runpath? #f
+      #:make-flags
+      #~(let ((source #$(package-source this-package)))
+          (list (string-append "RUSTC_TARGET="
+                               #$(platform-rust-target
+                                  (lookup-platform-by-target-or-system
+                                   (or (%current-target-system)
+                                       (%current-system)))))
+                (string-append "RUSTC_VERSION=" #$version)
+                (string-append "MRUSTC_TARGET_VER="
+                               #$(version-major+minor version))
+                (string-append "RUSTC_SRC_TARBALL=" source)
+                "OUTDIR_SUF="))       ;do not add version suffix to output dir
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'unpack
+            (lambda* (#:key source inputs #:allow-other-keys)
+              ((assoc-ref %standard-phases 'unpack)
+               #:source #$(this-package-native-input
+                           (origin-file-name %mrustc-source)))))
+          (add-after 'unpack 'patch-makefiles
+            ;; This disables building the (unbundled) LLVM.
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* '("minicargo.mk"
+                             "run_rustc/Makefile")
+                ;; Use the system-provided LLVM.
+                (("LLVM_CONFIG [:|?]= .*")
+                 (string-append "LLVM_CONFIG := "
+                                (search-input-file inputs "/bin/llvm-config") "\n")))
+              (substitute* "Makefile"
+                ;; Patch date and git obtained version information.
+                ((" -D VERSION_GIT_FULLHASH=.*")
+                 (string-append
+                  " -D VERSION_GIT_FULLHASH=\\\"" #$%mrustc-commit "\\\""
+                  " -D VERSION_GIT_BRANCH=\\\"master\\\""
+                  " -D VERSION_GIT_SHORTHASH=\\\""
+                  #$(string-take %mrustc-commit 7) "\\\""
+                  " -D VERSION_BUILDTIME="
+                  "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
+                  " -D VERSION_GIT_ISDIRTY=0\n")))
+              (substitute* '("run_rustc/Makefile"
+                             "run_rustc/rustc_proxy.sh")
+                ;; Patch the shebang of a generated wrapper for rustc
+                (("#!/bin/sh")
+                 (string-append "#!" (which "sh"))))))
+          (add-before 'configure 'configure-cargo-home
+            (lambda _
+              (let ((cargo-home (string-append (getcwd) "/.cargo")))
+                (mkdir-p cargo-home)
+                (setenv "CARGO_HOME" cargo-home))))
+          (replace 'configure
+            (lambda _
+              (setenv "CC" "gcc")
+              (setenv "CXX" "g++")
+              ;; The Guix LLVM package installs only shared libraries.
+              (setenv "LLVM_LINK_SHARED" "1")
+              ;; rustc still insists on having 'cc' on PATH in some places
+              ;; (e.g. when building the 'test' library crate).
+              (mkdir-p "/tmp/bin")
+              (symlink (which "gcc") "/tmp/bin/cc")
+              (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
+          (delete 'patch-generated-file-shebangs)
+          (replace 'build
+            (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
+              (let ((job-count (if parallel-build?
+                                   (parallel-job-count)
+                                   1)))
+                ;; Adapted from:
+                ;; https://github.com/dtolnay/bootstrap/blob/master/build-1.54.0.sh.
+                ;; Use PARLEVEL since both minicargo and mrustc use it
+                ;; to set the level of parallelism.
+                (setenv "PARLEVEL" (number->string job-count))
+                (display "Building mrustc...\n")
+                (apply invoke "make" make-flags)
 
-               ;; This doesn't seem to build anything, but it
-               ;; sets additional minicargo flags.
-               (display "Building RUSTCSRC...\n")
-               (apply invoke "make" "RUSTCSRC" make-flags)
+                ;; This doesn't seem to build anything, but it
+                ;; sets additional minicargo flags.
+                (display "Building RUSTCSRC...\n")
+                (apply invoke "make" "RUSTCSRC" make-flags)
 
-               ;; This probably doesn't need to be called explicitly.
-               (display "Building LIBS...\n")
-               (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
+                ;; This probably doesn't need to be called explicitly.
+                (display "Building LIBS...\n")
+                (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
 
-               ;; The psm crate FTBFS on ppc64le with gcc.
-               (display "Building rustc...\n")
-               (apply invoke "make" "-f" "minicargo.mk" "output/rustc"
-                      make-flags)
+                ;; The psm crate FTBFS on ppc64le with gcc.
+                (display "Building rustc...\n")
+                (apply invoke "make" "-f" "minicargo.mk" "output/rustc"
+                       make-flags)
 
-               (display "Building cargo...\n")
-               (apply invoke "make" "-f" "minicargo.mk" "output/cargo"
-                      make-flags)
+                (display "Building cargo...\n")
+                (apply invoke "make" "-f" "minicargo.mk" "output/cargo"
+                       make-flags)
 
-               ;; This one isn't listed in the build script.
-               (display "Rebuilding stdlib with rustc...\n")
-               (apply invoke "make" "-C" "run_rustc" make-flags))))
-         (replace 'install
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (cargo (assoc-ref outputs "cargo"))
-                    (bin (string-append out "/bin"))
-                    (rustc (string-append bin "/rustc"))
-                    (cargo-bin (string-append cargo "/bin"))
-                    (lib (string-append out "/lib"))
-                    (system-lib-prefix
+                ;; This one isn't listed in the build script.
+                (display "Rebuilding stdlib with rustc...\n")
+                (apply invoke "make" "-C" "run_rustc" make-flags))))
+          (replace 'install
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (cargo (assoc-ref outputs "cargo"))
+                     (bin (string-append out "/bin"))
+                     (rustc (string-append bin "/rustc"))
+                     (cargo-bin (string-append cargo "/bin"))
+                     (lib (string-append out "/lib"))
+                     (system-lib-prefix
                       (string-append lib "/rustlib/"
-                                     ,(platform-rust-target
+                                     #$(platform-rust-target
                                         (lookup-platform-by-target-or-system
-                                          (or (%current-target-system)
-                                              (%current-system)))) "/lib")))
-               (mkdir-p (dirname rustc))
-               (copy-file "run_rustc/output/prefix/bin/rustc_binary" rustc)
-               (wrap-program rustc
-                 `("LD_LIBRARY_PATH" = (,system-lib-prefix)))
-               (mkdir-p lib)
-               (copy-recursively "run_rustc/output/prefix/lib" lib)
-               (install-file "run_rustc/output/prefix/bin/cargo" cargo-bin)))))))
+                                         (or (%current-target-system)
+                                             (%current-system)))) "/lib")))
+                (mkdir-p (dirname rustc))
+                (copy-file "run_rustc/output/prefix/bin/rustc_binary" rustc)
+                (wrap-program rustc
+                  `("LD_LIBRARY_PATH" = (,system-lib-prefix)))
+                (mkdir-p lib)
+                (copy-recursively "run_rustc/output/prefix/lib" lib)
+                (install-file "run_rustc/output/prefix/bin/cargo" cargo-bin)))))))
     (synopsis "Compiler for the Rust programming language")
     (description "Rust is a systems programming language that provides memory
 safety and thread safety guarantees.")
@@ -558,53 +559,54 @@ (define-public rust-1.55
                   (max-silent-time . 18000))) ;5 hours (for armel)
     (build-system gnu-build-system)
     (arguments
-     `(#:validate-runpath? #f
-       ;; Only the final Rust is tested, not the intermediate bootstrap ones,
-       ;; for performance and simplicity.
-       #:tests? #f
-       #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
-       #:modules ((guix build cargo-utils)
+     (list
+      #:validate-runpath? #f
+      ;; Only the final Rust is tested, not the intermediate bootstrap ones,
+      ;; for performance and simplicity.
+      #:tests? #f
+      #:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
+      #:modules '((guix build cargo-utils)
                   (guix build utils)
                   (guix build gnu-build-system)
                   (ice-9 match)
                   (srfi srfi-1))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'set-env
-           (lambda* (#:key inputs #:allow-other-keys)
-             (setenv "SHELL" (which "sh"))
-             (setenv "CONFIG_SHELL" (which "sh"))
-             (setenv "CC" (search-input-file inputs "/bin/gcc"))
-             ;; The Guix LLVM package installs only shared libraries.
-             (setenv "LLVM_LINK_SHARED" "1")))
-         (add-after 'unpack 'set-linker-locale-to-utf8
-           (lambda _
-             (substitute* (find-files "." "^linker.rs$")
-               (("linker.env\\(\"LC_ALL\", \"C\"\\);")
-                "linker.env(\"LC_ALL\", \"C.UTF-8\");"))))
-         (add-after 'unpack 'add-cc-shim-to-path
-           (lambda _
-             (mkdir-p "/tmp/bin")
-             (symlink (which "gcc") "/tmp/bin/cc")
-             (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
-         (replace 'configure
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (gcc (assoc-ref inputs "gcc"))
-                    (python (assoc-ref inputs "python"))
-                    (binutils (assoc-ref inputs "binutils"))
-                    (rustc (assoc-ref inputs "rustc-bootstrap"))
-                    (cargo (assoc-ref inputs "cargo-bootstrap"))
-                    (llvm (assoc-ref inputs "llvm")))
-               (call-with-output-file "config.toml"
-                 (lambda (port)
-                   (display (string-append "
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'set-env
+            (lambda* (#:key inputs #:allow-other-keys)
+              (setenv "SHELL" (which "sh"))
+              (setenv "CONFIG_SHELL" (which "sh"))
+              (setenv "CC" (search-input-file inputs "/bin/gcc"))
+              ;; The Guix LLVM package installs only shared libraries.
+              (setenv "LLVM_LINK_SHARED" "1")))
+          (add-after 'unpack 'set-linker-locale-to-utf8
+            (lambda _
+              (substitute* (find-files "." "^linker.rs$")
+                (("linker.env\\(\"LC_ALL\", \"C\"\\);")
+                 "linker.env(\"LC_ALL\", \"C.UTF-8\");"))))
+          (add-after 'unpack 'add-cc-shim-to-path
+            (lambda _
+              (mkdir-p "/tmp/bin")
+              (symlink (which "gcc") "/tmp/bin/cc")
+              (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
+          (replace 'configure
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (gcc (assoc-ref inputs "gcc"))
+                     (python (search-input-file inputs "/bin/python"))
+                     (binutils (assoc-ref inputs "binutils"))
+                     (rustc (search-input-file inputs "/bin/rustc"))
+                     (cargo (search-input-file inputs "/bin/cargo"))
+                     (llvm (assoc-ref inputs "llvm")))
+                (call-with-output-file "config.toml"
+                  (lambda (port)
+                    (display (string-append "
 [llvm]
 [build]
-cargo = \"" cargo "/bin/cargo" "\"
-rustc = \"" rustc "/bin/rustc" "\"
+cargo = \"" cargo "\"
+rustc = \"" rustc "\"
 docs = false
-python = \"" python "/bin/python" "\"
+python = \"" python "\"
 vendor = true
 submodules = false
 [install]
@@ -616,72 +618,71 @@ (define-public rust-1.55
 default-linker = \"" gcc "/bin/gcc" "\"
 channel = \"stable\"
 rpath = true
-[target." ,(platform-rust-target (lookup-platform-by-system (%current-system))) "]
+[target." #$(platform-rust-target (lookup-platform-by-system (%current-system))) "]
 llvm-config = \"" llvm "/bin/llvm-config" "\"
 cc = \"" gcc "/bin/gcc" "\"
 cxx = \"" gcc "/bin/g++" "\"
 ar = \"" binutils "/bin/ar" "\"
 [dist]
 ") port))))))
-         (replace 'build
-           ;; The standard library source location moved in this release.
-           (lambda* (#:key parallel-build? #:allow-other-keys)
-             (let ((job-spec (string-append
-                              "-j" (if parallel-build?
-                                       (number->string (parallel-job-count))
-                                       "1"))))
-               (invoke "./x.py" job-spec "build" "--stage=1"
-                       "library/std"
-                       "src/tools/cargo"))))
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (cargo-out (assoc-ref outputs "cargo"))
-                    (build (string-append "build/"
-                                          ,(platform-rust-target
-                                             (lookup-platform-by-target-or-system
+          (replace 'build
+            ;; The standard library source location moved in this release.
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (let ((job-spec (string-append
+                               "-j" (if parallel-build?
+                                        (number->string (parallel-job-count))
+                                        "1"))))
+                (invoke "./x.py" job-spec "build" "--stage=1"
+                        "library/std"
+                        "src/tools/cargo"))))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (cargo-out (assoc-ref outputs "cargo"))
+                     (build (string-append "build/"
+                                           #$(platform-rust-target
+                                              (lookup-platform-by-target-or-system
                                                (or (%current-target-system)
                                                    (%current-system)))))))
-               ;; Manually do the installation instead of calling './x.py
-               ;; install', as that is slow and needlessly rebuilds some
-               ;; things.
-               (install-file (string-append build "/stage1/bin/rustc")
-                             (string-append out "/bin"))
-               (copy-recursively (string-append build "/stage1/lib")
-                                 (string-append out "/lib"))
-               (install-file (string-append build "/stage1-tools-bin/cargo")
-                             (string-append cargo-out "/bin")))))
-         (add-after 'install 'delete-install-logs
-           (lambda* (#:key outputs #:allow-other-keys)
-             (for-each (lambda (f)
-                         (false-if-exception (delete-file f)))
-                       (append-map (lambda (output)
-                                     (find-files (string-append
-                                                  output "/lib/rustlib")
-                                                 "(^install.log$|^manifest-)"))
-                                   (map cdr outputs)))))
-         (add-after 'install 'wrap-rustc
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (libc (assoc-ref inputs "libc"))
-                   (ld-wrapper (assoc-ref inputs "ld-wrapper")))
-               ;; Let gcc find ld and libc startup files.
-               (wrap-program (string-append out "/bin/rustc")
-                 `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
-                 `("LIBRARY_PATH" ":"
-                   suffix (,(string-append libc "/lib"))))))))))
+                ;; Manually do the installation instead of calling './x.py
+                ;; install', as that is slow and needlessly rebuilds some
+                ;; things.
+                (install-file (string-append build "/stage1/bin/rustc")
+                              (string-append out "/bin"))
+                (copy-recursively (string-append build "/stage1/lib")
+                                  (string-append out "/lib"))
+                (install-file (string-append build "/stage1-tools-bin/cargo")
+                              (string-append cargo-out "/bin")))))
+          (add-after 'install 'delete-install-logs
+            (lambda* (#:key outputs #:allow-other-keys)
+              (for-each (lambda (f)
+                          (false-if-exception (delete-file f)))
+                        (append-map (lambda (output)
+                                      (find-files (string-append
+                                                   output "/lib/rustlib")
+                                                  "(^install.log$|^manifest-)"))
+                                    (map cdr outputs)))))
+          (add-after 'install 'wrap-rustc
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out"))
+                    (libc (assoc-ref inputs "libc"))
+                    (ld-wrapper (assoc-ref inputs "ld-wrapper")))
+                ;; Let gcc find ld and libc startup files.
+                (wrap-program (string-append out "/bin/rustc")
+                  `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
+                  `("LIBRARY_PATH" ":"
+                    suffix (,(string-append libc "/lib"))))))))))
     (native-inputs
-     `(("pkg-config" ,pkg-config)
-       ("python" ,python-minimal-wrapper)
-       ("rustc-bootstrap" ,rust-bootstrap-1.54)
-       ("cargo-bootstrap" ,rust-bootstrap-1.54 "cargo")))
+     (list
+      pkg-config
+      python-minimal-wrapper
+      rust-bootstrap-1.54
+      `(,rust-bootstrap-1.54 "cargo")))
     (inputs
-     `(("bash" ,bash-minimal)
-       ("llvm" ,llvm-13)
-       ("openssl" ,openssl)))
+     (list bash-minimal llvm-13 openssl))
     ;; rustc invokes gcc, so we need to set its search paths accordingly.
     (native-search-paths
-      %gcc-search-paths)
+     %gcc-search-paths)
     ;; Limit this to systems where the final rust compiler builds successfully.
     (supported-systems '("x86_64-linux" "aarch64-linux" "riscv64-linux"))
     (synopsis "Compiler for the Rust programming language")
@@ -699,17 +700,17 @@ (define-public rust-1.56
       (inherit base-rust)
       (arguments
        (substitute-keyword-arguments
-         (strip-keyword-arguments '(#:validate-runpath?)
-                                  (package-arguments base-rust))
+           (strip-keyword-arguments '(#:validate-runpath?)
+                                    (package-arguments base-rust))
          ((#:phases phases)
-          `(modify-phases ,phases
-             (delete 'add-cc-shim-to-path)
-             (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums
-               (lambda _
-                 (substitute* "Cargo.lock"
-                   (("(checksum = )\".*\"" all name)
-                    (string-append name "\"" ,%cargo-reference-hash "\"")))
-                 (generate-all-checksums "vendor"))))))))))
+          #~(modify-phases #$phases
+              (delete 'add-cc-shim-to-path)
+              (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums
+                (lambda _
+                  (substitute* "Cargo.lock"
+                    (("(checksum = )\".*\"" all name)
+                     (string-append name "\"" #$%cargo-reference-hash "\"")))
+                  (generate-all-checksums "vendor"))))))))))
 
 (define-public rust-1.57
   (rust-bootstrapped-package
@@ -729,31 +730,31 @@ (define-public rust-1.58
 
 (define-public rust-1.59
   (let ((base-rust
-          (rust-bootstrapped-package
-            ;; Verified that it *doesn't* build with 1.57. e.g.:
-            ;; * error: `doc(primitive)` should never have been stable
-            ;; * error[E0522]: definition of an unknown language item:
-            ;;   `generator_return`
-            ;; * error[E0206]: the trait `Copy` may not be implemented for this type
-            rust-1.58 "1.59.0" "1yc5bwcbmbwyvpfq7zvra78l0r8y3lbv60kbr62fzz2vx2pfxj57")))
+         (rust-bootstrapped-package
+          ;; Verified that it *doesn't* build with 1.57. e.g.:
+          ;; * error: `doc(primitive)` should never have been stable
+          ;; * error[E0522]: definition of an unknown language item:
+          ;;   `generator_return`
+          ;; * error[E0206]: the trait `Copy` may not be implemented for this type
+          rust-1.58 "1.59.0" "1yc5bwcbmbwyvpfq7zvra78l0r8y3lbv60kbr62fzz2vx2pfxj57")))
     (package
       (inherit base-rust)
-        (arguments
-         (if (target-riscv64?)
+      (arguments
+       (if (target-riscv64?)
            (substitute-keyword-arguments (package-arguments base-rust)
              ((#:phases phases)
-              `(modify-phases ,phases
-                 (add-after 'unpack 'revert-riscv-pause-instruction
-                   (lambda _
-                     ;; This fails with:
-                     ;; error: unknown directive, referring to '.insn'.
-                     ;; This is due to building with llvm < 14.
-                     ;; https://github.com/rust-lang/stdarch/issues/1291
-                     ;; Partial roll-back from this commit:
-                     ;; https://github.com/rust-lang/stdarch/pull/1271
-                     (substitute*
-                       "library/stdarch/crates/core_arch/src/riscv_shared/mod.rs"
-                       (("\\.insn i 0x0F, 0, x0, x0, 0x010") ".word 0x0100000F")))))))
+              #~(modify-phases #$phases
+                  (add-after 'unpack 'revert-riscv-pause-instruction
+                    (lambda _
+                      ;; This fails with:
+                      ;; error: unknown directive, referring to '.insn'.
+                      ;; This is due to building with llvm < 14.
+                      ;; https://github.com/rust-lang/stdarch/issues/1291
+                      ;; Partial roll-back from this commit:
+                      ;; https://github.com/rust-lang/stdarch/pull/1271
+                      (substitute*
+                          "library/stdarch/crates/core_arch/src/riscv_shared/mod.rs"
+                        (("\\.insn i 0x0F, 0, x0, x0, 0x010") ".word 0x0100000F")))))))
            (package-arguments base-rust))))))
 
 (define-public rust-1.60
@@ -828,15 +829,15 @@ (define-public rust-1.64
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
-          `(modify-phases ,phases
-             (replace 'patch-cargo-checksums
-               (lambda _
-                 (substitute* '("Cargo.lock"
-                                "src/bootstrap/Cargo.lock"
-                                "src/tools/rust-analyzer/Cargo.lock")
-                   (("(checksum = )\".*\"" all name)
-                    (string-append name "\"" ,%cargo-reference-hash "\"")))
-                 (generate-all-checksums "vendor"))))))))))
+          #~(modify-phases #$phases
+              (replace 'patch-cargo-checksums
+                (lambda _
+                  (substitute* '("Cargo.lock"
+                                 "src/bootstrap/Cargo.lock"
+                                 "src/tools/rust-analyzer/Cargo.lock")
+                    (("(checksum = )\".*\"" all name)
+                     (string-append name "\"" #$%cargo-reference-hash "\"")))
+                  (generate-all-checksums "vendor"))))))))))
 
 (define-public rust-1.65
   (let ((base-rust
@@ -983,15 +984,15 @@ (define-public rust-1.71
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
-          `(modify-phases ,phases
-             (replace 'patch-cargo-checksums
-               (lambda _
-                 (substitute* (cons* "Cargo.lock"
-                                     "src/bootstrap/Cargo.lock"
-                                     (find-files "src/tools" "Cargo.lock"))
-                   (("(checksum = )\".*\"" all name)
-                    (string-append name "\"" ,%cargo-reference-hash "\"")))
-                 (generate-all-checksums "vendor"))))))))))
+          #~(modify-phases #$phases
+              (replace 'patch-cargo-checksums
+                (lambda _
+                  (substitute* (cons* "Cargo.lock"
+                                      "src/bootstrap/Cargo.lock"
+                                      (find-files "src/tools" "Cargo.lock"))
+                    (("(checksum = )\".*\"" all name)
+                     (string-append name "\"" #$%cargo-reference-hash "\"")))
+                  (generate-all-checksums "vendor"))))))))))
 
 (define-public rust-1.72
   (let ((base-rust
@@ -1071,12 +1072,12 @@ (define-public rust-1.74
                 (string-append all ", \"use-libc\"")))))))
       (arguments
        (if (target-riscv64?)
-         (substitute-keyword-arguments (package-arguments base-rust)
-           ((#:phases phases)
-            `(modify-phases ,phases
-               ;; This phase is no longer needed.
-               (delete 'revert-riscv-pause-instruction))))
-         (package-arguments base-rust))))))
+           (substitute-keyword-arguments (package-arguments base-rust)
+             ((#:phases phases)
+              #~(modify-phases #$phases
+                  ;; This phase is no longer needed.
+                  (delete 'revert-riscv-pause-instruction))))
+           (package-arguments base-rust))))))
 
 (define-public rust-1.75
   (let ((base-rust (rust-bootstrapped-package rust-1.74 "1.75.0"
@@ -1091,18 +1092,18 @@ (define-public rust-1.75
        (if (supported-package? rust-bootstrap-1.74)
            (substitute-keyword-arguments (package-arguments base-rust)
              ((#:phases phases)
-              `(modify-phases ,phases
-                 (add-after 'unpack 'add-cc-shim-to-path
-                   (lambda _
-                     (mkdir-p "/tmp/bin")
-                     (symlink (which "gcc") "/tmp/bin/cc")
-                     (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))))))
+              #~(modify-phases #$phases
+                  (add-after 'unpack 'add-cc-shim-to-path
+                    (lambda _
+                      (mkdir-p "/tmp/bin")
+                      (symlink (which "gcc") "/tmp/bin/cc")
+                      (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))))))
            (package-arguments base-rust)))
       (native-inputs
        (if (supported-package? rust-bootstrap-1.74)
            (modify-inputs (package-native-inputs base-rust)
-             (replace "cargo-bootstrap" (list rust-bootstrap-1.74 "cargo"))
-             (replace "rustc-bootstrap" rust-bootstrap-1.74))
+             (replace "rust" rust-bootstrap-1.74)
+             (replace "rust:cargo" (list rust-bootstrap-1.74 "cargo")))
            (package-native-inputs base-rust)))
       (inputs (modify-inputs (package-inputs base-rust)
                 (replace "llvm" llvm-17))))))
@@ -1115,8 +1116,8 @@ (define-public rust-1.76
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
-          `(modify-phases ,phases
-             (delete 'add-cc-shim-to-path))))))))
+          #~(modify-phases #$phases
+              (delete 'add-cc-shim-to-path))))))))
 
 (define-public rust-1.77
   (let ((base-rust (rust-bootstrapped-package rust-1.76 "1.77.1"
@@ -1126,21 +1127,21 @@ (define-public rust-1.77
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
-          `(modify-phases ,phases
-             (add-after 'configure 'no-optimized-compiler-builtins
-               (lambda _
-                 ;; Pre-1.77, the behavior was equivalent to this flag being
-                 ;; "false" if the llvm-project submodule wasn't checked out.
-                 ;;
-                 ;; Now there's an explicit check, so the build fails if we don't
-                 ;; manually disable this (given that we don't have the submodule checked out).
-                 ;; Thus making the build behave the same as it did in 1.76 and earlier.
-                 ;;
-                 ;; TODO - make the build system depend on system llvm for this, so we
-                 ;; can get the performance benefits of setting this to true?
-                 (substitute* "config.toml"
-                   (("\\[build\\]")
-                    "[build]\noptimized-compiler-builtins = false")))))))))))
+          #~(modify-phases #$phases
+              (add-after 'configure 'no-optimized-compiler-builtins
+                (lambda _
+                  ;; Pre-1.77, the behavior was equivalent to this flag being
+                  ;; "false" if the llvm-project submodule wasn't checked out.
+                  ;;
+                  ;; Now there's an explicit check, so the build fails if we don't
+                  ;; manually disable this (given that we don't have the submodule checked out).
+                  ;; Thus making the build behave the same as it did in 1.76 and earlier.
+                  ;;
+                  ;; TODO - make the build system depend on system llvm for this, so we
+                  ;; can get the performance benefits of setting this to true?
+                  (substitute* "config.toml"
+                    (("\\[build\\]")
+                     "[build]\noptimized-compiler-builtins = false")))))))))))
 
 (define-public rust-1.78
   (let ((base-rust (rust-bootstrapped-package rust-1.77 "1.78.0"
@@ -1229,22 +1230,22 @@ (define-public rust-1.82
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
-          `(modify-phases ,phases
-             (replace 'patch-cargo-checksums
-               (lambda _
-                 (substitute* (cons* "Cargo.lock"
-                                     "src/bootstrap/Cargo.lock"
-                                     "library/Cargo.lock"
-                                     (filter
-                                      ;; Don't mess with the lock files in the
-                                      ;; Cargo testsuite; it messes up the tests.
-                                      (lambda (path)
-                                        (not (string-contains
+          #~(modify-phases #$phases
+              (replace 'patch-cargo-checksums
+                (lambda _
+                  (substitute* (cons* "Cargo.lock"
+                                      "src/bootstrap/Cargo.lock"
+                                      "library/Cargo.lock"
+                                      (filter
+                                       ;; Don't mess with the lock files in the
+                                       ;; Cargo testsuite; it messes up the tests.
+                                       (lambda (path)
+                                         (not (string-contains
                                                path "cargo/tests/testsuite")))
-                                      (find-files "src/tools" "Cargo.lock")))
-                   (("(checksum = )\".*\"" all name)
-                    (string-append name "\"" ,%cargo-reference-hash "\"")))
-                 (generate-all-checksums "vendor"))))))))))
+                                       (find-files "src/tools" "Cargo.lock")))
+                    (("(checksum = )\".*\"" all name)
+                     (string-append name "\"" #$%cargo-reference-hash "\"")))
+                  (generate-all-checksums "vendor"))))))))))
 
 (define-public rust-1.83
   (let ((base-rust (rust-bootstrapped-package rust-1.82 "1.83.0"
@@ -1277,15 +1278,15 @@ (define-public rust-1.83
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
-          `(modify-phases ,phases
-             (add-after 'configure 'use-system-llvm
-               (lambda _
-                 (substitute* "config.toml"
-                   (("\\[llvm\\]") "[llvm]\ndownload-ci-llvm = false")
-                   (("\\[rust\\]") "[rust]\ndownload-rustc = false"))))))))
+          #~(modify-phases #$phases
+              (add-after 'configure 'use-system-llvm
+                (lambda _
+                  (substitute* "config.toml"
+                    (("\\[llvm\\]") "[llvm]\ndownload-ci-llvm = false")
+                    (("\\[rust\\]") "[rust]\ndownload-rustc = false"))))))))
       ;; Need llvm >= 18.0
       (inputs (modify-inputs (package-inputs base-rust)
-                             (replace "llvm" llvm-19))))))
+                (replace "llvm" llvm-19))))))
 
 (define-public rust-1.84
   (rust-bootstrapped-package rust-1.83 "1.84.1"
@@ -1395,359 +1396,360 @@ (define-public rust
                 "3.14.0"))))))
       (arguments
        (substitute-keyword-arguments
-         (strip-keyword-arguments '(#:tests?)
-           (package-arguments base-rust))
+           (strip-keyword-arguments '(#:tests?)
+                                    (package-arguments base-rust))
          ((#:phases phases)
-          `(modify-phases ,phases
-             (add-after 'unpack 'relax-gdb-auto-load-safe-path
-               ;; Allow GDB to load binaries from any location, otherwise the
-               ;; gdbinfo tests fail.  This is only useful when testing with a
-               ;; GDB version newer than 8.2.
-               (lambda _
-                 (setenv "HOME" (getcwd))
-                 (with-output-to-file (string-append (getenv "HOME") "/.gdbinit")
-                   (lambda _
-                     (format #t "set auto-load safe-path /~%")))
-                 ;; Do not launch gdb with '-nx' which causes it to not execute
-                 ;; any init file.
-                 (substitute* "src/tools/compiletest/src/runtest.rs"
-                   (("\"-nx\".as_ref\\(\\), ")
-                    ""))))
-             (add-after 'unpack 'disable-tests-requiring-git
-               (lambda _
-                 (substitute* "src/tools/cargo/tests/testsuite/git.rs"
-                   ,@(make-ignore-test-list
-                      '("fn fetch_downloads_with_git2_first_"
-                        "fn corrupted_checkout_with_cli")))
-                 (substitute* "src/tools/cargo/tests/testsuite/build.rs"
-                   ,@(make-ignore-test-list
-                      '("fn build_with_symlink_to_path_dependency_with_build_script_in_git")))
-                 (substitute* "src/tools/cargo/tests/testsuite/publish_lockfile.rs"
-                   ,@(make-ignore-test-list
-                      '("fn note_resolve_changes")))))
-             (add-after 'unpack 'disable-tests-requiring-mercurial
-               (lambda _
-                 (with-directory-excursion "src/tools/cargo/tests/testsuite/cargo_init"
-                   (substitute* '("mercurial_autodetect/mod.rs"
-                                  "simple_hg_ignore_exists/mod.rs")
-                     ,@(make-ignore-test-list
-                        '("fn case"))))))
-             (add-after 'unpack 'disable-tests-using-cargo-publish
-               (lambda _
-                 (with-directory-excursion "src/tools/cargo/tests/testsuite"
-                   (substitute* "alt_registry.rs"
-                     ,@(make-ignore-test-list
-                        '("fn warn_for_unused_fields")))
-                   (substitute* '("cargo_add/locked_unchanged/mod.rs"
-                                  "cargo_add/lockfile_updated/mod.rs"
-                                  "cargo_remove/update_lock_file/mod.rs")
-                     ,@(make-ignore-test-list
-                        '("fn case")))
-                   (substitute* "git_shallow.rs"
-                     ,@(make-ignore-test-list
-                        '("fn gitoxide_clones_git_dependency_with_shallow_protocol_and_git2_is_used_for_followup_fetches"
-                          "fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again"
-                          "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_shallowness"
-                          "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_with_git2_fetch"
-                          "fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness"
-                          "fn gitoxide_shallow_clone_followed_by_non_shallow_update"
-                          "fn gitoxide_clones_shallow_two_revs_same_deps"
-                          "fn gitoxide_git_dependencies_switch_from_branch_to_rev"
-                          "fn shallow_deps_work_with_revisions_and_branches_mixed_on_same_dependency")))
-                   (substitute* "install.rs"
-                     ,@(make-ignore-test-list
-                        '("fn failed_install_retains_temp_directory")))
-                   (substitute* "offline.rs"
-                     ,@(make-ignore-test-list
-                        '("fn gitoxide_cargo_compile_offline_with_cached_git_dep_shallow_dep")))
-                   (substitute* "patch.rs"
-                     ,@(make-ignore-test-list
-                        '("fn gitoxide_clones_shallow_old_git_patch"))))))
-             ,@(if (target-riscv64?)
-                   ;; Keep this phase separate so it can be adjusted without needing
-                   ;; to adjust the skipped tests on other architectures.
-                   `((add-after 'unpack 'disable-tests-broken-on-riscv64
-                       (lambda _
-                         (with-directory-excursion "src/tools/cargo/tests/testsuite"
-                           (substitute* "build.rs"
-                             ,@(make-ignore-test-list
-                                 '("fn uplift_dwp_of_bin_on_linux")))
-                           (substitute* "cache_lock.rs"
-                             ,@(make-ignore-test-list
-                                 '("fn multiple_shared"
-                                   "fn multiple_download"
-                                   "fn download_then_mutate"
-                                   "fn mutate_err_is_atomic")))
-                           (substitute* "global_cache_tracker.rs"
-                             ,@(make-ignore-test-list
-                                 '("fn package_cache_lock_during_build"))))
-                         (with-directory-excursion "src/tools/clippy/tests"
-                           ;; `"vectorcall"` is not a supported ABI for the current target
-                           (delete-file "ui/missing_const_for_fn/could_be_const.rs")
-                           (substitute* "missing-test-files.rs"
-                             ,@(make-ignore-test-list
-                                '("fn test_missing_tests")))))))
-                   `())
-             ,@(if (target-aarch64?)
-                   ;; Keep this phase separate so it can be adjusted without needing
-                   ;; to adjust the skipped tests on other architectures.
-                   `((add-after 'unpack 'disable-tests-broken-on-aarch64
-                       (lambda _
-                         (with-directory-excursion "src/tools/cargo/tests/testsuite"
-                           (substitute* "build_script_extra_link_arg.rs"
-                             ,@(make-ignore-test-list
-                                '("fn build_script_extra_link_arg_bin_single")))
-                           (substitute* "build_script.rs"
-                             ,@(make-ignore-test-list
-                                '("fn env_test")))
-                           (substitute* "cache_lock.rs"
-                             ,@(make-ignore-test-list
-                                '("fn download_then_mutate")))
-                           (substitute* "collisions.rs"
-                             ,@(make-ignore-test-list
-                                '("fn collision_doc_profile_split")))
-                           (substitute* "concurrent.rs"
-                             ,@(make-ignore-test-list
-                                '("fn no_deadlock_with_git_dependencies")))
-                           (substitute* "features2.rs"
-                             ,@(make-ignore-test-list
-                                '("fn dep_with_optional_host_deps_activated"))))
-                         (with-directory-excursion "src/tools/clippy/tests"
-                           ;; `"vectorcall"` is not a supported ABI for the current target
-                           (delete-file "ui/missing_const_for_fn/could_be_const.rs")
-                           (substitute* "missing-test-files.rs"
-                             ,@(make-ignore-test-list
-                                '("fn test_missing_tests")))))))
-                   `())
-             (add-after 'unpack 'disable-tests-requiring-crates.io
-               (lambda _
-                 (with-directory-excursion "src/tools/cargo/tests/testsuite"
-                   (substitute* "install.rs"
-                     ,@(make-ignore-test-list
-                        '("fn install_global_cargo_config")))
-                   (substitute* '("cargo_add/normalize_name_path_existing/mod.rs"
-                                  "cargo_info/within_ws_with_alternative_registry/mod.rs")
-                     ,@(make-ignore-test-list
-                        '("fn case")))
-                   (substitute* "package.rs"
-                     ,@(make-ignore-test-list
-                        '("fn workspace_with_local_deps_index_mismatch"))))))
-             (add-after 'unpack 'disable-miscellaneous-broken-tests
-               (lambda _
-                 (substitute* "src/tools/cargo/tests/testsuite/check_cfg.rs"
-                   ;; These apparently get confused by the fact that
-                   ;; we're building in a directory containing the
-                   ;; string "rustc"
-                   ,@(make-ignore-test-list
-                      '("fn config_fingerprint"
-                        "fn features_fingerprint")))
-                 (substitute* "src/tools/cargo/tests/testsuite/git_auth.rs"
-                   ;; This checks for a specific networking error message
-                   ;; that's different from the one we see in the builder
-                   ,@(make-ignore-test-list
-                      '("fn net_err_suggests_fetch_with_cli")))))
-             (add-after 'unpack 'patch-command-exec-tests
-               ;; This test suite includes some tests that the stdlib's
-               ;; `Command` execution properly handles in situations where
-               ;; the environment or PATH variable are empty, but this fails
-               ;; since we don't have `echo` available at its usual FHS
-               ;; location.
-               (lambda _
-                 (substitute* "tests/ui/command/command-exec.rs"
-                   (("Command::new\\(\"echo\"\\)")
-                    (format #f "Command::new(~s)" (which "echo"))))))
-             (add-after 'unpack 'patch-command-uid-gid-test
-               (lambda _
-                 (substitute* "tests/ui/command/command-uid-gid.rs"
-                   (("/bin/sh") (which "sh"))
-                   (("/bin/ls") (which "ls")))))
-             (add-after 'unpack 'skip-shebang-tests
-               ;; This test make sure that the parser behaves properly when a
-               ;; source file starts with a shebang. Unfortunately, the
-               ;; patch-shebangs phase changes the meaning of these edge-cases.
-               ;; We skip the test since it's drastically unlikely Guix's
-               ;; packaging will introduce a bug here.
-               (lambda _
-                 (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs")))
-             (add-after 'unpack 'patch-process-tests
-               (lambda* (#:key inputs #:allow-other-keys)
-                 (let ((bash (assoc-ref inputs "bash")))
-                   (with-directory-excursion "library/std/src"
-                     (substitute* "process/tests.rs"
-                       (("\"/bin/sh\"")
-                        (string-append "\"" bash "/bin/sh\"")))
-                     ;; The three tests which are known to fail upstream on QEMU
-                     ;; emulation on aarch64 and riscv64 also fail on x86_64 in
-                     ;; Guix's build system.  Skip them on all builds.
-                     (substitute* "sys/pal/unix/process/process_common/tests.rs"
-                       ;; We can't use make-ignore-test-list because we will get
-                       ;; build errors due to the double [ignore] block.
-                       (("target_arch = \"arm\"" arm)
-                        (string-append "target_os = \"linux\",\n"
-                                       "        " arm)))))))
-             (add-after 'unpack 'disable-interrupt-tests
-               (lambda _
-                 ;; This test hangs in the build container; disable it.
-                 (substitute* "src/tools/cargo/tests/testsuite/freshness.rs"
-                   ,@(make-ignore-test-list
-                      '("fn linking_interrupted")))
-                 ;; Likewise for the ctrl_c_kills_everyone test.
-                 (substitute* "src/tools/cargo/tests/testsuite/death.rs"
-                   ,@(make-ignore-test-list
-                      '("fn ctrl_c_kills_everyone")))))
-             (add-after 'unpack 'adjust-rpath-values
-               ;; This adds %output:out to rpath, allowing us to install utilities in
-               ;; different outputs while reusing the shared libraries.
-               (lambda* (#:key outputs #:allow-other-keys)
-                 (let ((out (assoc-ref outputs "out")))
-                   (substitute* "src/bootstrap/src/core/builder/cargo.rs"
-                     ((" = rpath.*" all)
-                      (string-append all
-                                     "                "
-                                     "self.rustflags.arg(\"-Clink-args=-Wl,-rpath="
-                                     out "/lib\");\n"))))))
-             (add-after 'unpack 'unpack-profiler-rt
-               ;; Copy compiler-rt sources to where libprofiler_builtins looks
-               ;; for its vendored copy.
-               (lambda* (#:key inputs #:allow-other-keys)
-                 (mkdir-p "src/llvm-project/compiler-rt")
-                 (copy-recursively
-                   (string-append (assoc-ref inputs "clang-source")
-                                  "/compiler-rt")
+          #~(modify-phases #$phases
+              (add-after 'unpack 'relax-gdb-auto-load-safe-path
+                ;; Allow GDB to load binaries from any location, otherwise the
+                ;; gdbinfo tests fail.  This is only useful when testing with a
+                ;; GDB version newer than 8.2.
+                (lambda _
+                  (setenv "HOME" (getcwd))
+                  (with-output-to-file (string-append (getenv "HOME") "/.gdbinit")
+                    (lambda _
+                      (format #t "set auto-load safe-path /~%")))
+                  ;; Do not launch gdb with '-nx' which causes it to not execute
+                  ;; any init file.
+                  (substitute* "src/tools/compiletest/src/runtest.rs"
+                    (("\"-nx\".as_ref\\(\\), ")
+                     ""))))
+              (add-after 'unpack 'disable-tests-requiring-git
+                (lambda _
+                  (substitute* "src/tools/cargo/tests/testsuite/git.rs"
+                    #$@(make-ignore-test-list
+                        '("fn fetch_downloads_with_git2_first_"
+                          "fn corrupted_checkout_with_cli")))
+                  (substitute* "src/tools/cargo/tests/testsuite/build.rs"
+                    #$@(make-ignore-test-list
+                        '("fn build_with_symlink_to_path_dependency_with_build_script_in_git")))
+                  (substitute* "src/tools/cargo/tests/testsuite/publish_lockfile.rs"
+                    #$@(make-ignore-test-list
+                        '("fn note_resolve_changes")))))
+              (add-after 'unpack 'disable-tests-requiring-mercurial
+                (lambda _
+                  (with-directory-excursion "src/tools/cargo/tests/testsuite/cargo_init"
+                    (substitute* '("mercurial_autodetect/mod.rs"
+                                   "simple_hg_ignore_exists/mod.rs")
+                      #$@(make-ignore-test-list
+                          '("fn case"))))))
+              (add-after 'unpack 'disable-tests-using-cargo-publish
+                (lambda _
+                  (with-directory-excursion "src/tools/cargo/tests/testsuite"
+                    (substitute* "alt_registry.rs"
+                      #$@(make-ignore-test-list
+                          '("fn warn_for_unused_fields")))
+                    (substitute* '("cargo_add/locked_unchanged/mod.rs"
+                                   "cargo_add/lockfile_updated/mod.rs"
+                                   "cargo_remove/update_lock_file/mod.rs")
+                      #$@(make-ignore-test-list
+                          '("fn case")))
+                    (substitute* "git_shallow.rs"
+                      #$@(make-ignore-test-list
+                          '("fn gitoxide_clones_git_dependency_with_shallow_protocol_and_git2_is_used_for_followup_fetches"
+                            "fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again"
+                            "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_shallowness"
+                            "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_with_git2_fetch"
+                            "fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness"
+                            "fn gitoxide_shallow_clone_followed_by_non_shallow_update"
+                            "fn gitoxide_clones_shallow_two_revs_same_deps"
+                            "fn gitoxide_git_dependencies_switch_from_branch_to_rev"
+                            "fn shallow_deps_work_with_revisions_and_branches_mixed_on_same_dependency")))
+                    (substitute* "install.rs"
+                      #$@(make-ignore-test-list
+                          '("fn failed_install_retains_temp_directory")))
+                    (substitute* "offline.rs"
+                      #$@(make-ignore-test-list
+                          '("fn gitoxide_cargo_compile_offline_with_cached_git_dep_shallow_dep")))
+                    (substitute* "patch.rs"
+                      #$@(make-ignore-test-list
+                          '("fn gitoxide_clones_shallow_old_git_patch"))))))
+              #$@(if (target-riscv64?)
+                     ;; Keep this phase separate so it can be adjusted without needing
+                     ;; to adjust the skipped tests on other architectures.
+                     `((add-after 'unpack 'disable-tests-broken-on-riscv64
+                         (lambda _
+                           (with-directory-excursion "src/tools/cargo/tests/testsuite"
+                             (substitute* "build.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn uplift_dwp_of_bin_on_linux")))
+                             (substitute* "cache_lock.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn multiple_shared"
+                                     "fn multiple_download"
+                                     "fn download_then_mutate"
+                                     "fn mutate_err_is_atomic")))
+                             (substitute* "global_cache_tracker.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn package_cache_lock_during_build"))))
+                           (with-directory-excursion "src/tools/clippy/tests"
+                             ;; `"vectorcall"` is not a supported ABI for the current target
+                             (delete-file "ui/missing_const_for_fn/could_be_const.rs")
+                             (substitute* "missing-test-files.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn test_missing_tests")))))))
+                     `())
+              #$@(if (target-aarch64?)
+                     ;; Keep this phase separate so it can be adjusted without needing
+                     ;; to adjust the skipped tests on other architectures.
+                     `((add-after 'unpack 'disable-tests-broken-on-aarch64
+                         (lambda _
+                           (with-directory-excursion "src/tools/cargo/tests/testsuite"
+                             (substitute* "build_script_extra_link_arg.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn build_script_extra_link_arg_bin_single")))
+                             (substitute* "build_script.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn env_test")))
+                             (substitute* "cache_lock.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn download_then_mutate")))
+                             (substitute* "collisions.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn collision_doc_profile_split")))
+                             (substitute* "concurrent.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn no_deadlock_with_git_dependencies")))
+                             (substitute* "features2.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn dep_with_optional_host_deps_activated"))))
+                           (with-directory-excursion "src/tools/clippy/tests"
+                             ;; `"vectorcall"` is not a supported ABI for the current target
+                             (delete-file "ui/missing_const_for_fn/could_be_const.rs")
+                             (substitute* "missing-test-files.rs"
+                               #$@(make-ignore-test-list
+                                   '("fn test_missing_tests")))))))
+                     `())
+              (add-after 'unpack 'disable-tests-requiring-crates.io
+                (lambda _
+                  (with-directory-excursion "src/tools/cargo/tests/testsuite"
+                    (substitute* "install.rs"
+                      #$@(make-ignore-test-list
+                          '("fn install_global_cargo_config")))
+                    (substitute* '("cargo_add/normalize_name_path_existing/mod.rs"
+                                   "cargo_info/within_ws_with_alternative_registry/mod.rs")
+                      #$@(make-ignore-test-list
+                          '("fn case")))
+                    (substitute* "package.rs"
+                      #$@(make-ignore-test-list
+                          '("fn workspace_with_local_deps_index_mismatch"))))))
+              (add-after 'unpack 'disable-miscellaneous-broken-tests
+                (lambda _
+                  (substitute* "src/tools/cargo/tests/testsuite/check_cfg.rs"
+                    ;; These apparently get confused by the fact that
+                    ;; we're building in a directory containing the
+                    ;; string "rustc"
+                    #$@(make-ignore-test-list
+                        '("fn config_fingerprint"
+                          "fn features_fingerprint")))
+                  (substitute* "src/tools/cargo/tests/testsuite/git_auth.rs"
+                    ;; This checks for a specific networking error message
+                    ;; that's different from the one we see in the builder
+                    #$@(make-ignore-test-list
+                        '("fn net_err_suggests_fetch_with_cli")))))
+              (add-after 'unpack 'patch-command-exec-tests
+                ;; This test suite includes some tests that the stdlib's
+                ;; `Command` execution properly handles in situations where
+                ;; the environment or PATH variable are empty, but this fails
+                ;; since we don't have `echo` available at its usual FHS
+                ;; location.
+                (lambda _
+                  (substitute* "tests/ui/command/command-exec.rs"
+                    (("Command::new\\(\"echo\"\\)")
+                     (format #f "Command::new(~s)" (which "echo"))))))
+              (add-after 'unpack 'patch-command-uid-gid-test
+                (lambda _
+                  (substitute* "tests/ui/command/command-uid-gid.rs"
+                    (("/bin/sh") (which "sh"))
+                    (("/bin/ls") (which "ls")))))
+              (add-after 'unpack 'skip-shebang-tests
+                ;; This test make sure that the parser behaves properly when a
+                ;; source file starts with a shebang. Unfortunately, the
+                ;; patch-shebangs phase changes the meaning of these edge-cases.
+                ;; We skip the test since it's drastically unlikely Guix's
+                ;; packaging will introduce a bug here.
+                (lambda _
+                  (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs")))
+              (add-after 'unpack 'patch-process-tests
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (let ((bash (assoc-ref inputs "bash")))
+                    (with-directory-excursion "library/std/src"
+                      (substitute* "process/tests.rs"
+                        (("\"/bin/sh\"")
+                         (string-append "\"" bash "/bin/sh\"")))
+                      ;; The three tests which are known to fail upstream on QEMU
+                      ;; emulation on aarch64 and riscv64 also fail on x86_64 in
+                      ;; Guix's build system.  Skip them on all builds.
+                      (substitute* "sys/pal/unix/process/process_common/tests.rs"
+                        ;; We can't use make-ignore-test-list because we will get
+                        ;; build errors due to the double [ignore] block.
+                        (("target_arch = \"arm\"" arm)
+                         (string-append "target_os = \"linux\",\n"
+                                        "        " arm)))))))
+              (add-after 'unpack 'disable-interrupt-tests
+                (lambda _
+                  ;; This test hangs in the build container; disable it.
+                  (substitute* "src/tools/cargo/tests/testsuite/freshness.rs"
+                    #$@(make-ignore-test-list
+                        '("fn linking_interrupted")))
+                  ;; Likewise for the ctrl_c_kills_everyone test.
+                  (substitute* "src/tools/cargo/tests/testsuite/death.rs"
+                    #$@(make-ignore-test-list
+                        '("fn ctrl_c_kills_everyone")))))
+              (add-after 'unpack 'adjust-rpath-values
+                ;; This adds %output:out to rpath, allowing us to install utilities in
+                ;; different outputs while reusing the shared libraries.
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((out (assoc-ref outputs "out")))
+                    (substitute* "src/bootstrap/src/core/builder/cargo.rs"
+                      ((" = rpath.*" all)
+                       (string-append all
+                                      "                "
+                                      "self.rustflags.arg(\"-Clink-args=-Wl,-rpath="
+                                      out "/lib\");\n"))))))
+              (add-after 'unpack 'unpack-profiler-rt
+                ;; Copy compiler-rt sources to where libprofiler_builtins looks
+                ;; for its vendored copy.
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (mkdir-p "src/llvm-project/compiler-rt")
+                  (copy-recursively
+                   ;; clang-source
+                   (search-input-directory inputs "/compiler-rt")
                    "src/llvm-project/compiler-rt")))
-             (add-after 'configure 'enable-profiling
-               (lambda _
-                 (substitute* "config.toml"
-                   (("^profiler =.*$") "")
-                   (("\\[build\\]") "\n[build]\nprofiler = true\n"))))
-             (add-after 'configure 'add-gdb-to-config
-               (lambda* (#:key inputs #:allow-other-keys)
-                 (let ((gdb (assoc-ref inputs "gdb")))
-                   (substitute* "config.toml"
-                     (("^python =.*" all)
-                      (string-append all
-                                     "gdb = \"" gdb "/bin/gdb\"\n"))))))
-             (replace 'build
-               ;; Phase overridden to also build more tools.
-               (lambda* (#:key parallel-build? #:allow-other-keys)
-                 (let ((job-spec (string-append
-                                  "-j" (if parallel-build?
-                                           (number->string (parallel-job-count))
-                                           "1"))))
-                   (invoke "./x.py" job-spec "build"
-                           "library/std" ;rustc
-                           "src/tools/cargo"
-                           "src/tools/clippy"
-                           "src/tools/rust-analyzer"
-                           "src/tools/rustfmt"
-                           ;; Needed by rust-analyzer and editor plugins
-                           "src/tools/rust-analyzer/crates/proc-macro-srv-cli"))))
-             (replace 'check
-               ;; Phase overridden to also test more tools.
-               (lambda* (#:key tests? parallel-build? #:allow-other-keys)
-                 (when tests?
-                   (let ((job-spec (string-append
-                                    "-j" (if parallel-build?
-                                             (number->string (parallel-job-count))
-                                             "1"))))
-                     (invoke "./x.py" job-spec "test" "-vv"
-                             "library/std"
-                             "src/tools/cargo"
-                             "src/tools/clippy"
-                             "src/tools/rust-analyzer"
-                             "src/tools/rustfmt")))))
-             (replace 'install
-               ;; Phase overridden to also install more tools.
-               (lambda* (#:key outputs #:allow-other-keys)
-                 (invoke "./x.py" "install")
-                 ;; This one doesn't have an install target so
-                 ;; we need to install manually.
-                 (install-file (string-append
+              (add-after 'configure 'enable-profiling
+                (lambda _
+                  (substitute* "config.toml"
+                    (("^profiler =.*$") "")
+                    (("\\[build\\]") "\n[build]\nprofiler = true\n"))))
+              (add-after 'configure 'add-gdb-to-config
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (let ((gdb (search-input-file inputs "/bin/gdb")))
+                    (substitute* "config.toml"
+                      (("^python =.*" all)
+                       (string-append all
+                                      "gdb = \"" gdb "\"\n"))))))
+              (replace 'build
+                ;; Phase overridden to also build more tools.
+                (lambda* (#:key parallel-build? #:allow-other-keys)
+                  (let ((job-spec (string-append
+                                   "-j" (if parallel-build?
+                                            (number->string (parallel-job-count))
+                                            "1"))))
+                    (invoke "./x.py" job-spec "build"
+                            "library/std" ;rustc
+                            "src/tools/cargo"
+                            "src/tools/clippy"
+                            "src/tools/rust-analyzer"
+                            "src/tools/rustfmt"
+                            ;; Needed by rust-analyzer and editor plugins
+                            "src/tools/rust-analyzer/crates/proc-macro-srv-cli"))))
+              (replace 'check
+                ;; Phase overridden to also test more tools.
+                (lambda* (#:key tests? parallel-build? #:allow-other-keys)
+                  (when tests?
+                    (let ((job-spec (string-append
+                                     "-j" (if parallel-build?
+                                              (number->string (parallel-job-count))
+                                              "1"))))
+                      (invoke "./x.py" job-spec "test" "-vv"
+                              "library/std"
+                              "src/tools/cargo"
+                              "src/tools/clippy"
+                              "src/tools/rust-analyzer"
+                              "src/tools/rustfmt")))))
+              (replace 'install
+                ;; Phase overridden to also install more tools.
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (invoke "./x.py" "install")
+                  ;; This one doesn't have an install target so
+                  ;; we need to install manually.
+                  (install-file (string-append
                                  "build/"
-                                 ,(platform-rust-target
+                                 #$(platform-rust-target
                                     (lookup-platform-by-system
-                                      (%current-system)))
+                                     (%current-system)))
                                  "/stage1-tools-bin/rust-analyzer-proc-macro-srv")
-                               (string-append (assoc-ref outputs "out") "/libexec"))
-                 (substitute* "config.toml"
-                   ;; Adjust the prefix to the 'cargo' output.
-                   (("prefix = \"[^\"]*\"")
-                    (format #f "prefix = ~s" (assoc-ref outputs "cargo"))))
-                 (invoke "./x.py" "install" "cargo")
-                 (substitute* "config.toml"
-                   ;; Adjust the prefix to the 'tools' output.
-                   (("prefix = \"[^\"]*\"")
-                    (format #f "prefix = ~s" (assoc-ref outputs "tools"))))
-                 (invoke "./x.py" "install" "clippy")
-                 (invoke "./x.py" "install" "rust-analyzer")
-                 (invoke "./x.py" "install" "rustfmt")))
-             (add-before 'patch-cargo-checksums 'save-old-library-manifest
-               (lambda _
-                 (copy-file "library/Cargo.lock" ".old-library-manifest")))
-             (add-after 'install 'install-rust-src
-               (lambda* (#:key outputs #:allow-other-keys)
-                 (let ((out (assoc-ref outputs "rust-src"))
-                       (dest "/lib/rustlib/src/rust"))
-                   (mkdir-p (string-append out dest))
-                   (copy-recursively "library" (string-append out dest "/library"))
-                   ;; rust-analyzer needs the original checksums; otherwise
-                   ;; it fails to cargo manifest in the stdlib, and then
-                   ;; analysis/inference involving stdlib structs doesn't work.
-                   ;;
-                   ;; For example, in the following trivial program:
-                   ;;
-                   ;; fn main() {
-                   ;;     let x = Vec::<usize>::new();
-                   ;; }
-                   ;;
-                   ;; rust-analyzer since version 1.82 can't infer
-                   ;; the type of x unless the following line is present.
-                   (copy-file ".old-library-manifest"
-                              (string-append out dest "/library/Cargo.lock"))
-                   (copy-recursively "src" (string-append out dest "/src")))))
-             (add-before 'install 'remove-uninstall-script
-               (lambda _
-                 ;; Don't install the uninstall script.  It has no use
-                 ;; on Guix and it retains a reference to the host's bash.
-                 (substitute* "src/tools/rust-installer/install-template.sh"
-                   (("install_uninstaller \"") "# install_uninstaller \""))))
-             (add-after 'install-rust-src 'wrap-rust-analyzer
-               (lambda* (#:key outputs #:allow-other-keys)
-                 (let ((bin (string-append (assoc-ref outputs "tools") "/bin")))
-                   (rename-file (string-append bin "/rust-analyzer")
-                                (string-append bin "/.rust-analyzer-real"))
-                   (call-with-output-file (string-append bin "/rust-analyzer")
-                     (lambda (port)
-                       (format port "#!~a
+                                (string-append (assoc-ref outputs "out") "/libexec"))
+                  (substitute* "config.toml"
+                    ;; Adjust the prefix to the 'cargo' output.
+                    (("prefix = \"[^\"]*\"")
+                     (format #f "prefix = ~s" (assoc-ref outputs "cargo"))))
+                  (invoke "./x.py" "install" "cargo")
+                  (substitute* "config.toml"
+                    ;; Adjust the prefix to the 'tools' output.
+                    (("prefix = \"[^\"]*\"")
+                     (format #f "prefix = ~s" (assoc-ref outputs "tools"))))
+                  (invoke "./x.py" "install" "clippy")
+                  (invoke "./x.py" "install" "rust-analyzer")
+                  (invoke "./x.py" "install" "rustfmt")))
+              (add-before 'patch-cargo-checksums 'save-old-library-manifest
+                (lambda _
+                  (copy-file "library/Cargo.lock" ".old-library-manifest")))
+              (add-after 'install 'install-rust-src
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((out (assoc-ref outputs "rust-src"))
+                        (dest "/lib/rustlib/src/rust"))
+                    (mkdir-p (string-append out dest))
+                    (copy-recursively "library" (string-append out dest "/library"))
+                    ;; rust-analyzer needs the original checksums; otherwise
+                    ;; it fails to cargo manifest in the stdlib, and then
+                    ;; analysis/inference involving stdlib structs doesn't work.
+                    ;;
+                    ;; For example, in the following trivial program:
+                    ;;
+                    ;; fn main() {
+                    ;;     let x = Vec::<usize>::new();
+                    ;; }
+                    ;;
+                    ;; rust-analyzer since version 1.82 can't infer
+                    ;; the type of x unless the following line is present.
+                    (copy-file ".old-library-manifest"
+                               (string-append out dest "/library/Cargo.lock"))
+                    (copy-recursively "src" (string-append out dest "/src")))))
+              (add-before 'install 'remove-uninstall-script
+                (lambda _
+                  ;; Don't install the uninstall script.  It has no use
+                  ;; on Guix and it retains a reference to the host's bash.
+                  (substitute* "src/tools/rust-installer/install-template.sh"
+                    (("install_uninstaller \"") "# install_uninstaller \""))))
+              (add-after 'install-rust-src 'wrap-rust-analyzer
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((bin (string-append (assoc-ref outputs "tools") "/bin")))
+                    (rename-file (string-append bin "/rust-analyzer")
+                                 (string-append bin "/.rust-analyzer-real"))
+                    (call-with-output-file (string-append bin "/rust-analyzer")
+                      (lambda (port)
+                        (format port "#!~a
 if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi;
 exec -a \"$0\" \"~a\" \"$@\""
-                               (which "bash")
-                               (string-append (assoc-ref outputs "rust-src")
-                                              "/lib/rustlib/src/rust/library")
-                               (string-append bin "/.rust-analyzer-real"))))
-                   (chmod (string-append bin "/rust-analyzer") #o755))))))))
+                                (which "bash")
+                                (string-append (assoc-ref outputs "rust-src")
+                                               "/lib/rustlib/src/rust/library")
+                                (string-append bin "/.rust-analyzer-real"))))
+                    (chmod (string-append bin "/rust-analyzer") #o755))))))))
       (inputs
        (modify-inputs (package-inputs base-rust)
-                      (prepend curl libffi `(,nghttp2 "lib") zlib)))
-      (native-inputs (cons*
-                      ;; Keep in sync with the llvm used to build rust.
-                      `("clang-source" ,(package-source clang-runtime-19))
-                      ;; Add test inputs.
-                      `("gdb" ,gdb/pinned)
-                      `("procps" ,procps)
-                      (package-native-inputs base-rust)))
+         (prepend curl libffi `(,nghttp2 "lib") zlib)))
+      (native-inputs
+       (modify-inputs (package-native-inputs base-rust)
+         (prepend
+          ;; Keep in sync with the llvm used to build rust.
+          (package-source clang-runtime-19)
+          ;; Add test inputs.
+          gdb/pinned
+          procps)))
       (native-search-paths
        (cons
-         ;; For HTTPS access, Cargo reads from a single-file certificate
-         ;; specified with $CARGO_HTTP_CAINFO. See
-         ;; https://doc.rust-lang.org/cargo/reference/environment-variables.html
-         (search-path-specification
-          (variable "CARGO_HTTP_CAINFO")
-          (file-type 'regular)
-          (separator #f)              ;single entry
-          (files '("etc/ssl/certs/ca-certificates.crt")))
-         ;; rustc invokes gcc, so we need to set its search paths accordingly.
-         %gcc-search-paths)))))
+        ;; For HTTPS access, Cargo reads from a single-file certificate
+        ;; specified with $CARGO_HTTP_CAINFO. See
+        ;; https://doc.rust-lang.org/cargo/reference/environment-variables.html
+        (search-path-specification
+         (variable "CARGO_HTTP_CAINFO")
+         (file-type 'regular)
+         (separator #f)              ;single entry
+         (files '("etc/ssl/certs/ca-certificates.crt")))
+        ;; rustc invokes gcc, so we need to set its search paths accordingly.
+        %gcc-search-paths)))))
 
 (define*-public (make-rust-sysroot target)
   (make-rust-sysroot/implementation target rust))

base-commit: dd995e3a47340ed11b83b24fe71d13b929a7df8d
-- 
2.49.0