I'm just beginning with anchor by init new project but every derived trait causes a warning like so. It's said: "proc macro declare_id
not expanded: crate has not (yet) been built".
2 Answers
Gm fam.
Here is a link to the problem: https://fasterthanli.me/articles/proc-macro-support-in-rust-analyzer-for-nightly-rustc-versions
Solution 1)
Add to your rust-analyzer extension settings.json the following line.
"rust-analyzer.diagnostics.disabled": ["unresolved-proc-macro"]
If you don't know how to get to your extension's setting's .json, go to rust-analyzer's extension settings, top right click the icon that looks like a paper with an arrow. now add the line above.
Solution 2)
Add the following line instead of solution 1:
"rust-analyzer.diagnostics.enable": false,
This is not recommended as it'll disable all diagnostics.
Seems like the required crate isn't installed yet.
Try running cargo run
or cargo build