diff --git a/maybe_rayon/src/lib.rs b/maybe_rayon/src/lib.rs index c4bfb2e93b..8e8d071862 100644 --- a/maybe_rayon/src/lib.rs +++ b/maybe_rayon/src/lib.rs @@ -1,8 +1,7 @@ +#![cfg_attr(not(std), no_std)] + #[cfg(not(feature = "parallel"))] -use core::{ - iter::{FlatMap, IntoIterator, Iterator}, - slice::{Chunks, ChunksExact, ChunksExactMut, ChunksMut}, -}; +extern crate alloc; #[cfg(feature = "parallel")] pub use rayon::{ @@ -20,6 +19,14 @@ use rayon::{ ChunksMut as ParChunksMut, ParallelSlice, ParallelSliceMut, }, }; +#[cfg(not(feature = "parallel"))] +use { + alloc::vec::Vec, + core::{ + iter::{FlatMap, IntoIterator, Iterator}, + slice::{self, Chunks, ChunksExact, ChunksExactMut, ChunksMut}, + }, +}; pub trait MaybeParIter<'data> { #[cfg(feature = "parallel")] @@ -53,7 +60,7 @@ where #[cfg(not(feature = "parallel"))] impl<'data, T: 'data> MaybeParIter<'data> for Vec { type Item = &'data T; - type Iter = std::slice::Iter<'data, T>; + type Iter = slice::Iter<'data, T>; fn par_iter(&'data self) -> Self::Iter { self.iter() @@ -63,7 +70,7 @@ impl<'data, T: 'data> MaybeParIter<'data> for Vec { #[cfg(not(feature = "parallel"))] impl<'data, T: 'data> MaybeParIter<'data> for [T] { type Item = &'data T; - type Iter = std::slice::Iter<'data, T>; + type Iter = slice::Iter<'data, T>; fn par_iter(&'data self) -> Self::Iter { self.iter() @@ -102,7 +109,7 @@ where #[cfg(not(feature = "parallel"))] impl<'data, T: 'data> MaybeParIterMut<'data> for Vec { type Item = &'data mut T; - type Iter = std::slice::IterMut<'data, T>; + type Iter = slice::IterMut<'data, T>; fn par_iter_mut(&'data mut self) -> Self::Iter { self.iter_mut() @@ -112,7 +119,7 @@ impl<'data, T: 'data> MaybeParIterMut<'data> for Vec { #[cfg(not(feature = "parallel"))] impl<'data, T: 'data> MaybeParIterMut<'data> for [T] { type Item = &'data mut T; - type Iter = std::slice::IterMut<'data, T>; + type Iter = slice::IterMut<'data, T>; fn par_iter_mut(&'data mut self) -> Self::Iter { self.iter_mut() diff --git a/plonky2/Cargo.toml b/plonky2/Cargo.toml index 4cc44cccd3..f20932a594 100644 --- a/plonky2/Cargo.toml +++ b/plonky2/Cargo.toml @@ -31,7 +31,6 @@ plonky2_util = { path = "../util", default-features = false } rand = { version = "0.8.4", default-features = false } rand_chacha = { version = "0.3.1", optional = true, default-features = false } serde = { version = "1.0", default-features = false, features = ["derive", "rc"] } -serde_json = "1.0" static_assertions = { version = "1.1.0", default-features = false } unroll = { version = "0.1.5", default-features = false } web-time = { version = "1.0.0", optional = true } @@ -46,6 +45,7 @@ num_cpus = { version = "1.14.0", default-features = false } rand = { version = "0.8.4", default-features = false, features = ["getrandom"] } rand_chacha = { version = "0.3.1", default-features = false } serde_cbor = { version = "0.11.2" } +serde_json = { version = "1.0" } structopt = { version = "0.3.26", default-features = false } tynm = { version = "0.1.6", default-features = false }