rust-analyzer: Rust analyzer marks proc macros as errors
rust-analyzer version: v0.3.1091
rustc version: rustc 1.61.0 (fe5b13d68 2022-05-18)
When using IntEnum proc macro rust analyzer gives the error:
proc macro IntEnum not expanded rust-analyzer unresolved-proc-macro
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 13
- Comments: 44 (23 by maintainers)
@flodiebold Thank you. My toolchain was defaulting to x86. After setting to arm and reloading, everything appears as expected.
Also for the curious:
@AnderUstarroz something like
rustup install stable-aarch64-apple-darwin && rustup default stable-aarch64-apple-darwinshould do it.@tommyip Try updating rustc. There was a proc macro abi breaking change on nightly recently You are using a rustc version from before this change, while rust-analyzer attempts to use the abi from after this change.
I am also still seeing the issue with VSCode and the latest nightly extension.
Log shows just this:
I use a number of proc macros (e.g.
serde::{Serialize,Deserialize},rstest,clap, etc.) and over the past week or so, they’ve all been flagged as not expanded because the proc macro is not found.(CMD + SHIFT + P: Show RA Version) rust-analyzer version: 0.0.0 (7322a982f 2022-06-16)
I did not see a convenient way to set RA_LOG, but I did try
RA_LOG="warn,project_model=info" code .I saw a number of these in theOutput > Rust Analyzer Language Serverwindow:[WARN mbe::expander::transcriber] expand_tt in repeat pattern exceed limit => MetaTemplate(I’ve included one example below:
Fixed after updating rustc to
rustc 1.63.0-nightly (1f34da9ec 2022-06-14). Thanks @bjorn3.@AnderUstarroz both VSCode and rust-analyzer extension must be
aarch64edition, and set tool chain as @flodiebold toldyep, I download t he visx file and install manually, it works. strange it does not work if installing from VSCode extension
That’s #12450, you can add
"tokio"and"tokio-macros"torust-analyzer.cargo.unsetTestas a workaround.Heads up, https://github.com/rust-lang/rust-analyzer/pull/12584 fixed an issue where we potentially did misdiagnose derive helpers as being unresolved specifically.
@dreamerlzl your snippet seems to be hit by this, so the next release should fix your problem.
Thank you flodiebold! That’s the latest version one can get from homebrew(I am using mac). I tried with the latest release rust-analyzer 0.0.0 (7322a982f 2022-06-16), still a similar error encountered(cargo check & build works fine):
The log entry in lsp.log is the following
Same problem with rust-analyzer 2022-06-06, rustc 1.63.0-nightly (b31f9cc22 2022-06-15). I am using neovim with lsp.