Skip to content

Commit

Permalink
Constrain Signer::Error
Browse files Browse the repository at this point in the history
In practice, most errors need to satisfy:

    std::error::Error + Send + Sync + 'static

and `Signer::Error` is no exception.

By defining the bound on the trait here, some wild tricks involving
associated type bounds can be removed from `link-crypto`. This lets us
avoid a compiler bug in recent `rustc`s [0] without compromising
errrrgonomics.

[0]: rust-lang/rust#90691

Signed-off-by: Kim Altintop <[email protected]>
  • Loading branch information
kim committed Dec 10, 2021
1 parent 7e8828d commit 1860322
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sign/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl Debug for Signature {

#[async_trait]
pub trait Signer {
type Error;
type Error: std::error::Error + Send + Sync + 'static;

/// Obtain the [`PublicKey`] used for signing
fn public_key(&self) -> PublicKey;
Expand Down

0 comments on commit 1860322

Please sign in to comment.