Skip to content

cli: Warn if anchor-spl/idl-build is missing#3133

Merged
acheroncrypto merged 2 commits into
otter-sec:masterfrom
acheroncrypto:cli-warn-if-anchor-spl-idl-build-is-missing
Jul 29, 2024
Merged

cli: Warn if anchor-spl/idl-build is missing#3133
acheroncrypto merged 2 commits into
otter-sec:masterfrom
acheroncrypto:cli-warn-if-anchor-spl-idl-build-is-missing

Conversation

@acheroncrypto

Copy link
Copy Markdown
Collaborator

Problem

Not enabling anchor-spl's idl-build feature can result in cryptic compilation errors during IDL build process:

error[E0599]: no function or associated item named `create_type` found for struct `anchor_spl::token::TokenAccount` in the current scope
   --> programs/debug/src/lib.rs:263:10
    |
263 | #[derive(Accounts)]
    |          ^^^^^^^^ function or associated item not found in `TokenAccount`
    |
    = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no associated item named `DISCRIMINATOR` found for struct `anchor_spl::token::TokenAccount` in the current scope
   --> programs/debug/src/lib.rs:263:10
    |
263 | #[derive(Accounts)]
    |          ^^^^^^^^ associated item not found in `TokenAccount`
    |
    = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `insert_types` found for struct `anchor_spl::token::TokenAccount` in the current scope
   --> programs/debug/src/lib.rs:263:10
    |
263 | #[derive(Accounts)]
    |          ^^^^^^^^ function or associated item not found in `TokenAccount`
    |
    = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)

Summary of changes

Log a warning if anchor-spl/idl-build is missing:

WARNING: `idl-build` feature of `anchor-spl` is not enabled. This is likely to result in cryptic compile errors.

        To solve, add `anchor-spl/idl-build` to the `idl-build` feature list:

        [features]
        idl-build = ["anchor-spl/idl-build", ...]

@vercel

vercel Bot commented Jul 29, 2024

Copy link
Copy Markdown

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant