diff --git a/src/lib.rs b/src/lib.rs index b4d077b0..22b601e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,7 +59,10 @@ pub trait RngCore: TryRngCore { fn fill_bytes(&mut self, dst: &mut [u8]); } -impl> RngCore for R { +impl RngCore for R +where + R: TryRngCore + ?Sized, +{ #[inline] fn next_u32(&mut self) -> u32 { match self.try_next_u32() { @@ -86,9 +89,9 @@ impl> RngCore for R { /// /// This is a convenient trait alias for [TryCryptoRng]. /// It is equivalent to the trait sum [RngCore] + [TryCryptoRng]. -pub trait CryptoRng: TryCryptoRng {} +pub trait CryptoRng: RngCore + TryCryptoRng {} -impl> CryptoRng for R {} +impl CryptoRng for R where R: TryCryptoRng + ?Sized {} /// Base trait for random number generators and random data sources ///