-
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
proc_macro attribue fails to expand when combined with cfg_attr
#13360
Comments
Have you told rust-analyzer to enable the |
The feature is a default feature, so I shouldn't have to. But just to be sure, I checked my vscode workspace settings: So it should work but doesn't |
I see. Default features should remain enabled under rust-analyzer unless you explicitly disable them, so that is probably not the issue. Can you show a screenshot of the line with the derive? And can you also place the cursor at derive_ReprC and invoke the rust analyzer: expand macro command to check if macro expansion worked or not. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
OK, I've created a minimally reproducible example, turns out it was easier than expected to minify. I've updated the original post. |
cfg_attr
I believe the issue here is our expansion of the |
Any fix / workaround for this? This makes vscode almost useless for a project I'm working on. |
also still experiencing this problem. is some kind of fix already available? or in the making? |
I have found that mixing certain atribute style proc macros fails when combined with
cfg_attr
and feature flags.Link to minimally reproducible example
rust-analyzer version: rust-analyzer version: 0.4.1227-standalone
rustc version: rustc 1.66.0-nightly (ce7f0f1aa 2022-09-28) (please note its been broken for months, its not a recent regression)
relevant settings:
"rust-analyzer.cargo.features": [ "c_api" ]
, andc_api
is a default feature.Original post before I got a minimal example (outdated)
Unfortunately I haven't been able to make a minimal reproducible example yet, but at least by making this issue I can bring some awareness.I have a medium sized rust codebase, which uses macros quite a bit. There is one type here that never has autocomplete.
It is using proc-macros from
safer-ffi
and is cfg-gated. I haven't been able to figure out the root cause of the problem. I'll try to work a bit more on finding a minimal reproduction.The text was updated successfully, but these errors were encountered: