Index | Thread | Search

From:
"Hukadan" <me@hukadan.org>
Subject:
Re: rust-analyzer: proc-macro support broken
To:
"Sebastien Marie" <semarie@kapouay.eu.org>, "Edd Barrett" <edd@theunixzoo.co.uk>, <ports@openbsd.org>
Date:
Tue, 23 Jan 2024 21:15:00 +0100

Download raw body.

Thread
On Mon Jan 22, 2024 at 1:49 PM CET, Sebastien Marie wrote:
> Edd Barrett <edd@theunixzoo.co.uk> writes:
>
> >
> > This does not occur when using the LSP with a rustup-installed toolchain on
> > Linux.
> >
> > I don't recall seeing this error when I was building RA from source (the magic
> > command I used to use to build/install was `cargo xtask install --server`).
> >
> > I notice that in the source code there is a crate called `proc-macro-srv` and
> > on my linux box there is a binary `rust-analyzer-proc-macro-srv`. Perhaps this
> > is missing?
> >
>
> the `rust-analyzer-proc-macro-srv` binary is built with
> `crates/proc-macro-srv-cli`.
>
> > I've not had time to look deeper, but wanted to report it here in case someone
> > already knows the fix.
>
> I have the following diff for build and installing it:
>

Hi,

Thank you for the diff. I tried it but it does not solve
the problem. I had a look at proc-macro-srv-cli and the
sysroot-abi needs to be enabled:
https://github.com/rust-lang/rust-analyzer/blob/master/crates/proc-macro-srv-cli/src/main.rs#L25

I tried to build with this feature enabled but it needs
other features that are not available on stable release
channel.

Here is the error message I got:

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> crates/proc-macro-srv/src/lib.rs:14:12
   |
14 | #![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)]
   |            ^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> crates/proc-macro-srv/src/lib.rs:14:34
   |
14 | #![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)]
   |                                  ^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> crates/proc-macro-srv/src/lib.rs:14:57
   |
14 | #![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)]
   |                                                         ^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `proc-macro-srv` (lib) due to 3 previous errors


I am not sure there is a way out of this.

Anyway, the error generated by rust-analyzer can be silenced
with the unresolved-proc-macro setting:
https://rust-analyzer.github.io/manual.html#unresolved-proc-macro

I consider this as kind of solved.

Thank you,

Regards,

Hukadan