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

idl: Fix using full path types with Program #3228

Conversation

acheroncrypto
Copy link
Collaborator

Problem

#[derive(Accounts)]
pub struct FullPath<'info> {
    pub external_program: Program<'info, external::program::External>,
}

This fails to compile:

error[E0599]: no function or associated item named `id` found for struct `External` in the current scope
   --> programs/new-idl/src/lib.rs:290:10
    |
290 | #[derive(Accounts)]
    |          ^^^^^^^^ function or associated item not found in `External<'_>`
...
377 | pub struct External<'info> {
    | -------------------------- function or associated item `id` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following traits define an item `id`, perhaps you need to implement one of them:
            candidate #1: `SysvarId`
            candidate #2: `anchor_lang::Id`
    = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0599`.
error: could not compile `new-idl` (lib test) due to 1 previous error
Error: Building IDL failed

Summary of changes

Fix using full path types in Program by using the full path of the given account type and the anchor_lang::Id trait.

Copy link

vercel bot commented Sep 5, 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.

@acheroncrypto acheroncrypto added idl related to the IDL, either program or client side fix Bug fix PR labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix PR idl related to the IDL, either program or client side
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant