Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
GoodAllocator doesn't have to be 'static with in-place where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
saitima committed Dec 12, 2023
1 parent d9450e0 commit e4f5427
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/cs/implementations/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct WitnessSet<F: SmallField> {
#[derive(Derivative, serde::Serialize, serde::Deserialize)]
#[derivative(Clone, Debug)]
#[serde(bound = "F: serde::Serialize + serde::de::DeserializeOwned")]
pub struct WitnessVec<F: SmallField, A: GoodAllocator> {
pub struct WitnessVec<F: SmallField, A: GoodAllocator = Global> {
pub public_inputs_locations: Vec<(usize, usize)>,
#[serde(serialize_with = "crate::utils::serialize_vec_with_allocator")]
#[serde(deserialize_with = "crate::utils::deserialize_vec_with_allocator")]
Expand All @@ -40,7 +40,10 @@ pub struct WitnessVec<F: SmallField, A: GoodAllocator> {
pub multiplicities: Vec<u32, A>,
}

impl<F: SmallField, A: GoodAllocator> MemcopySerializable for WitnessVec<F, A> {
impl<F: SmallField, A: GoodAllocator> MemcopySerializable for WitnessVec<F, A>
where
A: 'static,
{
fn read_from_buffer<R: std::io::Read>(mut src: R) -> Result<Self, Box<dyn std::error::Error>> {
let public_inputs_locations = read_vec_from_buffer(&mut src)?;
let all_values = MemcopySerializable::read_from_buffer(&mut src)?;
Expand Down
5 changes: 1 addition & 4 deletions src/cs/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ pub mod evaluator;
pub mod gate;
pub mod trace_source;

pub trait GoodAllocator:
Allocator + Clone + Default + Send + Sync + std::fmt::Debug + 'static
{
}
pub trait GoodAllocator: Allocator + Clone + Default + Send + Sync + std::fmt::Debug {}

impl GoodAllocator for std::alloc::Global {}

0 comments on commit e4f5427

Please sign in to comment.