From 4853cd1da7c81239dd261d943d165095c220d79f Mon Sep 17 00:00:00 2001 From: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Sat, 3 Aug 2024 22:00:38 +0200 Subject: [PATCH] lang: Fix compilation error when an `#[account]` struct has generics (#3148) --- lang/attribute/account/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lang/attribute/account/src/lib.rs b/lang/attribute/account/src/lib.rs index 7d12a9db0d..f4f936ece8 100644 --- a/lang/attribute/account/src/lib.rs +++ b/lang/attribute/account/src/lib.rs @@ -100,7 +100,11 @@ pub fn account( ); format!("{discriminator:?}").parse().unwrap() }; - let disc = quote! { #account_name::DISCRIMINATOR }; + let disc = if account_strct.generics.lt_token.is_some() { + quote! { #account_name::#type_gen::DISCRIMINATOR } + } else { + quote! { #account_name::DISCRIMINATOR } + }; let owner_impl = { if namespace.is_empty() {