From 56017029b40371d10d6d65cb1308aef2c571dbb8 Mon Sep 17 00:00:00 2001 From: cryptopapi997 <38372048+cryptopapi997@users.noreply.github.com> Date: Thu, 30 May 2024 23:07:29 +0200 Subject: [PATCH] lang: Make tuple struct fields public in `declare_program!` (#2994) --- CHANGELOG.md | 1 + lang/attribute/program/src/declare_program/common.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06e0c38f6..dddcc2f5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ The minor version will be incremented upon a breaking change and the patch versi - lang: Fix instruction return type generation with `declare_program!` ([#2977](https://github.com/coral-xyz/anchor/pull/2977)). - cli: Fix IDL write getting corrupted from retries ([#2964](https://github.com/coral-xyz/anchor/pull/2964)). - idl: Fix `unexpected_cfgs` build warning ([#2992](https://github.com/coral-xyz/anchor/pull/2992)). +- lang: Make tuple struct fields public in `declare_program!` ([#2994](https://github.com/coral-xyz/anchor/pull/2994)). ### Breaking diff --git a/lang/attribute/program/src/declare_program/common.rs b/lang/attribute/program/src/declare_program/common.rs index 9b1f71f35..f9d43c0dc 100644 --- a/lang/attribute/program/src/declare_program/common.rs +++ b/lang/attribute/program/src/declare_program/common.rs @@ -211,7 +211,11 @@ pub fn convert_idl_type_def_to_ts( } }, |tys| { - let tys = tys.iter().map(convert_idl_type_to_syn_type); + let tys = tys + .iter() + .map(convert_idl_type_to_syn_type) + .map(|ty| quote! { pub #ty }); + quote! { #declare_struct (#(#tys,)*); }