4

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".

annoying warnning1

2 Answers 2

2

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.

0
1

Seems like the required crate isn't installed yet.

Try running cargo run or cargo build

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.