Skip to content

Commit

Permalink
lang: Fix align repr support in declare-program! (#3056)
Browse files Browse the repository at this point in the history
Co-authored-by: acheron <[email protected]>
  • Loading branch information
0xBurbo and acheroncrypto authored Jul 1, 2024
1 parent a8d2598 commit e68b96f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The minor version will be incremented upon a breaking change and the patch versi

- idl: Make safety comment checks fail silently when program path env is not set ([#3045](https://github.com/coral-xyz/anchor/pull/3045)).
- idl: Avoid interference from rust tests during IDL generation ([#3058](https://github.com/coral-xyz/anchor/pull/3058)).
- lang: Fix `align` repr support in `declare-program!` ([#3056](https://github.com/coral-xyz/anchor/pull/3056)).

### Breaking

Expand Down
2 changes: 2 additions & 0 deletions lang/attribute/program/src/declare_program/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use anchor_lang_idl::types::{
Idl, IdlArrayLen, IdlDefinedFields, IdlField, IdlGenericArg, IdlRepr, IdlSerialization,
IdlType, IdlTypeDef, IdlTypeDefGeneric, IdlTypeDefTy,
};
use proc_macro2::Literal;
use quote::{format_ident, quote};

/// This function should ideally return the absolute path to the declared program's id but because
Expand Down Expand Up @@ -168,6 +169,7 @@ pub fn convert_idl_type_def_to_ts(
let packed = modifier.packed.then(|| quote!(packed)).unwrap_or_default();
let align = modifier
.align
.map(Literal::usize_unsuffixed)
.map(|align| quote!(align(#align)))
.unwrap_or_default();

Expand Down

0 comments on commit e68b96f

Please sign in to comment.