-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: Proc macros not being expanded #10894
Comments
In general, RA just seems broken across the board for me. This code should generate an error but doesn't. Edit: it seems that a config is breaking RA. Haven't figure out exactly but here's what I have enabled:
The RA LSP downloaded via the
I'm running an m1 Mac in case RA is downloading the wrong binary. |
I assume the version of |
Are there any updates on this issue? Proc macro expansion seems to have entirely stopped working after I upgraded to (This can be seen by opening https://github.com/al2me6/evanescence using RA.) |
Are you running the x86 version of Code instead of the native M1 one? |
11002: fix: Add support for v6 macro metadata format r=lnicola a=lnicola CC #10894 (comment) bors r+ Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
@al2me6 you need to try with the next nightly. |
|
Bump: I'm getting this a lot and it's making it hard to read my code. Any thoughts on how to fix this? |
whats your rust version and rust-analyzer version |
$ rustc --version
rustc 1.57.0 (f1edd0429 2021-11-29)
$ rust-analyzer --version
rust-analyzer 2021-10-25 |
That rust-analyzer version is heavily outdated which might be the reason for your troubles, try updating to the latest release. |
Updated to |
That one should probably work. Not sure what could be causing this then without a reproduction/more info |
I'm running into this issue using the nightly toolchain with VSCode rust-analyzer extension. $ ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer --version
rust-analyzer 9700add 2022-01-30 dev Example code that reproduces the issue for me: use clap::Parser;
#[derive(Parser, Debug)]
struct Args {
}
fn main() {
let args = Args::parse();
} |
Did you guys tried to download rust-analyzer to your bin and add path to "rust-analyzer.server.path" in "settings.json" which is in vscode ? This worked me |
I can confirm this is still an issue. rust-analyzer was installed with
I am positive this is the only version of rust-analyzer I have installed - Spacemacs does not install its own version. |
Works for me with both stable and nightly Rust. It'd be nice if we could show some more information when we're emitting this error (whether proc macros are disabled would be one thing, but also maybe we're dropping / only logging some errors that can lead to this?) |
Digging a bit deeper it turns out that yes, I simply didn't correctly enable proc-macros in the LSP config. I agree that it'd be nice to have more informative errors. Something along the lines of |
I also run into this problem on Doom Emacs, I use I'm sure my (btw, I also confirm the output of expanded code on vscode via "Rust Analyzer: Expand macro recursively" to perfectly matched that of my emacs, both have no issue with locally defined macro, but both failed with imported macro) |
Let's close this since the original issue is not reproducible, and the ticket risks becoming a dumping ground for proc macro expansion problems. |
@flodiebold I think this issue may be related to the M1 Mac aspect of things. I am currently getting these errors in VSCode running the latest version of pre-release rust-analyzer and getting the following error. Seems to be an x86 vs arm issue.
|
@cloutiertyler you should file a new issue if you still have trouble. My guess is that you're either running the x86 version of Code, or you have a stale target directory from an x86. |
Chiming in to say I had an issue with this when writing a fresh derive macro, and it went away when I reloaded rust-analyzer ( My precise output from rust-analyzer was "Proc macro not expanded: no proc macro dynlib present". |
Had the same issue, I am using leptos with rust nightly. But I had installed rust-analyzer manually not with rust-up. so I removed it and reinstalled it with rustup and installed the nightly toolchain again. and everything works |
for me, the issue turned out to be that I had a sub project in my repo that I decided to delete and remove...but the vscode/settings.json had this in it: { I deleted the "./Deleted_Project/Cargo.toml" line and the problem went away i'td be awesome if rust-analyzer reported that I was asking for it to link to a project that no longer existed and stopped executing. |
Just had the same issue and the root cause seemed to be what @joelong01 mentioned above, since removing the stale project fixed the issue for me. +1 to that it'd be great if rust-analyzer points to the right root cause here. |
The Problem is coming at the root of the project file. |
Please open a new issue and fill out the template, including what operating system you are on and what error(s) you are getting |
I encountered this issue with |
It seems that proc macro support degraded heavily from the previous version of RA for me. In the last version, both web-sys autocomplete and proc macro inlay hints worked.
Now, it seems that RA is blind to any web-sys types (once again) and none of my proc macros are being expanded (
proc macro not expanded rust-analyzerunresolved-proc-macro
). My proc macro is fairly well behaved and, in the past, had significant IDE support for hovers/go-to/inlay hints.For instance, my code
expands to
I would expect to see hints on
div
since I re-use the token literally, but the macro simply fails to expand.Is there a different proc-macro server I can use that works?
rust-analyzer version:
d9b2291f5 2021-11-29 stable
rustc version:
rustc 1.56.1 (59eed8a2a 2021-11-01)
The text was updated successfully, but these errors were encountered: