rust-lang / rust-lang/rust-analyzer
RA indicates error when using generated macros by proc-macros
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Small example project
Hi! I'm not sure if this is related to some WIP or other issues, but I've created a small example of this problem: swfsql/test-macros-ra
My env
rustup show: 1.55.0-x86_64-unknown-linux-gnu
Rust Analyzer: Show RA Version: 04f03a360 2021-11-01 stable
VsCode settings:
"rust-analyzer.procMacro.enable": true
"rust-analyzer.experimental.procAttrMacros": true
Problem
I'm using proc-macros to create new macro_rules! macros, and while I'm #[macro_export]ing them, I also want to use them by my modules in the library.
I believe that the linked example will contain other necessary information, but the problem is that while cargo check passes, RA indicates an error (unresolved import - while this isn't so bad, I think it would be better to not have a permanent false-positive XD but perhaps this is an uncommon case).
Thanks in advance, for anyone who are able to take a look!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the unresolved-import diagnostic using the linked swfsql/test-macros-ra example with rust-analyzer.procMacro.enable and experimental.procAttrMacros enabled. Compare rust-analyzer's result with cargo check; done means the generated macro import no longer produces a false-positive error while the existing example continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100