From 52026474e774a745a2f0f84312098d7120d4d5a8 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Thu, 14 Dec 2023 10:24:54 -0800 Subject: [PATCH] async-signature: move to `AFIT` `AFIT` is expected in the upcoming rust-1.75 release (scheduled for 2023/12/28). `#[allow(async_fn_in_trait)]` is required until a solution to RPITIT is merged in rust. This put responsability on the implementor of `async_signature::AsyncSigner` to make sure their future is `Send`able. see https://github.com/rust-lang/rust/pull/115822#issuecomment-1731149475 for more context. --- async-signature/Cargo.toml | 2 +- async-signature/src/lib.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/async-signature/Cargo.toml b/async-signature/Cargo.toml index 753f6294..d5bc4511 100644 --- a/async-signature/Cargo.toml +++ b/async-signature/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" keywords = ["crypto", "ecdsa", "ed25519", "signature", "signing"] categories = ["cryptography", "no-std"] edition = "2021" -rust-version = "1.60" +rust-version = "1.75" [dependencies] async-trait = "0.1.9" diff --git a/async-signature/src/lib.rs b/async-signature/src/lib.rs index 8c59952c..6b88d34d 100644 --- a/async-signature/src/lib.rs +++ b/async-signature/src/lib.rs @@ -17,13 +17,12 @@ pub use signature::{self, Error}; #[cfg(feature = "digest")] pub use signature::digest::{self, Digest}; -use async_trait::async_trait; /// Asynchronously sign the provided message bytestring using `Self` /// (e.g. client for a Cloud KMS or HSM), returning a digital signature. /// /// This trait is an async equivalent of the [`signature::Signer`] trait. -#[async_trait(?Send)] +#[allow(async_fn_in_trait)] pub trait AsyncSigner { /// Attempt to sign the given message, returning a digital signature on /// success, or an error if something went wrong. @@ -33,7 +32,6 @@ pub trait AsyncSigner { async fn sign_async(&self, msg: &[u8]) -> Result; } -#[async_trait(?Send)] impl AsyncSigner for T where S: 'static, @@ -48,7 +46,7 @@ where /// /// This trait is an async equivalent of the [`signature::DigestSigner`] trait. #[cfg(feature = "digest")] -#[async_trait(?Send)] +#[allow(async_fn_in_trait)] pub trait AsyncDigestSigner where D: Digest + 'static, @@ -60,7 +58,6 @@ where } #[cfg(feature = "digest")] -#[async_trait(?Send)] impl AsyncDigestSigner for T where D: Digest + 'static,