Subject: [bug#53208] [PATCH 38/39] gnu: rust-analyzer: Update to 2022-01-10.

From: Z572 <[email-masked]>
Date: Wed, 12 Jan 2022 23:27:58 +0800

* gnu/packages/rust-apps.scm (rust-analyzer): Update to 2022-01-10.
[arguments]: Add #:rust rust-1.57.
<#:cargo-test-flags>: Skip two fail test.
<#:cargo-inputs>:
Add rust-typed-arena-2. Remove rust-tracing-tree-0.1
Use rust-cargo-metadata-0.14 replace rust-cargo-metadata-0.13,
use rust-chalk-ir-0.75 replace rust-chalk-ir-0.68,
use rust-chalk-recursive-0.75 replace rust-chalk-recursive-0.68,
use rust-countme-3 replace rust-countme-2,
use rust-cov-mark-2 replace rust-cov-mark-1,
use rust-lsp-types-0.91 replace rust-lsp-types-0.89,
use rust-memmap2-0.5 replace rust-memmap2-0.2,
use rust-miow-0.4 replace rust-miow-0.3,
use rust-object-0.28 replace rust-object-0.24,
use rust-pulldown-cmark-to-cmark-7 replace rust-pulldown-cmark-to-cmark-6,
use rust-rowan-0.15 replace rust-rowan-0.13,
use rust-rustc-ap-rustc-lexer-725 replace rust-rustc-ap-rustc-lexer-721.
Move rust-quote-1 to #:cargo-development-inputs,
Move rust-expect-test-1 to #:cargo-development-inputs,
move rust-rayon-1 to #:cargo-development-inputs,
move rust-tracing-0.1 to #:cargo-development-inputs,
move rust-ungrammar-1 to #:cargo-development-inputs.
<#:cargo-development-inputs>:
Add rust-arbitrary-1, rust-derive-arbitrary, rust-tracing-subscriber-0.3,
rust-tracing-tree-0.2.
<#:phases>:
Remove patch-build-failures.
Add install-doc, chdir phase.
Remove replace install phase.
Replace install-license-files phase.
Update fix-tests phase
---
 gnu/packages/rust-apps.scm | 88 +++++++++++++++++++++++---------------
 1 file changed, 53 insertions(+), 35 deletions(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 7dd60dd35b..2831b1401f 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -9,7 +9,7 @@
 ;;; Copyright © 2020–2022 Nicolas Goaziou <[email-masked]>
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2021 Sharlatan Hellseher <[email-masked]>
-;;; Copyright © 2021 Zheng Junjie <[email-masked]>
+;;; Copyright © 2021, 2022 Zheng Junjie <[email-masked]>
 ;;; Copyright © 2021 Alexandru-Sergiu Marton <[email-masked]>
 ;;; Copyright © 2021 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2021 Petr Hodina <[email-masked]>
@@ -1161,7 +1161,7 @@ (define-public watchexec
 (define-public rust-analyzer
   (package
     (name "rust-analyzer")
-    (version "2021-06-07")
+    (version "2022-01-10")
     (source
      (origin
        ;; The crate at "crates.io" is empty.
@@ -1172,35 +1172,52 @@ (define-public rust-analyzer
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "06bc3s5kjwpyr2cq79p0306a9bqp3xp928d750ybby9npq2dvj3z"))))
+         "1ci85bp8xwqrk8nqr8sh6yj8njgd98nhgnhaks2g00c77wwyra41"))))
     (build-system cargo-build-system)
     (arguments
      `(#:install-source? #f             ; virtual manifest
+       #:rust ,rust-1.57
        #:cargo-test-flags
        '("--release" "--"
          "--skip=tests::test_version_check"         ;; It need rustc's version
          ;; FIXME: Guix's rust not install source in %out/lib/rustlib/src/rust
          ;; so "can't load standard library from sysroot"
          "--skip=tests::test_loading_rust_analyzer"
+         ;; Failed to run rustfmt from toolchain 'stable'.
+         ;; Please run `rustup component add rustfmt --toolchain stable` to install it
+         "--skip=tests::sourcegen::sourcegen_assists_docs" ;; Need rustfmt
+         "--skip=tests::sourcegen_ast::sourcegen_ast" ;; Same
+
          "--skip=tidy::cargo_files_are_tidy"        ;; Not need
          "--skip=tidy::check_licenses"              ;; It run cargo metadata.
          "--skip=tidy::check_merge_commits"         ;; It run git rev-list.
          "--skip=tidy::check_code_formatting"       ;; Need rustfmt as cargo fmt
          "--skip=tidy::generate_grammar"            ;; Same
          "--skip=tidy::generate_assists_tests")     ;; Same
+       #:cargo-development-inputs
+       (("rust-arbitrary" ,rust-arbitrary-1)
+        ("rust-derive-arbitrary" ,rust-derive-arbitrary-1)
+        ("rust-expect-test" ,rust-expect-test-1)
+        ("rust-oorandom" ,rust-oorandom-11.1)
+        ("rust-quote" ,rust-quote-1)
+        ("rust-rayon" ,rust-rayon-1)
+        ("rust-tracing" ,rust-tracing-0.1)
+        ("rust-tracing-subscriber" ,rust-tracing-subscriber-0.3)
+        ("rust-tracing-tree" ,rust-tracing-tree-0.2)
+        ("rust-ungrammar" ,rust-ungrammar-1))
        #:cargo-inputs
        (("rust-always-assert" ,rust-always-assert-0.1)
         ("rust-anyhow" ,rust-anyhow-1)
         ("rust-anymap" ,rust-anymap-0.12)
         ("rust-arrayvec" ,rust-arrayvec-0.7)
         ("rust-backtrace" ,rust-backtrace-0.3)
-        ("rust-cargo-metadata" ,rust-cargo-metadata-0.13)
+        ("rust-cargo-metadata" ,rust-cargo-metadata-0.14)
         ("rust-cfg-if" ,rust-cfg-if-1)
-        ("rust-chalk-ir" ,rust-chalk-ir-0.68)
-        ("rust-chalk-recursive" ,rust-chalk-recursive-0.68)
-        ("rust-chalk-solve" ,rust-chalk-solve-0.68)
-        ("rust-countme" ,rust-countme-2)
-        ("rust-cov-mark" ,rust-cov-mark-1)
+        ("rust-chalk-ir" ,rust-chalk-ir-0.75)
+        ("rust-chalk-recursive" ,rust-chalk-recursive-0.75)
+        ("rust-chalk-solve" ,rust-chalk-solve-0.75)
+        ("rust-countme" ,rust-countme-3)
+        ("rust-cov-mark" ,rust-cov-mark-2)
         ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.5)
         ("rust-dashmap" ,rust-dashmap-4)
         ("rust-dissimilar" ,rust-dissimilar-1)
@@ -1209,7 +1226,6 @@ (define-public rust-analyzer
         ("rust-either" ,rust-either-1)
         ("rust-ena" ,rust-ena-0.14)
         ("rust-env-logger" ,rust-env-logger-0.8)
-        ("rust-expect-test" ,rust-expect-test-1)
         ("rust-flate2" ,rust-flate2-1)
         ("rust-fst" ,rust-fst-0.4)
         ("rust-home" ,rust-home-0.5)
@@ -1220,29 +1236,27 @@ (define-public rust-analyzer
         ("rust-libloading" ,rust-libloading-0.7)
         ("rust-log" ,rust-log-0.4)
         ("rust-lsp-server" ,rust-lsp-server-0.5)
-        ("rust-lsp-types" ,rust-lsp-types-0.89)
-        ("rust-memmap2" ,rust-memmap2-0.2)
+        ("rust-lsp-types" ,rust-lsp-types-0.91)
+        ("rust-memmap2" ,rust-memmap2-0.5)
         ("rust-mimalloc" ,rust-mimalloc-0.1)
-        ("rust-miow" ,rust-miow-0.3)
+        ("rust-miow" ,rust-miow-0.4)
         ("rust-notify" ,rust-notify-5)
-        ("rust-object" ,rust-object-0.24)
+        ("rust-object" ,rust-object-0.28)
         ("rust-once-cell" ,rust-once-cell-1)
-        ("rust-oorandom" ,rust-oorandom-11.1)
         ("rust-parking-lot" ,rust-parking-lot-0.11)
         ("rust-perf-event" ,rust-perf-event-0.4)
         ("rust-proc-macro2" ,rust-proc-macro2-1)
         ("rust-pulldown-cmark" ,rust-pulldown-cmark-0.8)
-        ("rust-pulldown-cmark-to-cmark" ,rust-pulldown-cmark-to-cmark-6)
-        ("rust-quote" ,rust-quote-1)
-        ("rust-rayon" ,rust-rayon-1)
-        ("rust-rowan" ,rust-rowan-0.13)
-        ("rust-rustc-ap-rustc-lexer" ,rust-rustc-ap-rustc-lexer-721)
+        ("rust-pulldown-cmark-to-cmark" ,rust-pulldown-cmark-to-cmark-7)
+        ("rust-rowan" ,rust-rowan-0.15)
+        ("rust-rustc-ap-rustc-lexer" ,rust-rustc-ap-rustc-lexer-725)
         ("rust-rustc-hash" ,rust-rustc-hash-1)
         ("rust-salsa" ,rust-salsa-0.17)
         ("rust-scoped-tls" ,rust-scoped-tls-1)
         ("rust-serde" ,rust-serde-1)
         ("rust-serde-json" ,rust-serde-json-1)
         ("rust-serde-path-to-error" ,rust-serde-path-to-error-0.1)
+        ("rust-typed-arena" ,rust-typed-arena-2)
         ("rust-smallvec" ,rust-smallvec-1)
         ("rust-smol-str" ,rust-smol-str-0.1)
         ("rust-snap" ,rust-snap-1)
@@ -1250,10 +1264,6 @@ (define-public rust-analyzer
         ("rust-threadpool" ,rust-threadpool-1)
         ("rust-tikv-jemalloc-ctl" ,rust-tikv-jemalloc-ctl-0.4)
         ("rust-tikv-jemallocator" ,rust-tikv-jemallocator-0.4)
-        ("rust-tracing" ,rust-tracing-0.1)
-        ("rust-tracing-subscriber" ,rust-tracing-subscriber-0.2)
-        ("rust-tracing-tree" ,rust-tracing-tree-0.1)
-        ("rust-ungrammar" ,rust-ungrammar-1)
         ("rust-url" ,rust-url-2)
         ("rust-walkdir" ,rust-walkdir-2)
         ("rust-winapi" ,rust-winapi-0.3)
@@ -1262,24 +1272,32 @@ (define-public rust-analyzer
         ("rust-xshell" ,rust-xshell-0.1))
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'patch-build-failures
-           (lambda _
-             (chmod ".cargo/config" 420)
-             #t))
          (add-before 'check 'fix-tests
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda _
              (let ((bash (string-append "#!" (which "bash"))))
-               (with-directory-excursion "crates/syntax/test_data/lexer/ok"
-                 (substitute* "0010_single_line_comments.txt"
+               (with-directory-excursion "crates/parser/test_data/lexer/ok"
+                 (substitute* "single_line_comments.txt"
                    (("SHEBANG 19")
                     (string-append "SHEBANG "
                                    (number->string (string-length bash))))
                    (("#!/usr/bin/env bash") bash))))))
-         (replace 'install
+         (add-before 'install 'install-doc
            (lambda* (#:key outputs #:allow-other-keys)
-             (install-file "target/release/rust-analyzer"
-                           (string-append (assoc-ref outputs "out")
-                                          "/bin")))))))
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (string-append out "/share/doc/rust-analyzer-"
+                                        ,version)))
+               (copy-recursively "docs" doc))))
+         (add-before 'install 'chdir
+           (lambda _
+             (chdir "crates/rust-analyzer")))
+         (replace 'install-license-files
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (string-append out "/share/doc/rust-analyzer-"
+                                        ,version)))
+               (chdir "../..")
+               (install-file "LICENSE-MIT" doc)
+               (install-file "LICENSE-APACHE" doc)))))))
     (home-page "https://rust-analyzer.github.io/")
     (synopsis "Experimental Rust compiler front-end for IDEs")
     (description "Rust-analyzer is a modular compiler frontend for the Rust
-- 
2.34.0