diff options
| author | Brennan Vincent <brennan@umanwizard.com> | 2025-03-23 10:41:23 -0700 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2025-08-21 19:08:56 +0800 |
| commit | 44b94a9276f39a653d68bd443c0aa0c3d05e471f (patch) | |
| tree | 51ccea204a4c4213541bfe90d37dca84f7ccba06 /gnu | |
| parent | d76575b7a6c44f8af4309a0d7c9fafeaa236612e (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>
Diffstat (limited to 'gnu')
| -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 bf7eeb5fbf5..77441bc6237 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm | |||
| @@ -1475,12 +1475,29 @@ safety and thread safety guarantees.") | |||
| 1475 | (invoke "./x.py" "install" "clippy") | 1475 | (invoke "./x.py" "install" "clippy") |
| 1476 | (invoke "./x.py" "install" "rust-analyzer") | 1476 | (invoke "./x.py" "install" "rust-analyzer") |
| 1477 | (invoke "./x.py" "install" "rustfmt"))) | 1477 | (invoke "./x.py" "install" "rustfmt"))) |
| 1478 | (add-before 'patch-cargo-checksums 'save-old-library-manifest | ||
| 1479 | (lambda _ | ||
| 1480 | (copy-file "library/Cargo.lock" ".old-library-manifest"))) | ||
| 1478 | (add-after 'install 'install-rust-src | 1481 | (add-after 'install 'install-rust-src |
| 1479 | (lambda* (#:key outputs #:allow-other-keys) | 1482 | (lambda* (#:key outputs #:allow-other-keys) |
| 1480 | (let ((out (assoc-ref outputs "rust-src")) | 1483 | (let ((out (assoc-ref outputs "rust-src")) |
| 1481 | (dest "/lib/rustlib/src/rust")) | 1484 | (dest "/lib/rustlib/src/rust")) |
| 1482 | (mkdir-p (string-append out dest)) | 1485 | (mkdir-p (string-append out dest)) |
| 1483 | (copy-recursively "library" (string-append out dest "/library")) | 1486 | (copy-recursively "library" (string-append out dest "/library")) |
| 1487 | ;; rust-analyzer needs the original checksums; otherwise | ||
| 1488 | ;; it fails to cargo manifest in the stdlib, and then | ||
| 1489 | ;; analysis/inference involving stdlib structs doesn't work. | ||
| 1490 | ;; | ||
| 1491 | ;; For example, in the following trivial program: | ||
| 1492 | ;; | ||
| 1493 | ;; fn main() { | ||
| 1494 | ;; let x = Vec::<usize>::new(); | ||
| 1495 | ;; } | ||
| 1496 | ;; | ||
| 1497 | ;; rust-analyzer since version 1.82 can't infer | ||
| 1498 | ;; the type of x unless the following line is present. | ||
| 1499 | (copy-file ".old-library-manifest" | ||
| 1500 | (string-append out dest "/library/Cargo.lock")) | ||
| 1484 | (copy-recursively "src" (string-append out dest "/src"))))) | 1501 | (copy-recursively "src" (string-append out dest "/src"))))) |
| 1485 | (add-before 'install 'remove-uninstall-script | 1502 | (add-before 'install 'remove-uninstall-script |
| 1486 | (lambda _ | 1503 | (lambda _ |
