Skip to content

Commit 84b88b2

Browse files
authored
kem: change associated Error bounds to core::error::Error (#2139)
Now that the `Error` trait is stable in `core`, we can bound on it instead of on `Debug` (where `Error` has a supertrait bound on `Debug`)
1 parent 034329f commit 84b88b2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

kem/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010

1111
pub use crypto_common::{KeyInit, KeySizeUser, typenum::consts};
1212

13-
use core::fmt::Debug;
1413
use rand_core::TryCryptoRng;
1514

1615
/// A value that can be encapsulated to. Often, this will just be a public key. However, it can
1716
/// also be a bundle of public keys, or it can include a sender's private key for authenticated
1817
/// encapsulation.
1918
pub trait Encapsulate<EK, SS> {
2019
/// Encapsulation error
21-
type Error: Debug;
20+
type Error: core::error::Error;
2221

2322
/// Encapsulates a fresh shared secret
2423
fn encapsulate<R: TryCryptoRng + ?Sized>(&self, rng: &mut R) -> Result<(EK, SS), Self::Error>;
@@ -33,7 +32,7 @@ pub trait Decapsulate<EK, SS> {
3332
type Encapsulator: Encapsulate<EK, SS>;
3433

3534
/// Decapsulation error
36-
type Error: Debug;
35+
type Error: core::error::Error;
3736

3837
/// Decapsulates the given encapsulated key
3938
fn decapsulate(&self, encapsulated_key: &EK) -> Result<SS, Self::Error>;

0 commit comments

Comments
 (0)