Skip to content

fix: remove DecodeError from trait impls #79

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

Merged
merged 2 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Cargo.lock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert these changes? Unless I'm missing something, they aren't necessary for the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it with the current lock file on main 🙂 - they were updated automatically when I was experimenting with editing various deps and it's not necessary for the PR, as you mentioned

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions pod/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Error types
use {
solana_decode_error::DecodeError,
solana_msg::msg,
solana_program_error::{PrintProgramError, ProgramError},
};
Expand Down Expand Up @@ -35,11 +34,7 @@ impl<T> solana_decode_error::DecodeError<T> for PodSliceError {
impl PrintProgramError for PodSliceError {
fn print<E>(&self)
where
E: 'static
+ std::error::Error
+ DecodeError<E>
+ PrintProgramError
+ num_traits::FromPrimitive,
E: 'static + std::error::Error + PrintProgramError + num_traits::FromPrimitive,
{
match self {
PodSliceError::CalculationFailure => {
Expand Down
1 change: 0 additions & 1 deletion program-error/derive/src/macro_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ pub fn print_program_error(
where
E: 'static
+ std::error::Error
+ #decode_error_import::DecodeError<E>
+ #program_error_import::PrintProgramError
+ num_traits::FromPrimitive,
{
Expand Down
1 change: 0 additions & 1 deletion program-error/tests/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ impl solana_program_error::PrintProgramError for ExampleError {
where
E: 'static
+ std::error::Error
+ solana_decode_error::DecodeError<E>
+ solana_program_error::PrintProgramError
+ num_traits::FromPrimitive,
{
Expand Down
13 changes: 1 addition & 12 deletions tlv-account-resolution/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Error types

use {
solana_decode_error::DecodeError,
solana_msg::msg,
solana_program_error::{PrintProgramError, ProgramError},
};
Expand Down Expand Up @@ -82,20 +81,10 @@ impl From<AccountResolutionError> for ProgramError {
}
}

impl<T> DecodeError<T> for AccountResolutionError {
fn type_of() -> &'static str {
"AccountResolutionError"
}
}

impl PrintProgramError for AccountResolutionError {
fn print<E>(&self)
where
E: 'static
+ std::error::Error
+ DecodeError<E>
+ PrintProgramError
+ num_traits::FromPrimitive,
E: 'static + std::error::Error + PrintProgramError + num_traits::FromPrimitive,
{
match self {
AccountResolutionError::IncorrectAccount => {
Expand Down
13 changes: 1 addition & 12 deletions type-length-value/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Error types
use {
solana_decode_error::DecodeError,
solana_msg::msg,
solana_program_error::{PrintProgramError, ProgramError},
};
Expand All @@ -23,20 +22,10 @@ impl From<TlvError> for ProgramError {
}
}

impl<T> DecodeError<T> for TlvError {
fn type_of() -> &'static str {
"TlvError"
}
}

impl PrintProgramError for TlvError {
fn print<E>(&self)
where
E: 'static
+ std::error::Error
+ DecodeError<E>
+ PrintProgramError
+ num_traits::FromPrimitive,
E: 'static + std::error::Error + PrintProgramError + num_traits::FromPrimitive,
{
match self {
TlvError::TypeNotFound => {
Expand Down