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

No function or associated item named insert_types, create_type, get_full_path for VecDeque and usize on Anchor 0.30 #2987

Closed
megatunger opened this issue May 26, 2024 · 2 comments
Labels
compile error Issues related to compile errors idl related to the IDL, either program or client side

Comments

@megatunger
Copy link

I could not build the program since upgrade to Anchor 0.30. It happened if I try to add a field with usize or VecDeq type in struct. Here is a simple replication of this issue


#[account]
pub struct Pool {
    pub id: u64,
    pub size: usize,
    pub workers: VecDeque<Pubkey>,
}

Old: Anchor 0.29.0, Solana 1.18.14 -> working

IMG_0058

New: Anchor 0.30.0, Solana 1.18.14 -> not working

IMG_0060

List of errors:

error[E0599]: no function or associated item named insert_types found for struct VecDeque in the current scope
error[E0599]: no function or associated item named insert_types found for type usize in the current scope
error[E0599]: no function or associated item named create_type found for struct VecDeque in the current scope
error[E0599]: no function or associated item named get_full_path found for struct usize in the current scope
error[E0599]: no function or associated item named get_full_path found for struct VecDeque in the current scope

@acheroncrypto acheroncrypto added the idl related to the IDL, either program or client side label May 27, 2024
@acheroncrypto
Copy link
Collaborator

usize and VecDeque types are not supported in the IDL spec. The reason it used to work before 0.30.0 is because IDL generation would just make everything unknown as a defined type, which resulted in build succeeding but also with an unusable IDL. You can verify this by building your program with 0.29.0 and try to use that IDL client side.

You can, however, include any type in the IDL if you implement IdlBuild trait for that type. See "Customization" section of #2824 and this example.

@acheroncrypto acheroncrypto added the compile error Issues related to compile errors label May 27, 2024
@megatunger
Copy link
Author

Thanks for you explaination!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile error Issues related to compile errors idl related to the IDL, either program or client side
Projects
None yet
Development

No branches or pull requests

2 participants