diff options
author | Brennan Vincent <brennan@umanwizard.com> | 2025-03-23 10:41:23 -0700 |
---|---|---|
committer | Hilton Chain <hako@ultrarare.space> | 2025-07-29 21:32:20 +0800 |
commit | 4a34242bd8e2c4af624380a003df89e6af86a19e (patch) | |
tree | 714e88baa94c4eb406fe0a140c22504a2449eef1 | |
parent | 1ca1a45b382ed1282eb0fa8fb3fa851a976b4bba (diff) |
gnu: rust: Install stdlib manifest with original checksums.
* gnu/packages/rust.scm (rust)[arguments]: Install stdlib manifest with
the original checksums.
Change-Id: I1100ffe4ff67c8e2026e802fc3902ec218e2efee
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
-rw-r--r-- | gnu/packages/rust.scm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index bf7eeb5fbf..77441bc623 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -1475,12 +1475,29 @@ safety and thread safety guarantees.") (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 _ |