Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

acheroncrypto
Copy link
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", ...]

Copy link

vercel bot commented Jul 29, 2024

@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