[PATCH] gnu: rust: install rust-analyzer-proc-macro-srv

  • Open
  • quality assurance status badge
Details
2 participants
  • Brennan Vincent
  • Richard Sent
Owner
unassigned
Submitted by
Brennan Vincent
Severity
normal
B
B
Brennan Vincent wrote on 1 May 05:47 +0200
(address . guix-patches@gnu.org)
20240501034732.1748656-1-brennan@umanwizard.com
* gnu/packages/rust.scm (rust): Install rust-analyzer-proc-macro-srv
rust-analyzer relies on this binary existing, and recent versions
of rust no longer install it by default.

Change-Id: I7ce59c065a35cf2592e7eb2fa57317aa9a8df675
---
gnu/packages/rust.scm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 8cbbac53ac..24783d8aa2 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -1214,7 +1214,9 @@ (define-public rust
"src/tools/cargo"
"src/tools/clippy"
"src/tools/rust-analyzer"
- "src/tools/rustfmt"))))
+ "src/tools/rust-analyzer/crates/proc-macro-srv-cli"
+ "src/tools/rustfmt"))
+ ))
(replace 'check
;; Phase overridden to also test more tools.
(lambda* (#:key tests? parallel-build? #:allow-other-keys)
@@ -1244,7 +1246,16 @@ (define-public rust
(format #f "prefix = ~s" (assoc-ref outputs "tools"))))
(invoke "./x.py" "install" "clippy")
(invoke "./x.py" "install" "rust-analyzer")
- (invoke "./x.py" "install" "rustfmt")))
+ (invoke "./x.py" "install" "rustfmt")
+ ;; ./x.py doesn't have an install target
+ ;; for the proc macro server, so we install it manually
+ (let* ((out (assoc-ref outputs "out"))
+ (platform ,(platform-rust-target
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system))))))
+ (install-file (string-append "build/" platform "/stage2-tools/" platform "/release/rust-analyzer-proc-macro-srv")
+ (string-append out "/libexec")))))
(add-after 'install 'install-rust-src
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "rust-src"))
--
2.41.0
R
R
Richard Sent wrote on 28 Aug 18:09 +0200
(name . Brennan Vincent)(address . brennan@umanwizard.com)
87bk1csk73.fsf@freakingpenguin.com
I tested this patch and it resolved an project error while using
rust-analyzer with Eglot. Seems good to me.

Without this patch rust-analyzer prints things like:

Toggle snippet (4 lines)
rust-analyzer [unresolved-proc-macro]: proc macro `Parser` not expanded:
cannot find proc-macro server in sysroot /gnu/store/blah-rust-1.77.1.

--
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 70690@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70690
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch