Add ?Sized to RngCore trait bounds (#14)

Closes #13.
This commit is contained in:
Weiliang Li 2019-12-22 00:39:49 +09:00 committed by str4d
parent 09a32b1a48
commit f76872ad80
2 changed files with 2 additions and 2 deletions

View File

@ -883,7 +883,7 @@ fn prime_field_impl(
impl ::ff::Field for #name { impl ::ff::Field for #name {
/// Computes a uniformly random element using rejection sampling. /// Computes a uniformly random element using rejection sampling.
fn random<R: ::rand_core::RngCore>(rng: &mut R) -> Self { fn random<R: ::rand_core::RngCore + ?std::marker::Sized>(rng: &mut R) -> Self {
loop { loop {
let mut tmp = { let mut tmp = {
let mut repr = [0u64; #limbs]; let mut repr = [0u64; #limbs];

View File

@ -21,7 +21,7 @@ pub trait Field:
Sized + Eq + Copy + Clone + Send + Sync + fmt::Debug + fmt::Display + 'static Sized + Eq + Copy + Clone + Send + Sync + fmt::Debug + fmt::Display + 'static
{ {
/// Returns an element chosen uniformly at random using a user-provided RNG. /// Returns an element chosen uniformly at random using a user-provided RNG.
fn random<R: RngCore>(rng: &mut R) -> Self; fn random<R: RngCore + ?std::marker::Sized>(rng: &mut R) -> Self;
/// Returns the zero element of the field, the additive identity. /// Returns the zero element of the field, the additive identity.
fn zero() -> Self; fn zero() -> Self;