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

program error: use unambigious globs #6590

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions libraries/program-error/derive/src/macro_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ impl MacroType {
/// implements `From<Self> for solana_program::program_error::ProgramError`
pub fn into_program_error(ident: &Ident) -> proc_macro2::TokenStream {
quote! {
impl From<#ident> for solana_program::program_error::ProgramError {
impl From<#ident> for ::solana_program::program_error::ProgramError {
fn from(e: #ident) -> Self {
solana_program::program_error::ProgramError::Custom(e as u32)
::solana_program::program_error::ProgramError::Custom(e as u32)
}
}
}
Expand All @@ -61,7 +61,7 @@ pub fn into_program_error(ident: &Ident) -> proc_macro2::TokenStream {
/// Builds the implementation of `solana_program::decode_error::DecodeError<T>`
pub fn decode_error(ident: &Ident) -> proc_macro2::TokenStream {
quote! {
impl<T> solana_program::decode_error::DecodeError<T> for #ident {
impl<T> ::solana_program::decode_error::DecodeError<T> for #ident {
fn type_of() -> &'static str {
stringify!(#ident)
}
Expand All @@ -81,18 +81,18 @@ pub fn print_program_error(
.unwrap_or_else(|| String::from("Unknown custom program error"));
quote! {
#ident::#variant_ident => {
solana_program::msg!(#error_msg)
::solana_program::msg!(#error_msg)
}
}
});
quote! {
impl solana_program::program_error::PrintProgramError for #ident {
impl ::solana_program::program_error::PrintProgramError for #ident {
fn print<E>(&self)
where
E: 'static
+ std::error::Error
+ solana_program::decode_error::DecodeError<E>
+ solana_program::program_error::PrintProgramError
+ ::solana_program::decode_error::DecodeError<E>
+ ::solana_program::program_error::PrintProgramError
+ num_traits::FromPrimitive,
{
match self {
Expand Down
Loading