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

lang: Fix compilation error when an #[account] struct has generics #3148

Conversation

acheroncrypto
Copy link
Collaborator

Problem

The change in #3144 introduced a compilation error when the #[account] struct has generics, but it wasn't caught due to the latest clippy lints.

Example problematic definition:

#[account(zero_copy(unsafe))]
pub struct FooAccount<const N: usize> {
pub data: WrappedU8Array<N>,
}

Summary of changes

Conditionally add the generics to the DISCRIMINATOR constant accessors based on whether the account struct definition has generics.

This change is only aimed at fixing the CI errors because the IDL spec (intentionally) does not support having generics in the account struct definitions. This might change in the future, but the fix in this PR is simple enough that we don't need to deal with removing the generic implementation.


Note: This PR is part of a greater effort explained in #3097.

Copy link

vercel bot commented Aug 3, 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 lang fix Bug fix PR labels Aug 3, 2024
@acheroncrypto acheroncrypto mentioned this pull request Aug 3, 2024
26 tasks
@acheroncrypto acheroncrypto merged commit 4853cd1 into coral-xyz:master Aug 3, 2024
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix PR lang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant