Closed ifiokjr closed 5 days ago
We can remove the panicking behavior but then the error would be silenced even when it's necessary.
As a temporary fix I've hardcoded the env variable
ANCHOR_IDL_BUILD_PROGRAM_PATH
to point to the program path but that will stop working with multiple programs in the workspace.
Why would it stop working when there are multiple programs? It should continue to work as long as the env variable ANCHOR_IDL_BUILD_PROGRAM_PATH
is only overridden in Rust Analyzer.
Thanks for the report!
Yes I am also facing the same issue, what could be necessary fix for it? how and where to disable cargo.features = "all"
??
@tarunjais28 provided you're using VS Code, you can add this to your .vscode/settings.json
file:
{
"rust-analyzer.cargo.allFeatures": false
}
I've just upgraded to the latest version of anchor 0.30.1. Everything is fine and
anchor build
runs well. However, there's a small issue when rust-analyzer runs withcargo.features = "all"
. This means thatidl-build
feature is switched on in the LSP.As a result I'm seeing this error on the
#[program]
macro.The error originates from this variable declaration: https://github.com/coral-xyz/anchor/blob/e6d7dafe12da661a36ad1b4f3b5970e8986e5321/lang/syn/src/idl/external.rs#L20-L21
As a temporary fix I've hardcoded the env variable
ANCHOR_IDL_BUILD_PROGRAM_PATH
to point to the program path but that will stop working with multiple programs in the workspace.