rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.37k stars 1.62k forks source link

Proc macros not working on new install of rustup and rust-analyzer stable and pre-release #16688

Closed z-targz closed 9 months ago

z-targz commented 9 months ago

[ERROR rust_analyzer::reload] Failed to run proc-macro server from path /home/chase/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/libexec/rust-analyzer-proc-macro-srv, error: Custom { kind: Other, error: "proc-macro server's api version (3) is newer than rust-analyzer's (2)" }

rust version:

$ rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.76.0 (07dca489a 2024-02-04)`

I get the same error on the pre-release version as well.

Can't find any info anywhere about this error.

z-targz commented 9 months ago

This issue is fixed by updating the ide and the extension to the latest version

jonaspleyer commented 8 months ago

I am having exactly the same bug but updating my IDE did not work unfortunately. I am using neovim with packer with the latest version of rust-analyzer from the Arch extra repo.

$ pacman -Qi rust-analyzer
Name            : rust-analyzer
Version         : 20240311-1
Description     : Rust compiler front-end for IDEs
Architecture    : x86_64
URL             : https://rust-analyzer.github.io/
Licenses        : Apache-2.0  MIT
Groups          : None
Provides        : None
Depends On      : gcc-libs  rust-src
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 25.89 MiB
Packager        : Orhun Parmaksız <orhun@archlinux.org>
Build Date      : Mon 11 Mar 2024 10:10:05 CET
Install Date    : Tue 12 Mar 2024 00:21:54 CET
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature
$ pacman -Qi neovim
Name            : neovim
Version         : 0.9.5-2
Description     : Fork of Vim aiming to improve user experience, plugins, and GUIs
Architecture    : x86_64
URL             : https://neovim.io
Licenses        : custom:neovim
Groups          : None
Provides        : vim-plugin-runtime
Depends On      : libluv  libtermkey  libuv  libvterm>0.1.4  luajit  msgpack-c  tree-sitter  unibilium
Optional Deps   : python-pynvim: for Python plugin support (see :help python)
                  xclip: for clipboard support on X11 (or xsel) (see :help clipboard) [installed]
                  xsel: for clipboard support on X11 (or xclip) (see :help clipboard)
                  wl-clipboard: for clipboard support on wayland (see :help clipboard) [installed]
Required By     : neovim-lsp_signature  neovim-lspconfig  neovim-nvim-treesitter  nvim-packer-git  vim-latexsuite
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 25.11 MiB
Packager        : Daniel M. Capella <polyzen@archlinux.org>
Build Date      : Thu 11 Jan 2024 23:35:06 CET
Install Date    : Tue 12 Mar 2024 00:01:05 CET
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature
davidbarsky commented 8 months ago

@jonaspleyer what version of rustc do you have?

jonaspleyer commented 8 months ago
$ rustc --version
rustc 1.76.0 (07dca489a 2024-02-04)
Veykril commented 8 months ago

Double check what rust-analyzer version your editor specifically is running, some people have multiple versions installed somehow where the editor using the one they didn't check

daniel-abramov commented 8 months ago

@jonaspleyer, how do you use rust_analyzer from Neovim? Do you manage your extensions with mason-lspconfig? If so, don't forget that mason would download a local version stored in ~/.local/share/nvim/mason/bin/ (or similar). You can run :LspInfo in Neovim to check where your rust_analyzer is located. If so, run :LspInstall rust_analyzer or simply re-install/update your rust_analyzer. Hope this helps!

jonaspleyer commented 8 months ago

Thanks @Veykril and @daniel-abramov it was totally my fault. I have installed rust-analyzer via mason and updating that fixed it as well. Thanks so much!

tripti-agarwal commented 6 months ago

I am running into a similar issue when installing verus with rust-analyzer in VS Code. I do have a latest version of VS code

sladg commented 6 months ago

Running rustup update solved the issue for me