Skip to content

Commit

Permalink
Merge pull request 0xPolygonZero#1 from InternetMaximalism/fix/no-std
Browse files Browse the repository at this point in the history
fix error when no std
  • Loading branch information
qope committed Jan 5, 2023
2 parents 4cb0b48 + 9a980e9 commit f99ed9c
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 12 deletions.
2 changes: 2 additions & 0 deletions plonky2/src/gadgets/hash.rs
@@ -1,3 +1,5 @@
use alloc::vec::Vec;

use crate::field::extension::Extendable;
use crate::hash::hash_types::{HashOutTarget, RichField};
use crate::hash::hashing::SPONGE_WIDTH;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/arithmetic_base.rs
@@ -1,6 +1,6 @@
use alloc::boxed::Box;
use alloc::format;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;

use crate::field::extension::Extendable;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/arithmetic_extension.rs
@@ -1,6 +1,6 @@
use alloc::boxed::Box;
use alloc::format;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::ops::Range;

Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/base_sum.rs
@@ -1,5 +1,5 @@
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::ops::Range;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/constant.rs
@@ -1,5 +1,5 @@
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};

Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/exponentiation.rs
@@ -1,5 +1,5 @@
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::marker::PhantomData;
Expand Down
3 changes: 2 additions & 1 deletion plonky2/src/gates/low_degree_interpolation.rs
@@ -1,5 +1,6 @@
use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/multiplication_extension.rs
@@ -1,6 +1,6 @@
use alloc::boxed::Box;
use alloc::format;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::ops::Range;

Expand Down
3 changes: 2 additions & 1 deletion plonky2/src/gates/poseidon.rs
@@ -1,5 +1,6 @@
use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/poseidon_mds.rs
@@ -1,5 +1,5 @@
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::marker::PhantomData;
Expand Down
1 change: 1 addition & 0 deletions plonky2/src/gates/public_input.rs
@@ -1,4 +1,5 @@
use alloc::boxed::Box;
use alloc::format;
use alloc::string::String;
use alloc::vec::Vec;
use core::ops::Range;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/random_access.rs
@@ -1,5 +1,5 @@
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/reducing.rs
@@ -1,5 +1,5 @@
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::ops::Range;
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/gates/reducing_extension.rs
@@ -1,5 +1,5 @@
use alloc::boxed::Box;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use core::ops::Range;
Expand Down
1 change: 1 addition & 0 deletions plonky2/src/recursion/dummy_circuit.rs
@@ -1,4 +1,5 @@
use alloc::vec;
use alloc::vec::Vec;

use hashbrown::HashMap;
use plonky2_field::extension::Extendable;
Expand Down
2 changes: 2 additions & 0 deletions plonky2/src/util/serialization.rs
Expand Up @@ -804,12 +804,14 @@ impl Buffer {
}
}

#[cfg(feature = "std")]
impl Remaining for Buffer {
fn remaining(&self) -> usize {
self.bytes.len() - self.pos
}
}

#[cfg(feature = "std")]
impl Read for Buffer {
#[inline]
fn read_exact(&mut self, bytes: &mut [u8]) -> IoResult<()> {
Expand Down

0 comments on commit f99ed9c

Please sign in to comment.