rustneovimrust-proc-macrosrust-analyzerrustup

Issue with Rust macro expansion in editor: proc-macro server's api version is newer than rust-analyzer's


After recent update of Rust toolchain version to 1.77.1 (by running rustup update) I've started seeing following error in my editor (Neovim):

Depiction of mentioned error occurring in editor

Here's the error message in more readable format:

rust-analyzer: proc macro `main` not expanded: Failed to run proc-macro server from path /Users/user/.rustup/toolchains/.../libexec/rust-analyzer-proc-macro-srv, error: Custom { kind: Other, error: "proc-macro server's api version (4) is newer than rust-analyzer's (2)" }

This is annoying as I do not get completions for the symbols that should be generated by macros & seeing a lot of "red" in the editor.

My toolchain is now at latest version 1.77.1, the rust-analyzer version that's being in use here:

Result of running LspInfo

is also at version 1.77.1, so in sync with the toolchain.

I've tried inspecting rust-analyzer-proc-macro-srv binary, but all I get is following message:

~/.rustup/toolchains/stable-aarch64-apple-darwin/libexec 
❯ ./rust-analyzer-proc-macro-srv --version
If you're rust-analyzer, you can use this tool by exporting RUST_ANALYZER_INTERNALS_DO_NOT_USE='this is unstable'.
If not, you probably shouldn't use this tool. But do what you want: I'm an error message, not a cop.

and I clearly do not know my way around these tools...

As I have not found similar issue reported while googling I'm looking for issue explanation & suggestions of potential solutions, preferably better than downgrading & trying to match toolchain versions with the proc macro srv (maybe how do I update this rust-analyzer-proc-macro-srv or how do I inspect it's version?)


Solution

  • :LspInstall rust_analyzer
    

    This will reinstall the latest version of rust_analyzer for anyone who uses mason in neovim.

    Press U to update any additional LSPs when the prompt appears.