Skip to content

Commit

Permalink
tests: Use a constant identifier as a generic argument
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto committed Jan 28, 2025
1 parent b24464d commit 57b3654
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/idl/programs/new-idl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,14 @@ pub struct SomeStruct {
pub field: u16,
}

/// Compilation check for the issue described in https://github.com/coral-xyz/anchor/issues/3520
// TODO: Use this from client-side (instead of hardcoding) once `program.constants` is supported
const GENERIC_CONST: usize = 8;

#[derive(AnchorSerialize, AnchorDeserialize, Clone, Debug)]
pub struct GenericStruct<T, const N: usize> {
arr: [T; N],
sub_field: SubGenericStruct<8, T, Vec<Option<T>>>,
sub_field: SubGenericStruct<GENERIC_CONST, T, Vec<Option<T>>>,
}

#[derive(AnchorSerialize, AnchorDeserialize, Clone, Debug)]
Expand Down

0 comments on commit 57b3654

Please sign in to comment.