diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ebce784..2a52f39d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,6 @@ jobs: features: quickcheck - rust: stable features: rayon - - rust: stable - features: rustc-rayon - rust: stable features: serde - rust: stable diff --git a/Cargo.toml b/Cargo.toml index e85e6f60..8850a6fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,10 +22,6 @@ serde = { version = "1.0", optional = true, default-features = false } borsh = { version = "1.2", optional = true, default-features = false } rayon = { version = "1.9", optional = true } -# Internal feature, only used when building as part of rustc, -# not part of the stable interface of this crate. -rustc-rayon = { package = "rustc-rayon", version = "0.5", optional = true } - [dependencies.hashbrown] version = "0.15.0" default-features = false diff --git a/src/lib.rs b/src/lib.rs index 4fd9aac1..e99f0a22 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,9 +127,6 @@ pub mod set; #[cfg(feature = "rayon")] mod rayon; -#[cfg(feature = "rustc-rayon")] -mod rustc; - pub use crate::map::IndexMap; pub use crate::set::IndexSet; pub use equivalent::Equivalent; diff --git a/src/macros.rs b/src/macros.rs index b347de22..65f34369 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -125,7 +125,7 @@ macro_rules! double_ended_iterator_methods { // generate `ParallelIterator` methods by just forwarding to the underlying // self.entries and mapping its elements. -#[cfg(any(feature = "rayon", feature = "rustc-rayon"))] +#[cfg(feature = "rayon")] macro_rules! parallel_iterator_methods { // $map_elt is the mapping function from the underlying iterator's element ($map_elt:expr) => { @@ -150,7 +150,7 @@ macro_rules! parallel_iterator_methods { // generate `IndexedParallelIterator` methods by just forwarding to the underlying // self.entries and mapping its elements. -#[cfg(any(feature = "rayon", feature = "rustc-rayon"))] +#[cfg(feature = "rayon")] macro_rules! indexed_parallel_iterator_methods { // $map_elt is the mapping function from the underlying iterator's element ($map_elt:expr) => { diff --git a/src/rustc.rs b/src/rustc.rs deleted file mode 100644 index b843858b..00000000 --- a/src/rustc.rs +++ /dev/null @@ -1,158 +0,0 @@ -//! Minimal support for `rustc-rayon`, not intended for general use. - -use crate::vec::Vec; -use crate::{Bucket, Entries, IndexMap, IndexSet}; - -use rustc_rayon::iter::plumbing::{Consumer, ProducerCallback, UnindexedConsumer}; -use rustc_rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator}; - -mod map { - use super::*; - - impl IntoParallelIterator for IndexMap - where - K: Send, - V: Send, - { - type Item = (K, V); - type Iter = IntoParIter; - - fn into_par_iter(self) -> Self::Iter { - IntoParIter { - entries: self.into_entries(), - } - } - } - - pub struct IntoParIter { - entries: Vec>, - } - - impl ParallelIterator for IntoParIter { - type Item = (K, V); - - parallel_iterator_methods!(Bucket::key_value); - } - - impl IndexedParallelIterator for IntoParIter { - indexed_parallel_iterator_methods!(Bucket::key_value); - } - - impl<'a, K, V, S> IntoParallelIterator for &'a IndexMap - where - K: Sync, - V: Sync, - { - type Item = (&'a K, &'a V); - type Iter = ParIter<'a, K, V>; - - fn into_par_iter(self) -> Self::Iter { - ParIter { - entries: self.as_entries(), - } - } - } - - pub struct ParIter<'a, K, V> { - entries: &'a [Bucket], - } - - impl<'a, K: Sync, V: Sync> ParallelIterator for ParIter<'a, K, V> { - type Item = (&'a K, &'a V); - - parallel_iterator_methods!(Bucket::refs); - } - - impl IndexedParallelIterator for ParIter<'_, K, V> { - indexed_parallel_iterator_methods!(Bucket::refs); - } - - impl<'a, K, V, S> IntoParallelIterator for &'a mut IndexMap - where - K: Sync + Send, - V: Send, - { - type Item = (&'a K, &'a mut V); - type Iter = ParIterMut<'a, K, V>; - - fn into_par_iter(self) -> Self::Iter { - ParIterMut { - entries: self.as_entries_mut(), - } - } - } - - pub struct ParIterMut<'a, K, V> { - entries: &'a mut [Bucket], - } - - impl<'a, K: Sync + Send, V: Send> ParallelIterator for ParIterMut<'a, K, V> { - type Item = (&'a K, &'a mut V); - - parallel_iterator_methods!(Bucket::ref_mut); - } - - impl IndexedParallelIterator for ParIterMut<'_, K, V> { - indexed_parallel_iterator_methods!(Bucket::ref_mut); - } -} - -mod set { - use super::*; - - impl IntoParallelIterator for IndexSet - where - T: Send, - { - type Item = T; - type Iter = IntoParIter; - - fn into_par_iter(self) -> Self::Iter { - IntoParIter { - entries: self.into_entries(), - } - } - } - - pub struct IntoParIter { - entries: Vec>, - } - - impl ParallelIterator for IntoParIter { - type Item = T; - - parallel_iterator_methods!(Bucket::key); - } - - impl IndexedParallelIterator for IntoParIter { - indexed_parallel_iterator_methods!(Bucket::key); - } - - impl<'a, T, S> IntoParallelIterator for &'a IndexSet - where - T: Sync, - { - type Item = &'a T; - type Iter = ParIter<'a, T>; - - fn into_par_iter(self) -> Self::Iter { - ParIter { - entries: self.as_entries(), - } - } - } - - pub struct ParIter<'a, T> { - entries: &'a [Bucket], - } - - impl<'a, T: Sync> ParallelIterator for ParIter<'a, T> { - type Item = &'a T; - - parallel_iterator_methods!(Bucket::key_ref); - } - - impl IndexedParallelIterator for ParIter<'_, T> { - indexed_parallel_iterator_methods!(Bucket::key_ref); - } -}