guix_mirror_bot pushed a commit to branch rust-team
in repository guix.
commit 71f6e64afaa580a99aaea67ffd39bd4a40a8293d
Author: Efraim Flashner <[email protected]>
AuthorDate: Mon Jan 26 10:44:50 2026 +0200
gnu: rust: Don't keep a reference to previous rust version.
Fixes: guix/guix#5792.
* gnu/packages/rust.scm (rust)[arguments]: Update disallowed-references.
Add a phase to rewrite references from the input cargo to the output
cargo.
Change-Id: Ice6abdf18cba8eb042bfc37025ce0e7686623e46
---
gnu/packages/rust.scm | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index b1fa8e30d1..ef37c8ac83 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2016 Nikita <[email protected]>
;;; Copyright © 2017 Ben Woodcroft <[email protected]>
;;; Copyright © 2017, 2018 Nikolai Merinov <[email protected]>
-;;; Copyright © 2017, 2019-2025 Efraim Flashner <[email protected]>
+;;; Copyright © 2017, 2019-2026 Efraim Flashner <[email protected]>
;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <[email protected]>
;;; Copyright © 2018 Danny Milosavljevic <[email protected]>
;;; Copyright © 2019 Ivan Petkov <[email protected]>
@@ -1642,6 +1642,11 @@ ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
(substitute-keyword-arguments
(strip-keyword-arguments '(#:tests?)
(package-arguments base-rust))
+ ((#:disallowed-references _ '())
+ (list (this-package-native-input "rustc-bootstrap")
+ ;; Refer to cargo-bootstrap as #$rustc-bootstrap:cargo.
+ (gexp-input (this-package-native-input "rustc-bootstrap")
+ "cargo")))
((#:modules modules)
(cons '(srfi srfi-26) modules))
((#:phases phases)
@@ -1899,6 +1904,15 @@ ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
;; 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
'dont-reference-previous-cargo-version
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion
+ (string-append (assoc-ref outputs "rust-src")
+ "/lib/rustlib/src/rust/src/tools/")
+ (substitute* (find-files "." "cargo-test-fixture\\.rs")
+ (("#!.*/bin/cargo")
+ (string-append "#!" (assoc-ref outputs "cargo")
+ "/bin/cargo"))))))
(add-after 'install-rust-src 'wrap-rust-analyzer
(lambda* (#:key outputs #:allow-other-keys)
(let ((bin (string-append (assoc-ref outputs "tools")
"/bin")))