Skip to content

Commit

Permalink
Apply feedback from rust-lang/rust#56241
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Mar 26, 2019
1 parent 332db4d commit 715a740
Show file tree
Hide file tree
Showing 7 changed files with 292 additions and 161 deletions.
12 changes: 2 additions & 10 deletions src/external_trait_impls/rayon/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pub struct RawParIter<T> {
iter: RawIterRange<T>,
}

unsafe impl<T> Send for RawParIter<T> {}

impl<T> ParallelIterator for RawParIter<T> {
type Item = Bucket<T>;

Expand All @@ -35,8 +33,6 @@ struct ParIterProducer<T> {
iter: RawIterRange<T>,
}

unsafe impl<T> Send for ParIterProducer<T> {}

impl<T> UnindexedProducer for ParIterProducer<T> {
type Item = Bucket<T>;

Expand All @@ -62,8 +58,6 @@ pub struct RawIntoParIter<T> {
table: RawTable<T>,
}

unsafe impl<T> Send for RawIntoParIter<T> {}

impl<T: Send> ParallelIterator for RawIntoParIter<T> {
type Item = T;

Expand All @@ -87,8 +81,8 @@ impl<T: Send> ParallelIterator for RawIntoParIter<T> {

/// Parallel iterator which consumes elements without freeing the table storage.
pub struct RawParDrain<'a, T> {
// We don't use a &'a RawTable<T> because we want RawParDrain to be
// covariant over 'a.
// We don't use a &'a mut RawTable<T> because we want RawParDrain to be
// covariant over T.
table: NonNull<RawTable<T>>,
_marker: PhantomData<&'a RawTable<T>>,
}
Expand Down Expand Up @@ -126,8 +120,6 @@ struct ParDrainProducer<T> {
iter: RawIterRange<T>,
}

unsafe impl<T: Send> Send for ParDrainProducer<T> {}

impl<T: Send> UnindexedProducer for ParDrainProducer<T> {
type Item = T;

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#![allow(clippy::module_name_repetitions)]

#[cfg(test)]
#[cfg_attr(feature = "rayon", macro_use)]
extern crate std;
#[cfg(test)]
extern crate rand;
Expand All @@ -45,6 +44,7 @@ extern crate std as alloc;
#[macro_use]
mod macros;

mod scopeguard;
mod external_trait_impls;
mod fx;
mod map;
Expand Down
4 changes: 2 additions & 2 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ where
/// [`HashMap`]: struct.HashMap.html
pub struct Iter<'a, K: 'a, V: 'a> {
inner: RawIter<(K, V)>,
_marker: PhantomData<&'a HashMap<K, V>>,
_marker: PhantomData<(&'a K, &'a V)>,
}

// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
Expand Down Expand Up @@ -1120,7 +1120,7 @@ impl<'a, K: Debug, V: Debug> fmt::Debug for Iter<'a, K, V> {
pub struct IterMut<'a, K: 'a, V: 'a> {
inner: RawIter<(K, V)>,
// To ensure invariance with respect to V
_marker: PhantomData<&'a mut V>,
_marker: PhantomData<(&'a K, &'a mut V)>,
}

impl<'a, K, V> IterMut<'a, K, V> {
Expand Down
6 changes: 6 additions & 0 deletions src/raw/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ impl Group {
BitMask((self.0 & repeat(0x80)).to_le())
}

/// Returns a `BitMask` indicating all bytes in the group which are full.
#[inline]
pub fn match_full(&self) -> BitMask {
self.match_empty_or_deleted().invert()
}

/// Performs the following transformation on all bytes in the group:
/// - `EMPTY => EMPTY`
/// - `DELETED => EMPTY`
Expand Down
Loading

0 comments on commit 715a740

Please sign in to comment.